Skip to contentSkip to conversation

PXA255 LCD Driver

PATCH Ian Campbell 1 participant 1 message Mar 16, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

Attached is a patch against the most recent BK tree which implements a driver for the on-chip LCD controller of the Xscale PXA255 processor.

I would appreciate a review of the code, any comments etc, with the aim of getting the driver included in the fbdev tree (does this exist?) and ultimately in Linus' tree.

 Documentation/fb/pxafb.txt          |   55 +
 drivers/video/Kconfig               |   27
 drivers/video/Makefile              |    2
 drivers/video/fbmem.c               |    5
 drivers/video/pxafb.c               | 1368 ++++++++++++++++++++++++++++++++++++
 drivers/video/pxafb.h               |  245 ++++++
 include/asm-arm/arch-pxa/pxa-regs.h |   33
 include/asm-arm/arch-pxa/pxafb.h    |   68 +
 8 files changed, 1795 insertions(+), 8 deletions(-)

Cheers,
Ian.

Signature · 4 lines
Ian Campbell, Senior Design Engineer
                                        Web: http://www.arcom.com
Arcom, Clifton Road, 			Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom	Phone:  +44 (0)1223 411 200

PXA Framebuffer support

- now uses __devinit for initialization after the arch. This allows us to specify parameters in the architecture section, e.g. the display parameters
- includes more stuff from Jeff Lackey
- adapted Kconfig help text to get rid of reference to modules.txt
- moves backlight_power() / lcd_power() into per-machine code
- adapted to INIT_MACHINE()
- #define DEBUG must be for #include <linux/device.h>
- handle CKEN register correctly
- use the get_pcd function from 2.4 to get the correct PCD
- Set the Bpp field of LCCR3 correctly for the requested bit depth
- mask off the interrupts that we are not interested in
- correct RGB definition for 8bpp and lower depths
- add some checks for settings
- code to use the fbdev parameter setting environment
- some more error checks
- remove SA1100 framebuffer remnants
- fixed palette handling
- some more human-friendly LCD controller register name macros

#
# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
#

Documentation/fb/pxafb.txt +55 -0
Index: linux-2.6-bkpxa/Documentation/fb/pxafb.txt
===================================================================
@@ -0,0 +1,55 @@
+Driver for PXA25x LCD controller
+================================
+
+The driver supports the following options, either via
+options=<OPTIONS> when modular or video=pxafb:<OPTIONS> when built in.
+
+For example:
+	modprobe pxafb options=xres:640,yres:480,bpp:8,passive
+or on the kernel command line
+	video=pxafb:xres:640,yres:480,bpp:8,passive
+
+xres:XRES == LCCR1_PPL + 1
+yres:YRES == LLCR2_LPP + 1
+	The resolution of the display in pixels
+
+bpp:BPP
+	The bit depth. Valid values are 1, 2, 4, 8 and 16.
+
+pixclock:PIXCLOCK
+	Pixel clock in picoseconds
+
+left:LEFT == LCCR1_BLW + 1
+right:RIGHT == LCCR1_ELW + 1
+hsynclen:HSYNC == LCCR1_HSW + 1
+upper:UPPER == LCCR2_BFW
+lower:LOWER == LCCR2_EFR
+vsynclen:VSYNC == LCCR2_VSW + 1
+	Display margins and sync times
+
+color | mono => LCCR0_CMS
+	umm...
+
+active | passive => LCCR0_PAS
+	Active (TFT) or Passive (STN) display
+
+single | dual => LCCR0_SDS
+	Single or dual panel passive display
+
+4pix | 8pix => LCCR0_DPD
+	4 or 8 pixel monochrome single panel data
+
+hsync:HSYNC
+vsync:VSYNC
+	Horizontal and vertical sync. 0 => active low, 1 => active
+	high.
+
+dpc:DPC
+	Double pixel clock. 1=>true, 0=>false
+
+outputen:POLARITY
+	Output Enable Polarity. 0 => active low, 1 => active high
+
+pixclockpol:POLARITY
+	pixel clock polarity
+	0 => falling edge, 1 => rising edge
drivers/video/Kconfig +27 -0
Index: linux-2.6-bkpxa/drivers/video/Kconfig
===================================================================
@@ -884,6 +884,33 @@
 	  Say Y here if you want to support the built-in frame buffer of
 	  the Motorola 68328 CPU family.
 
+config FB_PXA
+	tristate "PXA LCD framebuffer support"
+	depends on FB && ARCH_PXA
+	---help---
+	  Frame buffer driver for the built-in LCD controller in the Intel
+	  PXA2x0 processor.
+
+	  This driver is also available as a module ( = code which can be
+	  inserted and removed from the running kernel whenever you want). The
+	  module will be called vfb. If you want to compile it as a module,
+	  say M here and read <file:Documentation/modules.txt>.
+
+	  If unsure, say N.
+
+choice
+	prompt "LCD Bit Depth"
+	depends FB_PXA
+	default FB_PXA_8BPP
+
+config	FB_PXA_8BPP
+	bool "8 bpp"
+
+config	FB_PXA_16BPP
+	bool "16 bpp"
+
+endchoice
+
 config FB_VIRTUAL
 	tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)"
 	depends on FB
drivers/video/Makefile +1 -1
Index: linux-2.6-bkpxa/drivers/video/Makefile
===================================================================
@@ -88,4 +88,4 @@
 				      cfbfillrect.o
 obj-$(CONFIG_FB_LEO)               += leo.o sbuslib.o cfbimgblt.o cfbcopyarea.o \
 				      cfbfillrect.o
