From: Ben Dooks <ben@simtec.co.uk>
To: akpm@linux-foundation.org, linux-fbdev-devel@lists.sourceforge.net
Subject: s3c2410fb: fix clockrate calculation
Date: Thu, 20 Aug 2009 22:50:47 +0100 [thread overview]
Message-ID: <20090820215047.717581584@fluff.org.uk> (raw)
[-- Attachment #1: s3c2410-fb-fix-rounding.patch --]
[-- Type: text/plain, Size: 1545 bytes --]
In the final part of the calculation for the tft display clockrate we
divide the output pf s3c2410fb_calc_pixclk() by 2 which leaves us with
a rounding error if the result is odd.
Change to using DIV_ROUND_UP() to ensure that we always choose a higher
divisor and thus a lower frequency.
Signed-off-by: Ben Dooks <ben@simtec.co.uk>
---
drivers/video/s3c2410fb.c | 4 +++-
2 files changed, 5 insertions(+), 2 deletions(-)
Index: b/drivers/video/s3c2410fb.c
===================================================================
--- a/drivers/video/s3c2410fb.c 2009-08-20 08:45:41.000000000 +0100
+++ b/drivers/video/s3c2410fb.c 2009-08-20 08:45:42.000000000 +0100
@@ -369,7 +369,9 @@ static void s3c2410fb_activate_var(struc
void __iomem *regs = fbi->io;
int type = fbi->regs.lcdcon1 & S3C2410_LCDCON1_TFT;
struct fb_var_screeninfo *var = &info->var;
- int clkdiv = s3c2410fb_calc_pixclk(fbi, var->pixclock) / 2;
+ int clkdiv;
+
+ clkdiv = DIV_ROUND_UP(s3c2410fb_calc_pixclk(fbi, var->pixclock), 2);
printk(KERN_INFO "%s: pixclock=%d, clkdiv=%d\n",
__func__, var->pixclock, clkdiv);
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
next reply other threads:[~2009-08-20 22:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-20 21:50 Ben Dooks [this message]
2009-08-20 22:19 ` s3c2410fb: fix clockrate calculation Andrew Morton
2009-08-27 9:57 ` Ben Dooks
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=20090820215047.717581584@fluff.org.uk \
--to=ben@simtec.co.uk \
--cc=akpm@linux-foundation.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
/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).