aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2006-01-26 09:12:06 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-01-26 09:12:06 -0500
commitc43e6f027de1092678980e9e2494a6f9b051b93f (patch)
treeb98b6313f02e125a3e46981f24e7774b6b2bf4c9 /drivers/video
parent20a2c88f5039b8b17f0aa3fbc2ac3e9257961123 (diff)
[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: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/amba-clcd.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c
index b2187175d03f..6761b68c35e9 100644
--- a/drivers/video/amba-clcd.c
+++ b/drivers/video/amba-clcd.c
@@ -116,9 +116,10 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var)
116 int ret = 0; 116 int ret = 0;
117 117
118 memset(&var->transp, 0, sizeof(var->transp)); 118 memset(&var->transp, 0, sizeof(var->transp));
119 memset(&var->red, 0, sizeof(var->red)); 119
120 memset(&var->green, 0, sizeof(var->green)); 120 var->red.msb_right = 0;
121 memset(&var->blue, 0, sizeof(var->blue)); 121 var->green.msb_right = 0;
122 var->blue.msb_right = 0;
122 123
123 switch (var->bits_per_pixel) { 124 switch (var->bits_per_pixel) {
124 case 1: 125 case 1:
@@ -133,34 +134,20 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var)
133 var->blue.offset = 0; 134 var->blue.offset = 0;
134 break; 135 break;
135 case 16: 136 case 16:
136 var->red.length = 5; 137 var->red.length = 5;
137 var->green.length = 6; 138 var->blue.length = 5;
138 var->blue.length = 5; 139 /*
139 if (fb->panel->cntl & CNTL_BGR) { 140 * Green length can be 5 or 6 depending whether
140 var->red.offset = 11; 141 * we're operating in RGB555 or RGB565 mode.
141 var->green.offset = 5; 142 */
142 var->blue.offset = 0; 143 if (var->green.length != 5 && var->green.length != 6)
143 } else { 144 var->green.length = 6;
144 var->red.offset = 0;
145 var->green.offset = 5;
146 var->blue.offset = 11;
147 }
148 break; 145 break;
149 case 32: 146 case 32:
150 if (fb->panel->cntl & CNTL_LCDTFT) { 147 if (fb->panel->cntl & CNTL_LCDTFT) {
151 var->red.length = 8; 148 var->red.length = 8;
152 var->green.length = 8; 149 var->green.length = 8;
153 var->blue.length = 8; 150 var->blue.length = 8;
154
155 if (fb->panel->cntl & CNTL_BGR) {
156 var->red.offset = 16;
157 var->green.offset = 8;
158 var->blue.offset = 0;
159 } else {
160 var->red.offset = 0;
161 var->green.offset = 8;
162 var->blue.offset = 16;
163 }
164 break; 151 break;
165 } 152 }
166 default: 153 default:
@@ -168,6 +155,23 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var)
168 break; 155 break;
169 } 156 }
170 157
158 /*
159 * >= 16bpp displays have separate colour component bitfields
160 * encoded in the pixel data. Calculate their position from
161 * the bitfield length defined above.
162 */
163 if (ret == 0 && var->bits_per_pixel >= 16) {
164 if (fb->panel->cntl & CNTL_BGR) {
165 var->blue.offset = 0;
166 var->green.offset = var->blue.offset + var->blue.length;
167 var->red.offset = var->green.offset + var->green.length;
168 } else {
169 var->red.offset = 0;
170 var->green.offset = var->red.offset + var->red.length;
171 var->blue.offset = var->green.offset + var->green.length;
172 }
173 }
174
171 return ret; 175 return ret;
172} 176}
173 177