Commit c43e6f02 authored by Russell King's avatar Russell King Committed by Russell King

[ARM] amba-clcd: Allow RGB555 and RGB565 with 16bpp

Some folk want to use RGB555 rather tahn RGB565 with amba-clcd.
Allow amba-clcd to accept either pixel format.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 20a2c88f
...@@ -116,9 +116,10 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var) ...@@ -116,9 +116,10 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var)
int ret = 0; int ret = 0;
memset(&var->transp, 0, sizeof(var->transp)); memset(&var->transp, 0, sizeof(var->transp));
memset(&var->red, 0, sizeof(var->red));
memset(&var->green, 0, sizeof(var->green)); var->red.msb_right = 0;
memset(&var->blue, 0, sizeof(var->blue)); var->green.msb_right = 0;
var->blue.msb_right = 0;
switch (var->bits_per_pixel) { switch (var->bits_per_pixel) {
case 1: case 1:
...@@ -134,38 +135,41 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var) ...@@ -134,38 +135,41 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var)
break; break;
case 16: case 16:
var->red.length = 5; var->red.length = 5;
var->green.length = 6;
var->blue.length = 5; var->blue.length = 5;
if (fb->panel->cntl & CNTL_BGR) { /*
var->red.offset = 11; * Green length can be 5 or 6 depending whether
var->green.offset = 5; * we're operating in RGB555 or RGB565 mode.
var->blue.offset = 0; */
} else { if (var->green.length != 5 && var->green.length != 6)
var->red.offset = 0; var->green.length = 6;
var->green.offset = 5;
var->blue.offset = 11;
}
break; break;
case 32: case 32:
if (fb->panel->cntl & CNTL_LCDTFT) { if (fb->panel->cntl & CNTL_LCDTFT) {
var->red.length = 8; var->red.length = 8;
var->green.length = 8; var->green.length = 8;
var->blue.length = 8; var->blue.length = 8;
break;
}
default:
ret = -EINVAL;
break;
}
/*
* >= 16bpp displays have separate colour component bitfields
* encoded in the pixel data. Calculate their position from
* the bitfield length defined above.
*/
if (ret == 0 && var->bits_per_pixel >= 16) {
if (fb->panel->cntl & CNTL_BGR) { if (fb->panel->cntl & CNTL_BGR) {
var->red.offset = 16;
var->green.offset = 8;
var->blue.offset = 0; var->blue.offset = 0;
var->green.offset = var->blue.offset + var->blue.length;
var->red.offset = var->green.offset + var->green.length;
} else { } else {
var->red.offset = 0; var->red.offset = 0;
var->green.offset = 8; var->green.offset = var->red.offset + var->red.length;
var->blue.offset = 16; var->blue.offset = var->green.offset + var->green.length;
} }
break;
}
default:
ret = -EINVAL;
break;
} }
return ret; return ret;
......
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