Commit 0a453480 authored by Michal Januszewski's avatar Michal Januszewski Committed by Linus Torvalds

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: default avatarMichal Januszewski <spock@gentoo.org>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c26d7b29
...@@ -199,16 +199,20 @@ ...@@ -199,16 +199,20 @@
extern void (*sa1100fb_backlight_power)(int on); extern void (*sa1100fb_backlight_power)(int on);
extern void (*sa1100fb_lcd_power)(int on); extern void (*sa1100fb_lcd_power)(int on);
/* static struct sa1100fb_rgb rgb_4 = {
* IMHO this looks wrong. In 8BPP, length should be 8.
*/
static struct sa1100fb_rgb rgb_8 = {
.red = { .offset = 0, .length = 4, }, .red = { .offset = 0, .length = 4, },
.green = { .offset = 0, .length = 4, }, .green = { .offset = 0, .length = 4, },
.blue = { .offset = 0, .length = 4, }, .blue = { .offset = 0, .length = 4, },
.transp = { .offset = 0, .length = 0, }, .transp = { .offset = 0, .length = 0, },
}; };
static struct sa1100fb_rgb rgb_8 = {
.red = { .offset = 0, .length = 8, },
.green = { .offset = 0, .length = 8, },
.blue = { .offset = 0, .length = 8, },
.transp = { .offset = 0, .length = 0, },
};
static struct sa1100fb_rgb def_rgb_16 = { static struct sa1100fb_rgb def_rgb_16 = {
.red = { .offset = 11, .length = 5, }, .red = { .offset = 11, .length = 5, },
.green = { .offset = 5, .length = 6, }, .green = { .offset = 5, .length = 6, },
...@@ -613,7 +617,7 @@ sa1100fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -613,7 +617,7 @@ sa1100fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
DPRINTK("var->bits_per_pixel=%d\n", var->bits_per_pixel); DPRINTK("var->bits_per_pixel=%d\n", var->bits_per_pixel);
switch (var->bits_per_pixel) { switch (var->bits_per_pixel) {
case 4: case 4:
rgbidx = RGB_8; rgbidx = RGB_4;
break; break;
case 8: case 8:
rgbidx = RGB_8; rgbidx = RGB_8;
...@@ -1382,6 +1386,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev) ...@@ -1382,6 +1386,7 @@ static struct sa1100fb_info * __init sa1100fb_init_fbinfo(struct device *dev)
fbi->fb.monspecs = monspecs; fbi->fb.monspecs = monspecs;
fbi->fb.pseudo_palette = (fbi + 1); fbi->fb.pseudo_palette = (fbi + 1);
fbi->rgb[RGB_4] = &rgb_4;
fbi->rgb[RGB_8] = &rgb_8; fbi->rgb[RGB_8] = &rgb_8;
fbi->rgb[RGB_16] = &def_rgb_16; fbi->rgb[RGB_16] = &def_rgb_16;
......
...@@ -57,9 +57,10 @@ struct sa1100fb_lcd_reg { ...@@ -57,9 +57,10 @@ struct sa1100fb_lcd_reg {
unsigned long lccr3; unsigned long lccr3;
}; };
#define RGB_8 (0) #define RGB_4 (0)
#define RGB_16 (1) #define RGB_8 (1)
#define NR_RGB 2 #define RGB_16 (2)
#define NR_RGB 3
struct sa1100fb_info { struct sa1100fb_info {
struct fb_info fb; struct fb_info fb;
......
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