diff options
-rw-r--r-- | drivers/video/atmel_lcdfb.c | 27 | ||||
-rw-r--r-- | include/video/atmel_lcdc.h | 10 |
2 files changed, 32 insertions, 5 deletions
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 6fcf76c12910..5a31a7a40cd4 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -338,19 +338,35 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var, | |||
338 | break; | 338 | break; |
339 | case 15: | 339 | case 15: |
340 | case 16: | 340 | case 16: |
341 | var->red.offset = 0; | 341 | if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { |
342 | /* RGB:565 mode */ | ||
343 | var->red.offset = 11; | ||
344 | var->blue.offset = 0; | ||
345 | var->green.length = 6; | ||
346 | } else { | ||
347 | /* BGR:555 mode */ | ||
348 | var->red.offset = 0; | ||
349 | var->blue.offset = 10; | ||
350 | var->green.length = 5; | ||
351 | } | ||
342 | var->green.offset = 5; | 352 | var->green.offset = 5; |
343 | var->blue.offset = 10; | 353 | var->red.length = var->blue.length = 5; |
344 | var->red.length = var->green.length = var->blue.length = 5; | ||
345 | break; | 354 | break; |
346 | case 32: | 355 | case 32: |
347 | var->transp.offset = 24; | 356 | var->transp.offset = 24; |
348 | var->transp.length = 8; | 357 | var->transp.length = 8; |
349 | /* fall through */ | 358 | /* fall through */ |
350 | case 24: | 359 | case 24: |
351 | var->red.offset = 0; | 360 | if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { |
361 | /* RGB:888 mode */ | ||
362 | var->red.offset = 16; | ||
363 | var->blue.offset = 0; | ||
364 | } else { | ||
365 | /* BGR:888 mode */ | ||
366 | var->red.offset = 0; | ||
367 | var->blue.offset = 16; | ||
368 | } | ||
352 | var->green.offset = 8; | 369 | var->green.offset = 8; |
353 | var->blue.offset = 16; | ||
354 | var->red.length = var->green.length = var->blue.length = 8; | 370 | var->red.length = var->green.length = var->blue.length = 8; |
355 | break; | 371 | break; |
356 | default: | 372 | default: |
@@ -697,6 +713,7 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) | |||
697 | sinfo->atmel_lcdfb_power_control = pdata_sinfo->atmel_lcdfb_power_control; | 713 | sinfo->atmel_lcdfb_power_control = pdata_sinfo->atmel_lcdfb_power_control; |
698 | sinfo->guard_time = pdata_sinfo->guard_time; | 714 | sinfo->guard_time = pdata_sinfo->guard_time; |
699 | sinfo->lcdcon_is_backlight = pdata_sinfo->lcdcon_is_backlight; | 715 | sinfo->lcdcon_is_backlight = pdata_sinfo->lcdcon_is_backlight; |
716 | sinfo->lcd_wiring_mode = pdata_sinfo->lcd_wiring_mode; | ||
700 | } else { | 717 | } else { |
701 | dev_err(dev, "cannot get default configuration\n"); | 718 | dev_err(dev, "cannot get default configuration\n"); |
702 | goto free_info; | 719 | goto free_info; |
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h index 2fd9fad922e5..ed64862c4e18 100644 --- a/include/video/atmel_lcdc.h +++ b/include/video/atmel_lcdc.h | |||
@@ -22,6 +22,15 @@ | |||
22 | #ifndef __ATMEL_LCDC_H__ | 22 | #ifndef __ATMEL_LCDC_H__ |
23 | #define __ATMEL_LCDC_H__ | 23 | #define __ATMEL_LCDC_H__ |
24 | 24 | ||
25 | |||
26 | /* Way LCD wires are connected to the chip: | ||
27 | * Some Atmel chips use BGR color mode (instead of standard RGB) | ||
28 | * A swapped wiring onboard can bring to RGB mode. | ||
29 | */ | ||
30 | #define ATMEL_LCDC_WIRING_BGR 0 | ||
31 | #define ATMEL_LCDC_WIRING_RGB 1 | ||
32 | |||
33 | |||
25 | /* LCD Controller info data structure, stored in device platform_data */ | 34 | /* LCD Controller info data structure, stored in device platform_data */ |
26 | struct atmel_lcdfb_info { | 35 | struct atmel_lcdfb_info { |
27 | spinlock_t lock; | 36 | spinlock_t lock; |
@@ -42,6 +51,7 @@ struct atmel_lcdfb_info { | |||
42 | u8 saved_lcdcon; | 51 | u8 saved_lcdcon; |
43 | 52 | ||
44 | u8 default_bpp; | 53 | u8 default_bpp; |
54 | u8 lcd_wiring_mode; | ||
45 | unsigned int default_lcdcon2; | 55 | unsigned int default_lcdcon2; |
46 | unsigned int default_dmacon; | 56 | unsigned int default_dmacon; |
47 | void (*atmel_lcdfb_power_control)(int on); | 57 | void (*atmel_lcdfb_power_control)(int on); |