All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] atmel-lcdc: Fix pixclock upper bound detection
@ 2009-05-10  1:29 Ben Nizette
  2009-05-12 12:08 ` Nicolas Ferre
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Nizette @ 2009-05-10  1:29 UTC (permalink / raw)
  To: nicolas.ferre; +Cc: Haavard Skinnemoen, linux-kernel, kernel


AFAICT the code which checks that the requested pixclock value is within
bounds is incorrect.  It ensures that the lcdc core clock is at least
(bytes per pixel) times higher than the pixel clock rather than just
greater than or equal to.

There are tighter restrictions on the pixclock value as a function of
bus width for STN panels but even then it isn't a simple relationship as
currently checked for.  IMO either something like the below patch should
be applied or else more detailed checking logic should be implemented
which takes in to account the panel type as well.

CMIIW :-)

Signed-off-by: Ben Nizette <bn@niasdigital.com>

---
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 9a577a8..5779641 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -351,7 +351,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
 	dev_dbg(dev, "  bpp:        %u\n", var->bits_per_pixel);
 	dev_dbg(dev, "  clk:        %lu KHz\n", clk_value_khz);
 
-	if ((PICOS2KHZ(var->pixclock) * var->bits_per_pixel / 8) > clk_value_khz) {
+	if (PICOS2KHZ(var->pixclock) > clk_value_khz) {
 		dev_err(dev, "%lu KHz pixel clock is too fast\n", PICOS2KHZ(var->pixclock));
 		return -EINVAL;
 	}



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] atmel-lcdc: Fix pixclock upper bound detection
  2009-05-10  1:29 [PATCH] atmel-lcdc: Fix pixclock upper bound detection Ben Nizette
@ 2009-05-12 12:08 ` Nicolas Ferre
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Ferre @ 2009-05-12 12:08 UTC (permalink / raw)
  To: Ben Nizette, Andrew Morton; +Cc: Haavard Skinnemoen, linux-kernel, kernel

Ben Nizette :
> AFAICT the code which checks that the requested pixclock value is within
> bounds is incorrect.  It ensures that the lcdc core clock is at least
> (bytes per pixel) times higher than the pixel clock rather than just
> greater than or equal to.
> 
> There are tighter restrictions on the pixclock value as a function of
> bus width for STN panels but even then it isn't a simple relationship as
> currently checked for.  IMO either something like the below patch should
> be applied or else more detailed checking logic should be implemented
> which takes in to account the panel type as well.
> 
> CMIIW :-)
> 
> Signed-off-by: Ben Nizette <bn@niasdigital.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> index 9a577a8..5779641 100644
> --- a/drivers/video/atmel_lcdfb.c
> +++ b/drivers/video/atmel_lcdfb.c
> @@ -351,7 +351,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
>  	dev_dbg(dev, "  bpp:        %u\n", var->bits_per_pixel);
>  	dev_dbg(dev, "  clk:        %lu KHz\n", clk_value_khz);
>  
> -	if ((PICOS2KHZ(var->pixclock) * var->bits_per_pixel / 8) > clk_value_khz) {
> +	if (PICOS2KHZ(var->pixclock) > clk_value_khz) {
>  		dev_err(dev, "%lu KHz pixel clock is too fast\n", PICOS2KHZ(var->pixclock));
>  		return -EINVAL;
>  	}
> 
> 
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-12 12:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-10  1:29 [PATCH] atmel-lcdc: Fix pixclock upper bound detection Ben Nizette
2009-05-12 12:08 ` 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.