From patchwork Fri Jun 14 07:41:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 251255 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1203A2C007B for ; Fri, 14 Jun 2013 17:41:50 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UnOdi-0007pe-IV; Fri, 14 Jun 2013 07:41:43 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UnOdf-0000aE-SM; Fri, 14 Jun 2013 07:41:39 +0000 Received: from f400.i.mail.ru ([185.5.136.71]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UnOdc-0000Zm-Hv for linux-arm-kernel@lists.infradead.org; Fri, 14 Jun 2013 07:41:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail; h=Content-Type:Message-ID:Reply-To:Date:Mime-Version:Subject:To:From; bh=X+NigC9+9M2615gfTMODmTAIBTrOjCIbCVaNVFpm0ZM=; b=YMPXY2sjlltjfiEhHbk5u0+tJvJp+CAuch68YY6yQdM6Z+qAY8DwrwtaA4TJT1b1gMriHiNJucYd9ylHsLW9nAPHIwvO8Iv7K8Whihi5QS0VwqMBHGHZDWdMFjNVoWnj; Received: from mail by f400.i.mail.ru with local (envelope-from ) id 1UnOdC-0002Qi-2u; Fri, 14 Jun 2013 11:41:10 +0400 Received: from [217.119.30.118] by e.mail.ru with HTTP; Fri, 14 Jun 2013 11:41:10 +0400 From: =?UTF-8?B?QWxleGFuZGVyIFNoaXlhbg==?= To: linux-kernel@vger.kernel.org, =?UTF-8?B?R3JlZyBLcm9haC1IYXJ0bWFu?= , devel@driverdev.osuosl.org, =?UTF-8?B?U2FzY2hhIEhhdWVy?= , linux-arm-kernel@lists.infradead.org, =?UTF-8?B?U2hhd24gR3Vv?= , =?UTF-8?B?UGhpbGlwcCBaYWJlbA==?= Subject: =?UTF-8?B?W1JGQ10gU3RhZ2luZzogaW14LWRybTogRG8gbm90IHVzZSBmcmFjdGlvbmFs?= =?UTF-8?B?IHBhcnQgb2YgZGl2aWRlcg==?= Mime-Version: 1.0 X-Mailer: Mail.Ru Mailer 1.0 X-Originating-IP: [217.119.30.118] Date: Fri, 14 Jun 2013 11:41:10 +0400 X-Priority: 3 (Normal) Message-ID: <1371195670.904413971@f400.i.mail.ru> X-Mras: Ok X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130614_034137_185100_46E13011 X-CRM114-Status: UNSURE ( 5.98 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.3 (/) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-0.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (shc_work[at]mail.ru) 0.8 RCVD_IN_SORBS_WEB RBL: SORBS: sender is an abusable web server [217.119.30.118 listed in dnsbl.sorbs.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 1.0 FROM_EXCESS_BASE64 From: base64 encoded unnecessarily X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: =?UTF-8?B?QWxleGFuZGVyIFNoaXlhbg==?= List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Hello. Analysis of driver imx-drm led me to believe that the use fractional part of the divider is not always a good idea. For example, for a parallel display bus connected to LVDS converter chip (DS90C363), in this case the use of fractional part, clock will unstable and the on-chip PLL is not working properly, or rather, does not work at all. Let me give a specific example. ipu_crtc_mode_set 0x36314752 imx-ipuv3 40000000.ipu: clk_di_round_rate: inrate: 133000000 div: 0x00000035 outrate: 40150928 wanted: 40000000 imx-ipuv3 40000000.ipu: clk_di_round_rate: inrate: 133000000 div: 0x00000035 outrate: 40150928 wanted: 40150928 imx-ipuv3 40000000.ipu: clk_di_set_rate: inrate: 133000000 desired: 40150928 div: 0x00000035 In this case the divider is 3.5, that result to clock is incorrect. See an attached oscillogram F0000TEK.jpg. After a patch the clocks is OK. Patch just uncomment some FSL code. imx-ipuv3 40000000.ipu: clk_di_round_rate: inrate: 133000000 div: 0x00000040 outrate: 33250000 wanted: 40000000 imx-ipuv3 40000000.ipu: clk_di_round_rate: inrate: 133000000 div: 0x00000040 outrate: 33250000 wanted: 33250000 imx-ipuv3 40000000.ipu: clk_di_set_rate: inrate: 133000000 desired: 33250000 div: 0x00000040 See an attached oscillogram F0001TEK.jpg. So, I want to review this from developers and wait for comments. diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-di.c b/drivers/staging/imx-drm/ipu-v3/ipu-di.c index 19d777e..d424c22 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-di.c +++ b/drivers/staging/imx-drm/ipu-v3/ipu-di.c @@ -154,22 +154,15 @@ static int ipu_di_clk_calc_div(unsigned long inrate, unsigned long outrate) if (div < 0x10) div = 0x10; - -#ifdef WTF_IS_THIS - /* - * Freescale has this in their Kernel. It is neither clear what - * it does nor why it does it - */ - if (div & 0x10) - div &= ~0x7; else { /* Round up divider if it gets us closer to desired pix clk */ - if ((div & 0xC) == 0xC) { + if (div & 0x0f) { div += 0x10; - div &= ~0xF; + /* Strip fractional part of divider */ + div &= ~0x0f; } } -#endif + return div; }