aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2008-12-16 05:44:09 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2008-12-16 09:43:50 -0500
commit80eee6bca4069c48247005aa07cb5e8e86042aa3 (patch)
treed94d2877a10ec75a28ce2f6367851eaa63c9cff2 /drivers/video
parent278892736e99330195c8ae5861bcd9d791bbf19e (diff)
i.MX Framebuffer: add TFT support
With TFTs we can do 5/6/5 instead of 4/4/4. Add a bitfield for this and use it with TFTs. Acked-by: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/imxfb.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 3d1db003f995..d58c68cd456e 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -116,16 +116,10 @@ struct imxfb_rgb {
116 struct fb_bitfield transp; 116 struct fb_bitfield transp;
117}; 117};
118 118
119#define RGB_16 (0)
120#define RGB_8 (1)
121#define NR_RGB 2
122
123struct imxfb_info { 119struct imxfb_info {
124 struct platform_device *pdev; 120 struct platform_device *pdev;
125 void __iomem *regs; 121 void __iomem *regs;
126 122
127 struct imxfb_rgb *rgb[NR_RGB];
128
129 u_int max_bpp; 123 u_int max_bpp;
130 u_int max_xres; 124 u_int max_xres;
131 u_int max_yres; 125 u_int max_yres;
@@ -165,7 +159,14 @@ struct imxfb_info {
165#define MIN_XRES 64 159#define MIN_XRES 64
166#define MIN_YRES 64 160#define MIN_YRES 64
167 161
168static struct imxfb_rgb def_rgb_16 = { 162static struct imxfb_rgb def_rgb_16_tft = {
163 .red = {.offset = 11, .length = 5,},
164 .green = {.offset = 5, .length = 6,},
165 .blue = {.offset = 0, .length = 5,},
166 .transp = {.offset = 0, .length = 0,},
167};
168
169static struct imxfb_rgb def_rgb_16_stn = {
169 .red = {.offset = 8, .length = 4,}, 170 .red = {.offset = 8, .length = 4,},
170 .green = {.offset = 4, .length = 4,}, 171 .green = {.offset = 4, .length = 4,},
171 .blue = {.offset = 0, .length = 4,}, 172 .blue = {.offset = 0, .length = 4,},
@@ -270,7 +271,7 @@ static int imxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
270static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 271static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
271{ 272{
272 struct imxfb_info *fbi = info->par; 273 struct imxfb_info *fbi = info->par;
273 int rgbidx; 274 struct imxfb_rgb *rgb;
274 275
275 if (var->xres < MIN_XRES) 276 if (var->xres < MIN_XRES)
276 var->xres = MIN_XRES; 277 var->xres = MIN_XRES;
@@ -286,23 +287,25 @@ static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
286 pr_debug("var->bits_per_pixel=%d\n", var->bits_per_pixel); 287 pr_debug("var->bits_per_pixel=%d\n", var->bits_per_pixel);
287 switch (var->bits_per_pixel) { 288 switch (var->bits_per_pixel) {
288 case 16: 289 case 16:
289 rgbidx = RGB_16; 290 default:
291 if (readl(fbi->regs + LCDC_PCR) & PCR_TFT)
292 rgb = &def_rgb_16_tft;
293 else
294 rgb = &def_rgb_16_stn;
290 break; 295 break;
291 case 8: 296 case 8:
292 rgbidx = RGB_8; 297 rgb = &def_rgb_8;
293 break; 298 break;
294 default:
295 rgbidx = RGB_16;
296 } 299 }
297 300
298 /* 301 /*
299 * Copy the RGB parameters for this display 302 * Copy the RGB parameters for this display
300 * from the machine specific parameters. 303 * from the machine specific parameters.
301 */ 304 */
302 var->red = fbi->rgb[rgbidx]->red; 305 var->red = rgb->red;
303 var->green = fbi->rgb[rgbidx]->green; 306 var->green = rgb->green;
304 var->blue = fbi->rgb[rgbidx]->blue; 307 var->blue = rgb->blue;
305 var->transp = fbi->rgb[rgbidx]->transp; 308 var->transp = rgb->transp;
306 309
307 pr_debug("RGBT length = %d:%d:%d:%d\n", 310 pr_debug("RGBT length = %d:%d:%d:%d\n",
308 var->red.length, var->green.length, var->blue.length, 311 var->red.length, var->green.length, var->blue.length,
@@ -545,9 +548,6 @@ static int __init imxfb_init_fbinfo(struct platform_device *pdev)
545 info->flags = FBINFO_FLAG_DEFAULT | 548 info->flags = FBINFO_FLAG_DEFAULT |
546 FBINFO_READS_FAST; 549 FBINFO_READS_FAST;
547 550
548 fbi->rgb[RGB_16] = &def_rgb_16;
549 fbi->rgb[RGB_8] = &def_rgb_8;
550
551 fbi->max_xres = pdata->xres; 551 fbi->max_xres = pdata->xres;
552 info->var.xres = pdata->xres; 552 info->var.xres = pdata->xres;
553 info->var.xres_virtual = pdata->xres; 553 info->var.xres_virtual = pdata->xres;