Procházet zdrojové kódy

Merge at91 lcdfb bug fixes into fixes

These are part of a longer series that has been submitted some time
ago for the frame buffer tree, but it was never accepted there.
The first two of the five patches are bug fixes, so let's merge
this through arm-soc to get a working 3.9 kernel for at91.

* commit '67cf9c0a':
  ARM: at91: fix LCD-wiring mode
  atmel_lcdfb: fix 16-bpp modes on older SOCs

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Arnd Bergmann před 12 roky
rodič
revize
083f1717d6
2 změnil soubory, kde provedl 16 přidání a 8 odebrání
  1. 15 7
      drivers/video/atmel_lcdfb.c
  2. 1 1
      include/video/atmel_lcdc.h

+ 15 - 7
drivers/video/atmel_lcdfb.c

@@ -422,17 +422,22 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
 			= var->bits_per_pixel;
 			= var->bits_per_pixel;
 		break;
 		break;
 	case 16:
 	case 16:
+		/* Older SOCs use IBGR:555 rather than BGR:565. */
+		if (sinfo->have_intensity_bit)
+			var->green.length = 5;
+		else
+			var->green.length = 6;
+
 		if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
 		if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
-			/* RGB:565 mode */
-			var->red.offset = 11;
+			/* RGB:5X5 mode */
+			var->red.offset = var->green.length + 5;
 			var->blue.offset = 0;
 			var->blue.offset = 0;
 		} else {
 		} else {
-			/* BGR:565 mode */
+			/* BGR:5X5 mode */
 			var->red.offset = 0;
 			var->red.offset = 0;
-			var->blue.offset = 11;
+			var->blue.offset = var->green.length + 5;
 		}
 		}
 		var->green.offset = 5;
 		var->green.offset = 5;
-		var->green.length = 6;
 		var->red.length = var->blue.length = 5;
 		var->red.length = var->blue.length = 5;
 		break;
 		break;
 	case 32:
 	case 32:
@@ -679,8 +684,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red,
 
 
 	case FB_VISUAL_PSEUDOCOLOR:
 	case FB_VISUAL_PSEUDOCOLOR:
 		if (regno < 256) {
 		if (regno < 256) {
-			if (cpu_is_at91sam9261() || cpu_is_at91sam9263()
-			    || cpu_is_at91sam9rl()) {
+			if (sinfo->have_intensity_bit) {
 				/* old style I+BGR:555 */
 				/* old style I+BGR:555 */
 				val  = ((red   >> 11) & 0x001f);
 				val  = ((red   >> 11) & 0x001f);
 				val |= ((green >>  6) & 0x03e0);
 				val |= ((green >>  6) & 0x03e0);
@@ -870,6 +874,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
 	}
 	}
 	sinfo->info = info;
 	sinfo->info = info;
 	sinfo->pdev = pdev;
 	sinfo->pdev = pdev;
+	if (cpu_is_at91sam9261() || cpu_is_at91sam9263() ||
+							cpu_is_at91sam9rl()) {
+		sinfo->have_intensity_bit = true;
+	}
 
 
 	strcpy(info->fix.id, sinfo->pdev->name);
 	strcpy(info->fix.id, sinfo->pdev->name);
 	info->flags = ATMEL_LCDFB_FBINFO_DEFAULT;
 	info->flags = ATMEL_LCDFB_FBINFO_DEFAULT;

+ 1 - 1
include/video/atmel_lcdc.h

@@ -30,7 +30,6 @@
  */
  */
 #define ATMEL_LCDC_WIRING_BGR	0
 #define ATMEL_LCDC_WIRING_BGR	0
 #define ATMEL_LCDC_WIRING_RGB	1
 #define ATMEL_LCDC_WIRING_RGB	1
-#define ATMEL_LCDC_WIRING_RGB555	2
 
 
 
 
  /* LCD Controller info data structure, stored in device platform_data */
  /* LCD Controller info data structure, stored in device platform_data */
@@ -62,6 +61,7 @@ struct atmel_lcdfb_info {
 	void (*atmel_lcdfb_power_control)(int on);
 	void (*atmel_lcdfb_power_control)(int on);
 	struct fb_monspecs	*default_monspecs;
 	struct fb_monspecs	*default_monspecs;
 	u32			pseudo_palette[16];
 	u32			pseudo_palette[16];
+	bool			have_intensity_bit;
 };
 };
 
 
 #define ATMEL_LCDC_DMABADDR1	0x00
 #define ATMEL_LCDC_DMABADDR1	0x00