aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/imxfb.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-01-26 11:31:02 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2009-03-13 05:34:09 -0400
commit1512222b105beaff7b7fe11aa4220bcd0088e421 (patch)
tree43b8d229f9b89a70e7174111b3978dc26726fbcf /drivers/video/imxfb.c
parent9db973a59b73fb5baf69f8b5d005daccec6d997e (diff)
imxfb: add 18 bit support
v2: As pointed out by Hans J. Koch we have to claim we can do 24bit to make software like X work. We are lucky on i.MX that 18bit support has the necessary gaps in the fields to do so. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/video/imxfb.c')
-rw-r--r--drivers/video/imxfb.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 629d66f32300..5c61286d7ff5 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -14,7 +14,6 @@
14 * linux-arm-kernel@lists.arm.linux.org.uk 14 * linux-arm-kernel@lists.arm.linux.org.uk
15 */ 15 */
16 16
17
18#include <linux/module.h> 17#include <linux/module.h>
19#include <linux/kernel.h> 18#include <linux/kernel.h>
20#include <linux/errno.h> 19#include <linux/errno.h>
@@ -159,6 +158,17 @@ struct imxfb_info {
159#define MIN_XRES 64 158#define MIN_XRES 64
160#define MIN_YRES 64 159#define MIN_YRES 64
161 160
161/* Actually this really is 18bit support, the lowest 2 bits of each colour
162 * are unused in hardware. We claim to have 24bit support to make software
163 * like X work, which does not support 18bit.
164 */
165static struct imxfb_rgb def_rgb_18 = {
166 .red = {.offset = 16, .length = 8,},
167 .green = {.offset = 8, .length = 8,},
168 .blue = {.offset = 0, .length = 8,},
169 .transp = {.offset = 0, .length = 0,},
170};
171
162static struct imxfb_rgb def_rgb_16_tft = { 172static struct imxfb_rgb def_rgb_16_tft = {
163 .red = {.offset = 11, .length = 5,}, 173 .red = {.offset = 11, .length = 5,},
164 .green = {.offset = 5, .length = 6,}, 174 .green = {.offset = 5, .length = 6,},
@@ -286,6 +296,9 @@ static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
286 296
287 pr_debug("var->bits_per_pixel=%d\n", var->bits_per_pixel); 297 pr_debug("var->bits_per_pixel=%d\n", var->bits_per_pixel);
288 switch (var->bits_per_pixel) { 298 switch (var->bits_per_pixel) {
299 case 32:
300 rgb = &def_rgb_18;
301 break;
289 case 16: 302 case 16:
290 default: 303 default:
291 if (readl(fbi->regs + LCDC_PCR) & PCR_TFT) 304 if (readl(fbi->regs + LCDC_PCR) & PCR_TFT)
@@ -327,9 +340,7 @@ static int imxfb_set_par(struct fb_info *info)
327 struct imxfb_info *fbi = info->par; 340 struct imxfb_info *fbi = info->par;
328 struct fb_var_screeninfo *var = &info->var; 341 struct fb_var_screeninfo *var = &info->var;
329 342
330 pr_debug("set_par\n"); 343 if (var->bits_per_pixel == 16 || var->bits_per_pixel == 32)
331
332 if (var->bits_per_pixel == 16)
333 info->fix.visual = FB_VISUAL_TRUECOLOR; 344 info->fix.visual = FB_VISUAL_TRUECOLOR;
334 else if (!fbi->cmap_static) 345 else if (!fbi->cmap_static)
335 info->fix.visual = FB_VISUAL_PSEUDOCOLOR; 346 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;