Commit 74a933fe authored by Krzysztof Helt's avatar Krzysztof Helt Committed by Linus Torvalds

tridentfb: improve check_var function

Do some additional checks (like pixelclock versus ramdac speed) to
eliminate modes which do not work.
Signed-off-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent aa0aa8ab
...@@ -829,6 +829,7 @@ static int tridentfb_check_var(struct fb_var_screeninfo *var, ...@@ -829,6 +829,7 @@ static int tridentfb_check_var(struct fb_var_screeninfo *var,
{ {
struct tridentfb_par *par = info->par; struct tridentfb_par *par = info->par;
int bpp = var->bits_per_pixel; int bpp = var->bits_per_pixel;
int ramdac = 230000; /* 230MHz for most 3D chips */
debug("enter\n"); debug("enter\n");
/* check color depth */ /* check color depth */
...@@ -837,6 +838,12 @@ static int tridentfb_check_var(struct fb_var_screeninfo *var, ...@@ -837,6 +838,12 @@ static int tridentfb_check_var(struct fb_var_screeninfo *var,
/* check whether resolution fits on panel and in memory */ /* check whether resolution fits on panel and in memory */
if (par->flatpanel && nativex && var->xres > nativex) if (par->flatpanel && nativex && var->xres > nativex)
return -EINVAL; return -EINVAL;
/* various resolution checks */
var->xres = (var->xres + 7) & ~0x7;
if (var->xres != var->xres_virtual)
var->xres_virtual = var->xres;
if (var->yres > var->yres_virtual)
var->yres_virtual = var->yres;
if (var->xres * var->yres_virtual * bpp / 8 > info->fix.smem_len) if (var->xres * var->yres_virtual * bpp / 8 > info->fix.smem_len)
return -EINVAL; return -EINVAL;
...@@ -868,6 +875,33 @@ static int tridentfb_check_var(struct fb_var_screeninfo *var, ...@@ -868,6 +875,33 @@ static int tridentfb_check_var(struct fb_var_screeninfo *var,
default: default:
return -EINVAL; return -EINVAL;
} }
if (is_xp(par->chip_id))
ramdac = 350000;
switch (par->chip_id) {
case TGUI9440:
ramdac = 90000;
break;
case CYBER9320:
case TGUI9660:
ramdac = 135000;
break;
case PROVIDIA9685:
case CYBER9388:
case CYBER9382:
case CYBER9385:
ramdac = 170000;
break;
}
/* The clock is doubled for 32 bpp */
if (bpp == 32)
ramdac /= 2;
if (PICOS2KHZ(var->pixclock) > ramdac)
return -EINVAL;
debug("exit\n"); debug("exit\n");
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment