public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Nizette <bn@niasdigital.com>
To: nicolas.ferre@atmel.com
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	kernel <kernel@avr32linux.org>
Subject: [PATCH] atmel-lcdc: Fix pixclock upper bound detection
Date: Sun, 10 May 2009 11:29:39 +1000	[thread overview]
Message-ID: <1241918979.3246.10.camel@linux-51e8.site> (raw)


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;
 	}



             reply	other threads:[~2009-05-10  1:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-10  1:29 Ben Nizette [this message]
2009-05-12 12:08 ` [PATCH] atmel-lcdc: Fix pixclock upper bound detection Nicolas Ferre

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=1241918979.3246.10.camel@linux-51e8.site \
    --to=bn@niasdigital.com \
    --cc=hskinnemoen@atmel.com \
    --cc=kernel@avr32linux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    /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