aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/sm501fb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/sm501fb.c')
-rw-r--r--drivers/video/sm501fb.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c
index e83dfba7e636..742b5c656d66 100644
--- a/drivers/video/sm501fb.c
+++ b/drivers/video/sm501fb.c
@@ -237,12 +237,14 @@ static int sm501fb_check_var(struct fb_var_screeninfo *var,
237 237
238 /* check we can fit these values into the registers */ 238 /* check we can fit these values into the registers */
239 239
240 if (var->hsync_len > 255 || var->vsync_len > 255) 240 if (var->hsync_len > 255 || var->vsync_len > 63)
241 return -EINVAL; 241 return -EINVAL;
242 242
243 if ((var->xres + var->right_margin) >= 4096) 243 /* hdisplay end and hsync start */
244 if ((var->xres + var->right_margin) > 4096)
244 return -EINVAL; 245 return -EINVAL;
245 246
247 /* vdisplay end and vsync start */
246 if ((var->yres + var->lower_margin) > 2048) 248 if ((var->yres + var->lower_margin) > 2048)
247 return -EINVAL; 249 return -EINVAL;
248 250
@@ -281,19 +283,21 @@ static int sm501fb_check_var(struct fb_var_screeninfo *var,
281 var->blue.length = var->bits_per_pixel; 283 var->blue.length = var->bits_per_pixel;
282 var->blue.offset = 0; 284 var->blue.offset = 0;
283 var->transp.length = 0; 285 var->transp.length = 0;
286 var->transp.offset = 0;
284 287
285 break; 288 break;
286 289
287 case 16: 290 case 16:
288 if (sm->pdata->flags & SM501_FBPD_SWAP_FB_ENDIAN) { 291 if (sm->pdata->flags & SM501_FBPD_SWAP_FB_ENDIAN) {
289 var->red.offset = 11;
290 var->green.offset = 5;
291 var->blue.offset = 0;
292 } else {
293 var->blue.offset = 11; 292 var->blue.offset = 11;
294 var->green.offset = 5; 293 var->green.offset = 5;
295 var->red.offset = 0; 294 var->red.offset = 0;
295 } else {
296 var->red.offset = 11;
297 var->green.offset = 5;
298 var->blue.offset = 0;
296 } 299 }
300 var->transp.offset = 0;
297 301
298 var->red.length = 5; 302 var->red.length = 5;
299 var->green.length = 6; 303 var->green.length = 6;
@@ -397,7 +401,7 @@ static int sm501fb_set_par_common(struct fb_info *info,
397 break; 401 break;
398 402
399 case 16: 403 case 16:
400 info->fix.visual = FB_VISUAL_DIRECTCOLOR; 404 info->fix.visual = FB_VISUAL_TRUECOLOR;
401 break; 405 break;
402 406
403 case 32: 407 case 32:
@@ -613,6 +617,7 @@ static int sm501fb_set_par_crt(struct fb_info *info)
613 617
614 case 16: 618 case 16:
615 control |= SM501_DC_CRT_CONTROL_16BPP; 619 control |= SM501_DC_CRT_CONTROL_16BPP;
620 sm501fb_setup_gamma(fbi, SM501_DC_CRT_PALETTE);
616 break; 621 break;
617 622
618 case 32: 623 case 32:
@@ -750,6 +755,7 @@ static int sm501fb_set_par_pnl(struct fb_info *info)
750 755
751 case 16: 756 case 16:
752 control |= SM501_DC_PANEL_CONTROL_16BPP; 757 control |= SM501_DC_PANEL_CONTROL_16BPP;
758 sm501fb_setup_gamma(fbi, SM501_DC_PANEL_PALETTE);
753 break; 759 break;
754 760
755 case 32: 761 case 32: