* [PATCH] atmel_lcdfb: wiring BGR to RGB color mode
@ 2008-03-10 14:26 Nicolas Ferre
2008-03-10 16:27 ` [Linux-fbdev-devel] [PATCH] atmel_lcdfb: wiring BGR to RGB colormode Nicolas Ferre
2008-03-13 15:35 ` [PATCH] atmel_lcdfb: wiring BGR to RGB color mode Haavard Skinnemoen
0 siblings, 2 replies; 3+ messages in thread
From: Nicolas Ferre @ 2008-03-10 14:26 UTC (permalink / raw)
To: linux-fbdev-devel, Linux Kernel list, Antonino A. Daplas
Cc: ARM Linux Mailing List, Haavard Skinnemoen, Sedji GAOUAOU,
Patrice VILCHEZ, Andrew Victor
Adds different wiring mode for the LCD screen.
The legacy atmel LCDC IP uses a non standard color mode,
"BGR-555.1" instead "RGB-565". The major part of graphic stacks
for embedded systems uses only "RGB-565". It is possible to swap
LCD IOs instead of doing this bit swapping by software (See
application note AT91SAM9 LCD Controller
http://www.atmel.com/dyn/resources/prod_documents/doc6300.pdf)
This wire swapping is done on the at91sam9rl-ek board (board code
using this patch will come later).
---
drivers/video/atmel_lcdfb.c | 27 ++++++++++++++++++++++-----
include/video/atmel_lcdc.h | 10 ++++++++++
2 files changed, 32 insertions(+), 5 deletions(-)
--- linux-2.6.x-rc.orig/drivers/video/atmel_lcdfb.c
+++ linux-2.6.x-rc/drivers/video/atmel_lcdfb.c
@@ -338,19 +338,35 @@ static int atmel_lcdfb_check_var(struct
break;
case 15:
case 16:
- var->red.offset = 0;
+ if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
+ /* RGB:565 mode */
+ var->red.offset = 11;
+ var->blue.offset = 0;
+ var->green.length = 6;
+ } else {
+ /* BGR:555 mode */
+ var->red.offset = 0;
+ var->blue.offset = 10;
+ var->green.length = 5;
+ }
var->green.offset = 5;
- var->blue.offset = 10;
- var->red.length = var->green.length = var->blue.length = 5;
+ var->red.length = var->blue.length = 5;
break;
case 32:
var->transp.offset = 24;
var->transp.length = 8;
/* fall through */
case 24:
- var->red.offset = 0;
+ if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
+ /* RGB:888 mode */
+ var->red.offset = 16;
+ var->blue.offset = 0;
+ } else {
+ /* BGR:888 mode */
+ var->red.offset = 0;
+ var->blue.offset = 16;
+ }
var->green.offset = 8;
- var->blue.offset = 16;
var->red.length = var->green.length = var->blue.length = 8;
break;
default:
@@ -697,6 +713,7 @@ static int __init atmel_lcdfb_probe(stru
sinfo->atmel_lcdfb_power_control = pdata_sinfo->atmel_lcdfb_power_control;
sinfo->guard_time = pdata_sinfo->guard_time;
sinfo->lcdcon_is_backlight = pdata_sinfo->lcdcon_is_backlight;
+ sinfo->lcd_wiring_mode = pdata_sinfo->lcd_wiring_mode;
} else {
dev_err(dev, "cannot get default configuration\n");
goto free_info;
--- linux-2.6.x-rc.orig/include/video/atmel_lcdc.h
+++ linux-2.6.x-rc/include/video/atmel_lcdc.h
@@ -22,6 +22,15 @@
#ifndef __ATMEL_LCDC_H__
#define __ATMEL_LCDC_H__
+
+/* Way LCD wires are connected to the chip:
+ * Some Atmel chips use BGR color mode (instead of standard RGB)
+ * A swapped wiring onboard can bring to RGB mode.
+ */
+#define ATMEL_LCDC_WIRING_BGR 0
+#define ATMEL_LCDC_WIRING_RGB 1
+
+
/* LCD Controller info data structure, stored in device platform_data */
struct atmel_lcdfb_info {
spinlock_t lock;
@@ -42,6 +51,7 @@ struct atmel_lcdfb_info {
u8 saved_lcdcon;
u8 default_bpp;
+ u8 lcd_wiring_mode;
unsigned int default_lcdcon2;
unsigned int default_dmacon;
void (*atmel_lcdfb_power_control)(int on);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Linux-fbdev-devel] [PATCH] atmel_lcdfb: wiring BGR to RGB colormode
2008-03-10 14:26 [PATCH] atmel_lcdfb: wiring BGR to RGB color mode Nicolas Ferre
@ 2008-03-10 16:27 ` Nicolas Ferre
2008-03-13 15:35 ` [PATCH] atmel_lcdfb: wiring BGR to RGB color mode Haavard Skinnemoen
1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Ferre @ 2008-03-10 16:27 UTC (permalink / raw)
To: linux-fbdev-devel, Linux Kernel list
Cc: Antonino A. Daplas, Sedji GAOUAOU, Patrice VILCHEZ,
ARM Linux Mailing List, Andrew Victor
Nicolas Ferre :
> Adds different wiring mode for the LCD screen.
>
> The legacy atmel LCDC IP uses a non standard color mode,
> "BGR-555.1" instead "RGB-565". The major part of graphic stacks
> for embedded systems uses only "RGB-565". It is possible to swap
> LCD IOs instead of doing this bit swapping by software (See
> application note AT91SAM9 LCD Controller
> http://www.atmel.com/dyn/resources/prod_documents/doc6300.pdf)
>
> This wire swapping is done on the at91sam9rl-ek board (board code
> using this patch will come later).
Forgotten line :
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> drivers/video/atmel_lcdfb.c | 27 ++++++++++++++++++++++-----
> include/video/atmel_lcdc.h | 10 ++++++++++
> 2 files changed, 32 insertions(+), 5 deletions(-)
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] atmel_lcdfb: wiring BGR to RGB color mode
2008-03-10 14:26 [PATCH] atmel_lcdfb: wiring BGR to RGB color mode Nicolas Ferre
2008-03-10 16:27 ` [Linux-fbdev-devel] [PATCH] atmel_lcdfb: wiring BGR to RGB colormode Nicolas Ferre
@ 2008-03-13 15:35 ` Haavard Skinnemoen
1 sibling, 0 replies; 3+ messages in thread
From: Haavard Skinnemoen @ 2008-03-13 15:35 UTC (permalink / raw)
To: Nicolas Ferre
Cc: linux-fbdev-devel, Linux Kernel list, Antonino A. Daplas,
ARM Linux Mailing List, Haavard Skinnemoen, Sedji GAOUAOU,
Patrice VILCHEZ, Andrew Victor
On Mon, 10 Mar 2008 15:26:18 +0100
Nicolas Ferre <nicolas.ferre@atmel.com> wrote:
> The legacy atmel LCDC IP uses a non standard color mode,
> "BGR-555.1" instead "RGB-565". The major part of graphic stacks
> for embedded systems uses only "RGB-565". It is possible to swap
> LCD IOs instead of doing this bit swapping by software (See
> application note AT91SAM9 LCD Controller
> http://www.atmel.com/dyn/resources/prod_documents/doc6300.pdf)
> - var->red.offset = 0;
> + if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
> + /* RGB:888 mode */
> + var->red.offset = 16;
> + var->blue.offset = 0;
> + } else {
> + /* BGR:888 mode */
> + var->red.offset = 0;
> + var->blue.offset = 16;
> + }
Does RGB:565 always imply RGB:888 and vice versa?
If not, I think it would be better with separate flags for the possible
wirings:
* 18-bit BGR-555.1 / 24-bit BGR-888
* 16-bit RGB-565
* 24-bit RGB-888
Or maybe I misunderstand something?
Haavard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-13 15:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-10 14:26 [PATCH] atmel_lcdfb: wiring BGR to RGB color mode Nicolas Ferre
2008-03-10 16:27 ` [Linux-fbdev-devel] [PATCH] atmel_lcdfb: wiring BGR to RGB colormode Nicolas Ferre
2008-03-13 15:35 ` [PATCH] atmel_lcdfb: wiring BGR to RGB color mode Haavard Skinnemoen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.