aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2007-10-16 04:29:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:23 -0400
commitc3ca34f90b44049dcde62a8f97554409112bf376 (patch)
treee29782c415a1580febf0407a2c603233f6833a58
parentd4b766a0bdab8d07b720c8d0a84292949a7d58bd (diff)
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 <krzysztof.h1@wp.pl> Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/s3fb.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c
index a96ac4392173..7d53bc23b9c7 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)
400{ 400{
401 struct s3fb_info *par = info->par; 401 struct s3fb_info *par = info->par;
402 int rv, mem, step; 402 int rv, mem, step;
403 u16 m, n, r;
403 404
404 /* Find appropriate format */ 405 /* Find appropriate format */
405 rv = svga_match_format (s3fb_formats, var, NULL); 406 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)
427 428
428 /* Check whether have enough memory */ 429 /* Check whether have enough memory */
429 mem = ((var->bits_per_pixel * var->xres_virtual) >> 3) * var->yres_virtual; 430 mem = ((var->bits_per_pixel * var->xres_virtual) >> 3) * var->yres_virtual;
430 if (mem > info->screen_size) 431 if (mem > info->screen_size) {
431 {
432 printk(KERN_ERR "fb%d: not enough framebuffer memory (%d kB requested , %d kB available)\n", 432 printk(KERN_ERR "fb%d: not enough framebuffer memory (%d kB requested , %d kB available)\n",
433 info->node, mem >> 10, (unsigned int) (info->screen_size >> 10)); 433 info->node, mem >> 10, (unsigned int) (info->screen_size >> 10));
434 return -EINVAL; 434 return -EINVAL;
435 } 435 }
436 436
437 rv = svga_check_timings (&s3_timing_regs, var, info->node); 437 rv = svga_check_timings (&s3_timing_regs, var, info->node);
438 if (rv < 0) 438 if (rv < 0) {
439 {
440 printk(KERN_ERR "fb%d: invalid timings requested\n", info->node); 439 printk(KERN_ERR "fb%d: invalid timings requested\n", info->node);
441 return rv; 440 return rv;
442 } 441 }
443 442
443 rv = svga_compute_pll(&s3_pll, PICOS2KHZ(var->pixclock), &m, &n, &r,
444 info->node);
445 if (rv < 0) {
446 printk(KERN_ERR "fb%d: invalid pixclock value requested\n",
447 info->node);
448 return rv;
449 }
450
444 return 0; 451 return 0;
445} 452}
446 453