[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-arm-kernel
Subject:    pxafb 18bpp support
From:       Palo Revak <palo () bielyvlk ! sk>
Date:       2008-01-12 22:54:18
Message-ID: 200801122354.19273.palo () bielyvlk ! sk
[Download RAW message or body]

Hi, this patch add support for TFT displays connected through 18 bits to 
PXA270.
Regards Palo.

["linux-2.6.24-rc7-pxafb-18bpp.patch" (text/x-diff)]

diff -Nur linux-2.6.24-rc7/Documentation/fb/pxafb.txt \
                linux-2.6.24-rc7-pxafb-18bpp/Documentation/fb/pxafb.txt
--- linux-2.6.24-rc7/Documentation/fb/pxafb.txt	2008-01-06 22:45:38.000000000 +0100
+++ linux-2.6.24-rc7-pxafb-18bpp/Documentation/fb/pxafb.txt	2008-01-12 \
23:13:17.000000000 +0100 @@ -13,7 +13,10 @@
 	XRES == LCCR1_PPL + 1
 	YRES == LLCR2_LPP + 1
 		The resolution of the display in pixels
-	BPP == The bit depth. Valid values are 1, 2, 4, 8 and 16.
+	BPP == The bit depth. Valid values are 1, 2, 4, 8, 16, 24 and 32
+		24 and 32 are 18bpp for active (TFT) display,
+		where 24 is packed and 32 is unpacked pixel format.
+		(for correct view in 18bpp, set LCCR3_PDFOR_3)
 
 pixclock:PIXCLOCK
 	Pixel clock in picoseconds
diff -Nur linux-2.6.24-rc7/drivers/video/pxafb.c \
                linux-2.6.24-rc7-pxafb-18bpp/drivers/video/pxafb.c
--- linux-2.6.24-rc7/drivers/video/pxafb.c	2008-01-06 22:45:38.000000000 +0100
+++ linux-2.6.24-rc7-pxafb-18bpp/drivers/video/pxafb.c	2008-01-12 23:23:21.000000000 \
+0100 @@ -209,6 +209,8 @@
         case 4:  ret = LCCR3_4BPP; break;
         case 8:  ret = LCCR3_8BPP; break;
         case 16: ret = LCCR3_16BPP; break;
+        case 24: ret = LCCR3_24BPP; break;
+        case 32: ret = LCCR3_32BPP; break;
         }
         return ret;
 }
@@ -325,6 +327,11 @@
 		var->green.offset = 5;  var->green.length = 6;
 		var->blue.offset  = 0;  var->blue.length  = 5;
 		var->transp.offset = var->transp.length = 0;
