All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] atmel_lcdfb: fix pixclok divider calculation
@ 2008-05-06 17:36 Nicolas Ferre
  0 siblings, 0 replies; only message in thread
From: Nicolas Ferre @ 2008-05-06 17:36 UTC (permalink / raw)
  To: linux-fbdev-devel, adaplas
  Cc: Per Hedblom, Roel Kluin, Jan Weber, Andrew Victor,
	Haavard Skinnemoen, linux-kernel

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",

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-06 17:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-06 17:36 [PATCH] atmel_lcdfb: fix pixclok divider calculation Nicolas Ferre

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.