From patchwork Fri Jul 15 21:52:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 980782 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6FLoG5H014828 for ; Fri, 15 Jul 2011 21:57:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752868Ab1GOVwk (ORCPT ); Fri, 15 Jul 2011 17:52:40 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:48200 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752710Ab1GOVwk (ORCPT ); Fri, 15 Jul 2011 17:52:40 -0400 Received: from localhost.localdomain (unknown [91.178.94.100]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 948DD35A00; Fri, 15 Jul 2011 21:52:37 +0000 (UTC) From: Laurent Pinchart To: linux-fbdev@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH 3/3] fbdev: sh_mobile_lcdc: Compute clock pattern using divider denominator Date: Fri, 15 Jul 2011 23:52:33 +0200 Message-Id: <1310766753-30314-4-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1310766753-30314-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1310766753-30314-1-git-send-email-laurent.pinchart@ideasonboard.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 15 Jul 2011 21:57:25 +0000 (UTC) The clock divider pattern is computed based on the dot clock register value which stores the divider denumerator. However, when using a 1:1 divider ratio, the register is programmed with a value that must not be interpreted as a denominator. This results in a shift left operation with a value of 32, which produces undefined behaviour. Compute the clock pattern using the divider denominator, not the dot clock register value. Signed-off-by: Laurent Pinchart --- drivers/video/sh_mobile_lcdcfb.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 32f884e..856f6a9 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c @@ -481,13 +481,15 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) if (!m) continue; + /* FIXME: sh7724 can only use 42, 48, 54 and 60 for the divider + * denominator. + */ + lcdc_write_chan(ch, LDDCKPAT1R, 0); + lcdc_write_chan(ch, LDDCKPAT2R, (1 << (m/2)) - 1); + if (m == 1) m = LDDCKR_MOSEL; tmp |= m << (lcdc_chan_is_sublcd(ch) ? 8 : 0); - - /* FIXME: sh7724 can only use 42, 48, 54 and 60 for the divider denominator */ - lcdc_write_chan(ch, LDDCKPAT1R, 0); - lcdc_write_chan(ch, LDDCKPAT2R, (1 << (m/2)) - 1); } lcdc_write(priv, _LDDCKR, tmp);