diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-02-05 08:35:11 -0500 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2013-03-13 05:54:58 -0400 |
commit | a79eac7165ed62114e6ca197195aa5060a54f137 (patch) | |
tree | 314301a4d238668ccd3713dcc9b06b81d3afa0f6 /drivers/video/atmel_lcdfb.c | |
parent | f6161aa153581da4a3867a2d1a7caf4be19b6ec9 (diff) |
atmel_lcdfb: fix 16-bpp modes on older SOCs
Fix regression introduced by commit 787f9fd23283 ("atmel_lcdfb: support
16bit BGR:565 mode, remove unsupported 15bit modes") which broke 16-bpp
modes for older SOCs which use IBGR:555 (msb is intensity) rather
than BGR:565.
Use SOC-type to determine the pixel layout.
Tested on at91sam9263 and at91sam9g45.
Cc: <stable@vger.kernel.org>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'drivers/video/atmel_lcdfb.c')
-rw-r--r-- | drivers/video/atmel_lcdfb.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 12cf5f31ee8f..025428e04c33 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -422,17 +422,22 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var, | |||
422 | = var->bits_per_pixel; | 422 | = var->bits_per_pixel; |
423 | break; | 423 | break; |
424 | case 16: | 424 | case 16: |
425 | /* Older SOCs use IBGR:555 rather than BGR:565. */ | ||
426 | if (sinfo->have_intensity_bit) | ||
427 | var->green.length = 5; | ||
428 | else | ||
429 | var->green.length = 6; | ||
430 | |||
425 | if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { | 431 | if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { |
426 | /* RGB:565 mode */ | 432 | /* RGB:5X5 mode */ |
427 | var->red.offset = 11; | 433 | var->red.offset = var->green.length + 5; |
428 | var->blue.offset = 0; | 434 | var->blue.offset = 0; |
429 | } else { | 435 | } else { |
430 | /* BGR:565 mode */ | 436 | /* BGR:5X5 mode */ |
431 | var->red.offset = 0; | 437 | var->red.offset = 0; |
432 | var->blue.offset = 11; | 438 | var->blue.offset = var->green.length + 5; |
433 | } | 439 | } |
434 | var->green.offset = 5; | 440 | var->green.offset = 5; |
435 | var->green.length = 6; | ||
436 | var->red.length = var->blue.length = 5; | 441 | var->red.length = var->blue.length = 5; |
437 | break; | 442 | break; |
438 | case 32: | 443 | case 32: |
@@ -679,8 +684,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red, | |||
679 | 684 | ||
680 | case FB_VISUAL_PSEUDOCOLOR: | 685 | case FB_VISUAL_PSEUDOCOLOR: |
681 | if (regno < 256) { | 686 | if (regno < 256) { |
682 | if (cpu_is_at91sam9261() || cpu_is_at91sam9263() | 687 | if (sinfo->have_intensity_bit) { |
683 | || cpu_is_at91sam9rl()) { | ||
684 | /* old style I+BGR:555 */ | 688 | /* old style I+BGR:555 */ |
685 | val = ((red >> 11) & 0x001f); | 689 | val = ((red >> 11) & 0x001f); |
686 | val |= ((green >> 6) & 0x03e0); | 690 | val |= ((green >> 6) & 0x03e0); |
@@ -870,6 +874,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
870 | } | 874 | } |
871 | sinfo->info = info; | 875 | sinfo->info = info; |
872 | sinfo->pdev = pdev; | 876 | sinfo->pdev = pdev; |
877 | if (cpu_is_at91sam9261() || cpu_is_at91sam9263() || | ||
878 | cpu_is_at91sam9rl()) { | ||
879 | sinfo->have_intensity_bit = true; | ||
880 | } | ||
873 | 881 | ||
874 | strcpy(info->fix.id, sinfo->pdev->name); | 882 | strcpy(info->fix.id, sinfo->pdev->name); |
875 | info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; | 883 | info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; |