Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-02-12 23:46:43 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2004-02-12 23:46:43 -0800
commitd8d3ff3d3d8b3a9a6d9a2307cc78c4948f3857c3 (patch)
tree0e9996a4f471ff75633c9b2b1ccd4c52d409ecab
parentb197d6e3f47d7332b0e5f591dd4717e017427cff (diff)
[PATCH] sh: pvr2fb updates
From: Paul Mundt <lethal@linux-sh.org> Sanity fixes in pvr2fb_check_var() so we don't constantly report an invalid pixclock.. also fixup FB_SYNC_BROADCAST setting so this doesn't get improperly assigned in the VO_VGA case.
-rw-r--r--drivers/video/pvr2fb.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c
index 64d01c111b4d..5ef3224606c5 100644
--- a/drivers/video/pvr2fb.c
+++ b/drivers/video/pvr2fb.c
@@ -436,10 +436,11 @@ static int pvr2fb_set_par(struct fb_info *info)
static int pvr2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
+ struct pvr2fb_par *par = (struct pvr2fb_par *)info->par;
unsigned int vtotal, hsync_total;
unsigned long line_length;
- if (var->pixclock != TV_CLK || var->pixclock != VGA_CLK) {
+ if (var->pixclock != TV_CLK && var->pixclock != VGA_CLK) {
pr_debug("Invalid pixclock value %d\n", var->pixclock);
return -EINVAL;
}
@@ -481,11 +482,31 @@ static int pvr2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
* PAL/NTSC output).
*/
if (var->yres < 480 && video_output == VO_VGA)
- var->vmode = FB_VMODE_DOUBLE;
+ var->vmode |= FB_VMODE_DOUBLE;
- if (video_output != VO_VGA)
- var->sync = FB_SYNC_BROADCAST | FB_VMODE_INTERLACED;
+ if (video_output != VO_VGA) {
+ var->sync |= FB_SYNC_BROADCAST;
+ var->vmode |= FB_VMODE_INTERLACED;
+ } else {
+ var->sync &= ~FB_SYNC_BROADCAST;
+ var->vmode &= ~FB_VMODE_INTERLACED;
+ var->vmode |= pvr2_var.vmode;
+ }
+ if ((var->activate & FB_ACTIVATE_MASK) != FB_ACTIVATE_TEST) {
+ var->right_margin = par->borderstop_h -
+ (par->diwstart_h + var->xres);
+ var->left_margin = par->diwstart_h - par->borderstart_h;
+ var->hsync_len = par->borderstart_h +
+ (par->hsync_total - par->borderstop_h);
+
+ var->upper_margin = par->diwstart_v - par->borderstart_v;
+ var->lower_margin = par->borderstop_v -
+ (par->diwstart_v + var->yres);
+ var->vsync_len = par->borderstop_v +
+ (par->vsync_total - par->borderstop_v);
+ }
+
hsync_total = var->left_margin + var->xres + var->right_margin +
var->hsync_len;
vtotal = var->upper_margin + var->yres + var->lower_margin +
@@ -509,6 +530,7 @@ static int pvr2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
}
}
}
+
/* Check memory sizes */
line_length = get_line_length(var->xres_virtual, var->bits_per_pixel);
if (line_length * var->yres_virtual > info->fix.smem_len)
@@ -746,7 +768,6 @@ static int __init pvr2fb_common_init(void)
{
struct pvr2fb_par *par = currentpar;
unsigned long modememused, rev;
- int size;
fb_info->screen_base = ioremap_nocache(pvr2_fix.smem_start,
pvr2_fix.smem_len);
@@ -763,7 +784,7 @@ static int __init pvr2fb_common_init(void)
goto out_err;
}
- memset_io((unsigned long)fb_info->screen_base, 0, pvr2_fix.smem_len);
+ fb_memset((unsigned long)fb_info->screen_base, 0, pvr2_fix.smem_len);
pvr2_fix.ypanstep = nopan ? 0 : 1;
pvr2_fix.ywrapstep = nowrap ? 0 : 1;
@@ -784,8 +805,7 @@ static int __init pvr2fb_common_init(void)
NUM_TOTAL_MODES, &pvr2_modedb[defmode], 16))
fb_info->var = pvr2_var;
- size = (fb_info->var.bits_per_pixel == 8) ? 256 : 16;
- fb_alloc_cmap(&fb_info->cmap, size, 0);
+ fb_alloc_cmap(&fb_info->cmap, 256, 0);
if (register_framebuffer(fb_info) < 0)
goto out_err;