diff options
author | Peter Korsgaard <jacmet@sunsite.dk> | 2011-10-13 10:45:52 -0400 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2011-11-11 11:52:42 -0500 |
commit | 5d67b89ce88f2db60573de859649b1b5a8c830d6 (patch) | |
tree | 52d52dcbc01559947319c0288aa0a8580f2c9f90 /drivers/video/atmel_lcdfb.c | |
parent | acfdc2e1bdb4b148e7546fe8948d8f75bd2f9377 (diff) |
atmel_lcdfb: support new-style palette format
The newer Atmel SoCs use normal 16bit 565 BGR/RGB for the palette data,
rather than the special intensity + 555 format.
Fill out palette data correctly on these devices, and at the same time
respect the RGB/BGR wiring mode.
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/atmel_lcdfb.c')
-rw-r--r-- | drivers/video/atmel_lcdfb.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 8bfee6aecc8b..2226aca44c57 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -684,14 +684,30 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red, | |||
684 | 684 | ||
685 | case FB_VISUAL_PSEUDOCOLOR: | 685 | case FB_VISUAL_PSEUDOCOLOR: |
686 | if (regno < 256) { | 686 | if (regno < 256) { |
687 | val = ((red >> 11) & 0x001f); | 687 | if (cpu_is_at91sam9261() || cpu_is_at91sam9263() |
688 | val |= ((green >> 6) & 0x03e0); | 688 | || cpu_is_at91sam9rl()) { |
689 | val |= ((blue >> 1) & 0x7c00); | 689 | /* old style I+BGR:555 */ |
690 | 690 | val = ((red >> 11) & 0x001f); | |
691 | /* | 691 | val |= ((green >> 6) & 0x03e0); |
692 | * TODO: intensity bit. Maybe something like | 692 | val |= ((blue >> 1) & 0x7c00); |
693 | * ~(red[10] ^ green[10] ^ blue[10]) & 1 | 693 | |
694 | */ | 694 | /* |
695 | * TODO: intensity bit. Maybe something like | ||
696 | * ~(red[10] ^ green[10] ^ blue[10]) & 1 | ||
697 | */ | ||
698 | } else { | ||
699 | /* new style BGR:565 / RGB:565 */ | ||
700 | if (sinfo->lcd_wiring_mode == | ||
701 | ATMEL_LCDC_WIRING_RGB) { | ||
702 | val = ((blue >> 11) & 0x001f); | ||
703 | val |= ((red >> 0) & 0xf800); | ||
704 | } else { | ||
705 | val = ((red >> 11) & 0x001f); | ||
706 | val |= ((blue >> 0) & 0xf800); | ||
707 | } | ||
708 | |||
709 | val |= ((green >> 5) & 0x07e0); | ||
710 | } | ||
695 | 711 | ||
696 | lcdc_writel(sinfo, ATMEL_LCDC_LUT(regno), val); | 712 | lcdc_writel(sinfo, ATMEL_LCDC_LUT(regno), val); |
697 | ret = 0; | 713 | ret = 0; |