Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c3ca34f90b44049dcde62a8f97554409112bf376
Commit:     c3ca34f90b44049dcde62a8f97554409112bf376
Parent:     d4b766a0bdab8d07b720c8d0a84292949a7d58bd
Author:     Krzysztof Helt <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 16 01:29:54 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Oct 16 09:43:23 2007 -0700

    s3fb: do not allow incorrect pixclock settings
    
    This patch adds check if selected pixclock is valid (is in the PLL range).
    
    Previously, if the pixclock could not be set, the new mode resolution was 
set
    but pixclock was not set which led to incorrect timings sent to monitor.
    
    [adaplas]
    Fixed a few misplaced curly braces.
    
    Signed-off-by: Krzysztof Helt <[EMAIL PROTECTED]>
    Signed-off-by: Antonino Daplas <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/video/s3fb.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
index a96ac43..7d53bc2 100644
--- a/drivers/video/s3fb.c
+++ b/drivers/video/s3fb.c
@@ -400,6 +400,7 @@ static int s3fb_check_var(struct fb_var_screeninfo *var, 
struct fb_info *info)
 {
        struct s3fb_info *par = info->par;
        int rv, mem, step;
+       u16 m, n, r;
 
        /* Find appropriate format */
        rv = svga_match_format (s3fb_formats, var, NULL);
@@ -427,20 +428,26 @@ static int s3fb_check_var(struct fb_var_screeninfo *var, 
struct fb_info *info)
 
        /* Check whether have enough memory */
        mem = ((var->bits_per_pixel * var->xres_virtual) >> 3) * 
var->yres_virtual;
-       if (mem > info->screen_size)
-       {
+       if (mem > info->screen_size) {
                printk(KERN_ERR "fb%d: not enough framebuffer memory (%d kB 
requested , %d kB available)\n",
                        info->node, mem >> 10, (unsigned int) 
(info->screen_size >> 10));
                return -EINVAL;
        }
 
        rv = svga_check_timings (&s3_timing_regs, var, info->node);
-       if (rv < 0)
-       {
+       if (rv < 0) {
                printk(KERN_ERR "fb%d: invalid timings requested\n", 
info->node);
                return rv;
        }
 
+       rv = svga_compute_pll(&s3_pll, PICOS2KHZ(var->pixclock), &m, &n, &r,
+                               info->node);
+       if (rv < 0) {
+               printk(KERN_ERR "fb%d: invalid pixclock value requested\n",
+                       info->node);
+               return rv;
+       }
+
        return 0;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to