From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: linux-fbdev-devel@lists.sourceforge.net, adaplas@gmail.com
Cc: Per Hedblom <per.hedblom@abem.se>, Roel Kluin <12o3l@tiscali.nl>,
Jan Weber <jw022609@uni-greifswald.de>,
Andrew Victor <linux@maxim.org.za>,
Haavard Skinnemoen <hskinnemoen@atmel.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] atmel_lcdfb: fix pixclok divider calculation
Date: Tue, 06 May 2008 19:36:08 +0200 [thread overview]
Message-ID: <48209708.3020807@atmel.com> (raw)
Fix divider calculation and allow CLKVAL = 0 (divisor 2)
It was not possible to get the clock value 0 (divisor 2) because
the test "<=0" force the BYPASS bit to be activated instead.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
Thanks a lot to Jan, Per, Roel and Haavard for sending me
similar patches.
drivers/video/atmel_lcdfb.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -441,13 +441,12 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
value = DIV_ROUND_UP(clk_value_khz, PICOS2KHZ(info->var.pixclock));
- value = (value / 2) - 1;
- dev_dbg(info->device, " * programming CLKVAL = 0x%08lx\n", value);
-
- if (value <= 0) {
+ if (value < 2) {
dev_notice(info->device, "Bypassing pixel clock divider\n");
lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS);
} else {
+ value = (value / 2) - 1;
+ dev_dbg(info->device, " * programming CLKVAL = 0x%08lx\n", value);
lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, value << ATMEL_LCDC_CLKVAL_OFFSET);
info->var.pixclock = KHZ2PICOS(clk_value_khz / (2 * (value + 1)));
dev_dbg(info->device, " updated pixclk: %lu KHz\n",
reply other threads:[~2008-05-06 17:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48209708.3020807@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=12o3l@tiscali.nl \
--cc=adaplas@gmail.com \
--cc=hskinnemoen@atmel.com \
--cc=jw022609@uni-greifswald.de \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@maxim.org.za \
--cc=per.hedblom@abem.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).