+	} else if (var->bits_per_pixel > 16) {
+		var->transp.offset = var->transp.length = 0;
+		var->red.offset = 12; var->red.length=6;
+		var->green.offset = 6; var->green.length=6;
+		var->blue.offset = 0; var->blue.length=6;
 	} else {
 		var->red.offset = var->green.offset = var->blue.offset = var->transp.offset = 0;
 		var->red.length   = 8;
@@ -360,7 +367,7 @@
 
 	pr_debug("pxafb: set_par\n");
 
-	if (var->bits_per_pixel == 16)
+	if (var->bits_per_pixel >= 16)
 		fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR;
 	else if (!fbi->cmap_static)
 		fbi->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR;
@@ -375,7 +382,7 @@
 
 	fbi->fb.fix.line_length = var->xres_virtual *
 				  var->bits_per_pixel / 8;
-	if (var->bits_per_pixel == 16)
+	if (var->bits_per_pixel >= 16)
 		fbi->palette_size = 0;
 	else
 		fbi->palette_size = var->bits_per_pixel == 1 ? 4 : 1 << var->bits_per_pixel;
@@ -395,7 +402,7 @@
 	 */
 	pxafb_set_truecolor(fbi->fb.fix.visual == FB_VISUAL_TRUECOLOR);
 
-	if (fbi->fb.var.bits_per_pixel == 16)
+	if (fbi->fb.var.bits_per_pixel >= 16)
 		fb_dealloc_cmap(&fbi->fb.cmap);
 	else
 		fb_alloc_cmap(&fbi->fb.cmap, 1<<fbi->fb.var.bits_per_pixel, 0);
@@ -606,6 +613,8 @@
 	case 4:
 	case 8:
 	case 16:
+	case 24:
+	case 32:
 		break;
 	default:
 		printk(KERN_ERR "%s: invalid bit depth %d\n",
@@ -708,7 +717,7 @@
 							sizeof(u32);
 	fbi->dmadesc_palette_cpu->ldcmd |= LDCMD_PAL;
 
-	if (var->bits_per_pixel == 16) {
+	if (var->bits_per_pixel >= 16) {
 		/* palette shouldn't be loaded in true-color mode */
 		fbi->dmadesc_fbhigh_cpu->fdadr = fbi->dmadesc_fbhigh_dma;
 		fbi->fdadr0 = fbi->dmadesc_fbhigh_dma; /* no pal just fbhigh */
@@ -809,15 +818,17 @@
 	/* 16 bit interface */
 	else if ((lccr0 & LCCR0_CMS) == LCCR0_Color &&
 		 ((lccr0 & LCCR0_SDS) == LCCR0_Dual || (lccr0 & LCCR0_PAS) == LCCR0_Act))
-		ldd_bits = 16;
+		ldd_bits = 18;
 
 	else {
 	        printk(KERN_ERR "pxafb_setup_gpio: unable to determine bits per pixel\n");
 		return;
         }
 
-	for (gpio = 58; ldd_bits; gpio++, ldd_bits--)
+	for (gpio = GPIO58_LDD_0; ldd_bits; gpio++, ldd_bits--) {
+		if(gpio == GPIO73_LDD_15 + 1) gpio = GPIO87_LDD_17;
 		pxa_gpio_mode(gpio | GPIO_ALT_FN_2_OUT);
+	}
 	pxa_gpio_mode(GPIO74_LCD_FCLK_MD);
 	pxa_gpio_mode(GPIO75_LCD_LCLK_MD);
 	pxa_gpio_mode(GPIO76_LCD_PCLK_MD);
diff -Nur linux-2.6.24-rc7/include/asm-arm/arch-pxa/pxa-regs.h \
                linux-2.6.24-rc7-pxafb-18bpp/include/asm-arm/arch-pxa/pxa-regs.h
--- linux-2.6.24-rc7/include/asm-arm/arch-pxa/pxa-regs.h	2008-01-06 \
                22:45:38.000000000 +0100
+++ linux-2.6.24-rc7-pxafb-18bpp/include/asm-arm/arch-pxa/pxa-regs.h	2008-01-12 \
21:20:32.000000000 +0100 @@ -1325,6 +1325,8 @@
 #define GPIO83_NSTXD		83	/* NSSP transmit */
 #define GPIO84_NSRXD		84	/* NSSP receive */
 #define GPIO85_nPCE_1		85	/* Card Enable for Card Space (PXA27x) */
+#define GPIO86_LDD_16		86	/* LCD data pin 86 (PXA270) */
+#define GPIO87_LDD_17		86	/* LCD data pin 87 (PXA270) */
 #define GPIO92_MMCDAT0		92	/* MMC DAT0 (PXA27x) */
 #define GPIO102_nPCE_1		102	/* PCMCIA (PXA27x) */
 #define GPIO109_MMCDAT1		109	/* MMC DAT1 (PXA27x) */
@@ -1840,6 +1842,8 @@
 #define LCCR3_4BPP (2 << 24)
 #define LCCR3_8BPP (3 << 24)
 #define LCCR3_16BPP (4 << 24)
+#define LCCR3_24BPP (6 << 24)	/* 18bpp packed (PXA270) */
+#define LCCR3_32BPP (5 << 24)	/* 18bpp unpacked (PXA270) */
 
 #define LCCR3_PDFOR_0 (0 << 30)
 #define LCCR3_PDFOR_1 (1 << 30)



-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic