From 5619d823bc0e49d05618cdf955b04055b51a7de5 Mon Sep 17 00:00:00 2001 From: Ville Syrjala Date: Tue, 4 Mar 2008 14:28:46 -0800 Subject: sm501fb: direct color visual does not work The sm501fb palette code clearly does not handle direct color so change the driver to use true color visual for 16bpp. Signed-off-by: Ville Syrjala Acked-by: Magnus Damm Acked-by: Ben Dooks Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/sm501fb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/video/sm501fb.c') diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index e83dfba7e636..6e7810d914cc 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c @@ -397,7 +397,7 @@ static int sm501fb_set_par_common(struct fb_info *info, break; case 16: - info->fix.visual = FB_VISUAL_DIRECTCOLOR; + info->fix.visual = FB_VISUAL_TRUECOLOR; break; case 32: @@ -613,6 +613,7 @@ static int sm501fb_set_par_crt(struct fb_info *info) case 16: control |= SM501_DC_CRT_CONTROL_16BPP; + sm501fb_setup_gamma(fbi, SM501_DC_CRT_PALETTE); break; case 32: @@ -750,6 +751,7 @@ static int sm501fb_set_par_pnl(struct fb_info *info) case 16: control |= SM501_DC_PANEL_CONTROL_16BPP; + sm501fb_setup_gamma(fbi, SM501_DC_PANEL_PALETTE); break; case 32: -- cgit v1.2.3 From fedbb3625b3c16441de1378ca00a74e9c1733289 Mon Sep 17 00:00:00 2001 From: Ville Syrjala Date: Tue, 4 Mar 2008 14:28:47 -0800 Subject: sm501fb: RGB offsets are reversed in 16bpp modes The RGB offsets were reversed in 16bpp modes. Simply trying to reverse the offsets when endianness differs is clearly the wrong thing to do but that is an issue for another patch. Signed-off-by: Ville Syrjala Acked-by: Ben Dooks Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/sm501fb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/video/sm501fb.c') diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index 6e7810d914cc..3a98d5a86af1 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c @@ -286,13 +286,13 @@ static int sm501fb_check_var(struct fb_var_screeninfo *var, case 16: if (sm->pdata->flags & SM501_FBPD_SWAP_FB_ENDIAN) { - var->red.offset = 11; - var->green.offset = 5; - var->blue.offset = 0; - } else { var->blue.offset = 11; var->green.offset = 5; var->red.offset = 0; + } else { + var->red.offset = 11; + var->green.offset = 5; + var->blue.offset = 0; } var->red.length = 5; -- cgit v1.2.3 From 19d06eff4e0d77fc1a15c92f845f1916e2d10dd0 Mon Sep 17 00:00:00 2001 From: Ville Syrjala Date: Tue, 4 Mar 2008 14:28:48 -0800 Subject: sm501fb: set transp.offset to 0 in 8bpp and 16bpp modes Even though it may not be strictly necessary transp.offset should probably be 0 when alpha channel is not available. Signed-off-by: Ville Syrjala Acked-by: Ben Dooks Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/sm501fb.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/video/sm501fb.c') diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index 3a98d5a86af1..f49287c88abe 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c @@ -281,6 +281,7 @@ static int sm501fb_check_var(struct fb_var_screeninfo *var, var->blue.length = var->bits_per_pixel; var->blue.offset = 0; var->transp.length = 0; + var->transp.offset = 0; break; @@ -294,6 +295,7 @@ static int sm501fb_check_var(struct fb_var_screeninfo *var, var->green.offset = 5; var->blue.offset = 0; } + var->transp.offset = 0; var->red.length = 5; var->green.length = 6; -- cgit v1.2.3 From 7e533705bd973267c488f8c3a7c7246ecad3a414 Mon Sep 17 00:00:00 2001 From: Ville Syrjala Date: Tue, 4 Mar 2008 14:28:49 -0800 Subject: sm501fb: fix timing limits Vertical sync height register can only hold 6 bits. Fix the hsync start test to use > instead of >=. Also add a few clarifying comments. Signed-off-by: Ville Syrjala Acked-by: Ben Dooks Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/sm501fb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/video/sm501fb.c') diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index f49287c88abe..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, /* check we can fit these values into the registers */ - if (var->hsync_len > 255 || var->vsync_len > 255) + if (var->hsync_len > 255 || var->vsync_len > 63) return -EINVAL; - if ((var->xres + var->right_margin) >= 4096) + /* hdisplay end and hsync start */ + if ((var->xres + var->right_margin) > 4096) return -EINVAL; + /* vdisplay end and vsync start */ if ((var->yres + var->lower_margin) > 2048) return -EINVAL; -- cgit v1.2.3