aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Januszewski <spock@gentoo.org>2009-04-13 17:39:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-13 18:04:29 -0400
commit0a4534801468325fdb6a7b7bf73ad2a958a1e379 (patch)
treef2809286876627f9b2f68449cc3623eab280b347
parentc26d7b29d9989cfd9004e688ad517925b0db37d0 (diff)
sa1100fb: fix color component length for pseudocolor modes
sa1100fb incorrectly sets the length of the color fields to 8 bits for PSEUDOCOLOR modes for which only 4 bits are used per pixel. Fix this by setting the length to 4 bits for these modes. Signed-off-by: Michal Januszewski <spock@gentoo.org> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/video/sa1100fb.c15
-rw-r--r--drivers/video/sa1100fb.h7
2 files changed, 14 insertions, 8 deletions
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index fad58cf9ef73..10ddad8e17d6 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -199,16 +199,20 @@
199extern void (*sa1100fb_backlight_power)(int on); 199extern void (*sa1100fb_backlight_power)(int on);
200extern void (*sa1100fb_lcd_power)(int on); 200extern void (*sa1100fb_lcd_power)(int on);
201 201
202/* 202static struct sa1100fb_rgb rgb_4 = {
203 * IMHO this looks wrong. In 8BPP, length should be 8.
204 */
205static struct sa1100fb_rgb rgb_8 = {
206 .red = { .offset = 0, .length = 4, }, 203 .red = { .offset = 0, .length = 4, },
207 .green = { .offset = 0, .length = 4, }, 204 .green = { .offset = 0, .length = 4, },
208 .blue = { .offset = 0, .length = 4, }, 205 .blue = { .offset = 0, .length = 4, },
209 .transp = { .offset = 0, .length = 0, }, 206 .transp = { .offset = 0, .length = 0, },
210}; 207};
211 208
209static struct sa1100fb_rgb rgb_8 = {
210 .red = { .offset = 0, .length = 8, },
211 .green = { .offset = 0, .length = 8, },
212 .blue = { .offset = 0, .length = 8, },
213 .transp = { .offset = 0, .length = 0, },
214};
215
212static struct sa1100fb_rgb def_rgb_16 = { 216static struct sa1100fb_rgb def_rgb_16 = {
213 .red = { .offset = 11, .length = 5, }, 217 .red = { .offset = 11, .length = 5, },
214 .green = { .offset = 5, .length = 6, }, 218 .green = { .offset = 5, .length = 6, },
@@ -613,7 +617,7 @@ sa1100fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
613 DPRINTK("var->bits_per_pixel=%d\n", var->bits_per_pixel); 617 DPRINTK("var->bits_per_pixel=%d\n", var->bits_per_pixel);
614 switch (var->bits_per_pixel) { 618 switch (var->bits_per_pixel) {
615 case 4: 619 case 4:
616 rgbidx = RGB_8; 620 rgbidx = RGB_4;
617 break; 621 break;
618 case 8: 622 case 8:
619 rgbidx = RGB_8; 623 rgbidx = RGB_8;
@@ -1382,6 +1386,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev)
1382 fbi->fb.monspecs = monspecs; 1386 fbi->fb.monspecs = monspecs;
1383 fbi->fb.pseudo_palette = (fbi + 1); 1387 fbi->fb.pseudo_palette = (fbi + 1);
1384 1388
1389 fbi->rgb[RGB_4] = &rgb_4;
1385 fbi->rgb[RGB_8] = &rgb_8; 1390 fbi->rgb[RGB_8] = &rgb_8;
1386 fbi->rgb[RGB_16] = &def_rgb_16; 1391 fbi->rgb[RGB_16] = &def_rgb_16;
1387 1392
diff --git a/drivers/video/sa1100fb.h b/drivers/video/sa1100fb.h
index 86831db9a042..1c3b459865d8 100644
--- a/drivers/video/sa1100fb.h
+++ b/drivers/video/sa1100fb.h
@@ -57,9 +57,10 @@ struct sa1100fb_lcd_reg {
57 unsigned long lccr3; 57 unsigned long lccr3;
58}; 58};
59 59
60#define RGB_8 (0) 60#define RGB_4 (0)
61#define RGB_16 (1) 61#define RGB_8 (1)
62#define NR_RGB 2 62#define RGB_16 (2)
63#define NR_RGB 3
63 64
64struct sa1100fb_info { 65struct sa1100fb_info {
65 struct fb_info fb; 66 struct fb_info fb;