-
+obj-$(CONFIG_FB_PXA)		   += pxafb.o cfbimgblt.o cfbcopyarea.o cfbfillrect.o
drivers/video/fbmem.c +5 -0
Index: linux-2.6-bkpxa/drivers/video/fbmem.c
===================================================================
@@ -112,6 +112,8 @@
 extern int chips_init(void);
 extern int g364fb_init(void);
 extern int sa1100fb_init(void);
+extern int pxafb_init(void);
+extern int pxafb_setup(char*);
 extern int fm2fb_init(void);
 extern int fm2fb_setup(char*);
 extern int q40fb_init(void);
@@ -341,6 +343,9 @@
 #ifdef CONFIG_FB_SA1100
 	{ "sa1100fb", sa1100fb_init, NULL },
 #endif
+#ifdef CONFIG_FB_PXA
+	{ "pxafb", pxafb_init, pxafb_setup },
+#endif
 #ifdef CONFIG_FB_SUN3
 	{ "sun3fb", sun3fb_init, sun3fb_setup },
 #endif
drivers/video/pxafb.c +1368 -0

1,368 lines not on this page · raw message

drivers/video/pxafb.h +245 -0

245 lines not on this page · raw message

include/asm-arm/arch-pxa/pxa-regs.h +26 -7
Index: linux-2.6-bkpxa/include/asm-arm/arch-pxa/pxa-regs.h
===================================================================
@@ -1291,15 +1291,27 @@
 #define LDCMD1		__REG(0x4400021C)  /* DMA Channel 1 Command Register */
 
 #define LCCR0_ENB	(1 << 0)	/* LCD Controller enable */
-#define LCCR0_CMS	(1 << 1)	/* Color = 0, Monochrome = 1 */
-#define LCCR0_SDS	(1 << 2)	/* Single Panel = 0, Dual Panel = 1 */
+#define LCCR0_CMS	(1 << 1)	/* Color/Monochrome Display Select */
+#define LCCR0_Color     (LCCR0_CMS*0)   /*  Color display                  */
+#define LCCR0_Mono      (LCCR0_CMS*1)   /*  Monochrome display             */
+#define LCCR0_SDS	(1 << 2)	/* Single/Dual Panel Display       */
+                                        /* Select                          */
+#define LCCR0_Sngl      (LCCR0_SDS*0)   /*  Single panel display           */
+#define LCCR0_Dual      (LCCR0_SDS*1)   /*  Dual panel display             */
+
 #define LCCR0_LDM	(1 << 3)	/* LCD Disable Done Mask */
 #define LCCR0_SFM	(1 << 4)	/* Start of frame mask */
 #define LCCR0_IUM	(1 << 5)	/* Input FIFO underrun mask */
 #define LCCR0_EFM	(1 << 6)	/* End of Frame mask */
-#define LCCR0_PAS	(1 << 7)	/* Passive = 0, Active = 1 */
-#define LCCR0_BLE	(1 << 8)	/* Little Endian = 0, Big Endian = 1 */
-#define LCCR0_DPD	(1 << 9)	/* Double Pixel mode, 4 pixel value = 0, 8 pixle values = 1 */
+#define LCCR0_PAS	(1 << 7)	/* Passive/Active display Select   */
+#define LCCR0_Pas       (LCCR0_PAS*0)   /*  Passive display (STN)          */
+#define LCCR0_Act       (LCCR0_PAS*1)   /*  Active display (TFT)           */
+#define LCCR0_DPD	(1 << 9)	/* Double Pixel Data (monochrome   */
+                                        /* display mode)                   */
+#define LCCR0_4PixMono  (LCCR0_DPD*0)   /*  4-Pixel/clock Monochrome       */
+                                        /*  display                        */
+#define LCCR0_8PixMono  (LCCR0_DPD*1)   /*  8-Pixel/clock Monochrome       */
+                                        /*  display                        */
 #define LCCR0_DIS	(1 << 10)	/* LCD Disable */
 #define LCCR0_QDM	(1 << 11)	/* LCD Quick Disable mask */
 #define LCCR0_PDD	(0xff << 12)	/* Palette DMA request delay */
@@ -1361,8 +1373,15 @@
 #define LCCR3_API_S	16
 #define LCCR3_VSP	(1 << 20)	/* vertical sync polarity */
 #define LCCR3_HSP	(1 << 21)	/* horizontal sync polarity */
-#define LCCR3_PCP	(1 << 22)	/* pixel clock polarity */
-#define LCCR3_OEP	(1 << 23)	/* output enable polarity */
+#define LCCR3_PCP	(1 << 22)	/* Pixel Clock Polarity (L_PCLK)   */
+#define LCCR3_PixRsEdg  (LCCR3_PCP*0)   /*  Pixel clock Rising-Edge        */
+#define LCCR3_PixFlEdg  (LCCR3_PCP*1)   /*  Pixel clock Falling-Edge       */
+
+#define LCCR3_OEP       (1 << 23)       /* Output Enable Polarity (L_BIAS, */
+                                        /* active display mode)            */
+#define LCCR3_OutEnH    (LCCR3_OEP*0)   /*  Output Enable active High      */
+#define LCCR3_OutEnL    (LCCR3_OEP*1)   /*  Output Enable active Low       */
+
 #if 0
 #define LCCR3_BPP	(7 << 24)	/* bits per pixel */
 #define LCCR3_BPP_S	24
include/asm-arm/arch-pxa/pxafb.h +68 -0

68 lines not on this page · raw message