Skip to contentSkip to conversation

PXA255 LCD Driver

PATCH In review Ian Campbell 4 participants 15 messages Mar 17, 2004 – Mar 25, 2004

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

PATCH 1/1 PXA255 LCD Driver

Hi,

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. It is based on the SA1100 FB driver and has been hacked on by various people on the ARM mailing list.

I would appreciate a review of the code, any comments etc, with the aim of getting the driver into good shape to be merged.

I posted it to the fbdev list @ sf.net (from MAINTAINERS) but that list seems to be pretty quiet and www.linux-fbdev.org (also from MAINTAINERS) seems to be down -- is there a more appropriate place these days for framebuffer stuff?

 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(-)
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

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
#1 lore raw

Documentation/fb/pxafb.txt line 8

Quoted 10 lines · Ian Campbell

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. It is based on the SA1100 FB driver and has been hacked on by various people on the ARM mailing list.

I would appreciate a review of the code, any comments etc, with the aim of getting the driver into good shape to be merged.

Documentation/fb/pxafb.txt +2 -0
+For example:
+	modprobe pxafb options=xres:640,yres:480,bpp:8,passive

Not much comments, except: why don't you use the standard modedb mode parameter style?

Quoted 2 lines

I posted it to the fbdev list @ sf.net (from MAINTAINERS) but that list seems to be pretty quiet and www.linux-fbdev.org (also from MAINTAINERS)

It's not quiet, though.

Quoted 2 lines

seems to be down -- is there a more appropriate place these days for framebuffer stuff?

linux-fbdev-devel was correct.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw
Quoted 6 lines

Documentation/fb/pxafb.txt line 8

Quoted 3 lines
Documentation/fb/pxafb.txt +2 -0
+For example:
+	modprobe pxafb options=xres:640,yres:480,bpp:8,passive

Not much comments, except: why don't you use the standard modedb mode parameter style?

I was trying too (I mostly copied the i810 driver). How wrong did I get it? I'm willing to rework it to make it the same as the standard.

Quoted 4 lines
Quoted 2 lines

I posted it to the fbdev list @ sf.net (from MAINTAINERS) but that list seems to be pretty quiet and www.linux-fbdev.org (also from MAINTAINERS)

It's not quiet, though.

OK, I just hadn't seen many messages since I subscribed...

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
#3 lore raw

Hi Ian,

Quoted 8 lines · Ian Campbell
Quoted 5 lines

Documentation/fb/pxafb.txt line 8

Quoted 2 lines
Documentation/fb/pxafb.txt +2 -0
+For example:
+	modprobe pxafb options=xres:640,yres:480,bpp:8,passive

Not much comments, except: why don't you use the standard modedb mode parameter style?

I was trying too (I mostly copied the i810 driver). How wrong did I get it? I'm willing to rework it to make it the same as the standard.

Take a look at drivers/video/modedb.c and fb_find_mode().

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#4 lore raw
Quoted 4 lines
Quoted 2 lines

I was trying too (I mostly copied the i810 driver). How wrong did I get it? I'm willing to rework it to make it the same as the standard.

Take a look at drivers/video/modedb.c and fb_find_mode().

Ah, I had seen that, but it doesn't seem to be very appropriate for an LCD controller in an embedded environment. TFT and STN (STN in particular) displays don't often fit into any of the standard mode definitions. There's also several settings which aren't in the DB, such as pixel clock polarity, dual vs. single panel STN etc.

I quite often get asked to make some arbitrary panel which a customer picked up somewhere dirt cheap to work, it is very useful to be able to give each of the parameters explicitly, even if they do not correspond to a mode listed in the DB.

I could make the code use the same XRESxYRES-DEPTH syntax though since the 2.4 version did (by copying the parsing code from fb_find_mode()), I just changed it to match i810fb for the 2.6 port.

I had considered extending the modedb stuff to support the requirements of embedded LCD controller drivers and to encompass a db of LCD panels by part number (Kconfig selectable, something like the NLS support perhaps) containing the extra options that you can have -- but I wasn't sure if it was something that would be useful only to me or to all embedded LCD driver authors.

Ian.

Signature · 10 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


_____________________________________________________________________
The message in this transmission is sent in confidence for the attention of the addressee only and should not be disclosed to any other party. Unauthorised recipients are requested to preserve this confidentiality. Please advise the sender if the addressee is not resident at the receiving end.  Email to and from Arcom is automatically monitored for operational and lawful business reasons.

This message has been checked for all viruses by MessageLabs Virus Control Centre.
#14 lore raw
In reply to Ian Campbell
Quoted 5 lines

I posted it to the fbdev list @ sf.net (from MAINTAINERS) but that list seems to be pretty quiet and www.linux-fbdev.org (also from MAINTAINERS) seems to be down -- is there a more appropriate place these days for framebuffer stuff?

Sorry about the delay. I have been working on the video resize code. We are on the list. As for www.linux-fbdev.org. That has never been fixed. Some how that domain name is in limbo :-( The sf site is the main site for fbdev developement. I need to look over your driver in detail today.

#5 lore raw
In reply to Ian Campbell
Quoted 11 lines
Quoted 5 lines
Quoted 3 lines

I was trying too (I mostly copied the i810 driver). How wrong did I get it? I'm willing to rework it to make it the same as the standard.

Take a look at drivers/video/modedb.c and fb_find_mode().

Ah, I had seen that, but it doesn't seem to be very appropriate for an LCD controller in an embedded environment. TFT and STN (STN in particular) displays don't often fit into any of the standard mode definitions. There's also several settings which aren't in the DB, such as pixel clock polarity, dual vs. single panel STN etc.

The way to handle different types of displays, LCD, CRT etc has
improved greatly in the latest 2.6.X kernels. You don't need to lock yourself into the standard modedb database. Also modedb is used only for selecting a particular resolution. The structure used to define the display panels behavior is struct fb_monspecs. Take a look at it in fb.h. I'm interested if I got all the needed data from the EDID about a display panel.

Here is basically what you have to do to handle mode setting:

1) Does the displaying hardware tell you data about itself? You have to ask yourself can I get display hardware information. If it does what format is it in. In most hardware today you can get data about the display hardware in a EDID block format. Usually that data is retrieved via i2c. Fbdev driver writers must write the code handling getting the display hardware's data. Once you have the EDID data block you can use already written functions to parse the EDID block.
If you display hardware does not use EDID format then the driver
writer must parse the data himself. What data needs to get generated? This is covered next.

2) Attempt to generate the struct fb_monspecs data. Now it is not a absolute requirement but it sure does help. There is one per physical display. This means for cases like laptops you can have one framebuffer's data being displayed on two physical displays (attached CRT and the LCD panel). In this case you would have two struct fb_monspecs per struct fb_info. When you are going to change the video mode you would have to valid the new mode against BOTH physical displays. In fact you can get a bunch of crazy combo's. The important part is that use generate a fb_monospec if possible.
Note that fb_monospec has a mode database in its data structure.
Sometimes the display hardware will tell use what the "best" video modes are for it. Also some display hardware is limited in what it can be allow to display. SO those modes are the only ones that actually work.
Now back to the EDID case. There is a global function that will get
the monitor limits for you. This function will also build you your modedb for you!!!

fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs)

Again what if we don't use EDID. Well if you can get the display hardware information in some way it is in your best interest to create a struct fb_monspec and also the modedb attached to it. What if you can't get supported modes to build a database but you can get the monitor limits? Here are your options.

I. Build your own modedb from stratch.
II. Use the standard vesa database if hooking up to a standard vesa
display.
III. Don't use a database. We have a function, fb_get_mode in fbmon.c,
that generates modes on the fly based on GTF formulas. Note this function can generate modes without fb_monspecs but it will be severally handicapped modes.

Now if you can't get neither fb_monspecs or modedb data you still can use the above options.

3) Okay now we "might" have our monitor data and our modedb. If we have to ask ourselves does the hardware allow the change of the resolution? If it doesn't then why do we generate a fb_monospec or a modedb. Because that data can be very useful to userland :-) If this is the case you can call fb_find_mode on your modedb if you have one and return the default struct fb_var_screeninfo that we need. If you don't have a modedb you still need to supply a default struct fb_var_screeninfo that represents the display resolution. Also you could have the case where you swap about the display. In this case you might want to create a new fb_monospec and update your var data even if you don't change your resolution. Now we are done. If you hardware can change modes then continue on.

3) Now what to do for when we want to set the graphics display. Before we consider the monitor we have to see if the new resolution request is complete. Not every fb_var_screeninfo request is complete. Often the user only is concern with xres, yres and bpp. That is it. Alot of data is missing. This is bug in many drivers that they don't fill in that data thus often when the user tried to change the resolution they ended up with a blank screen. So how do we deal with it?

4) First we can use a modedb we have to find the best fit. If not use the function fb_get_mode in fbmon.c.

5) Now that we have the purposed mode we call the function

fb_validate_mode(const struct fb_var_screeninfo *var, struct fb_info *info)

This tells us if the requested video mode is to much for our display hardware to handle.

6) If the monitor can handle it we call the drivers xxxfb_check_var function to see if the graphics chip can handle the mode.

I hope that answers your question. Now that I wrote this I'm going to make it apart of the documenation in the kernel for a driver how to.

#6 lore raw

Hi James (and everyone),

Quoted 6 lines

The way to handle different types of displays, LCD, CRT etc has improved greatly in the latest 2.6.X kernels. You don't need to lock yourself into the standard modedb database. Also modedb is used only for selecting a particular resolution. The structure used to define the display panels behavior is struct fb_monspecs. Take a look at it in fb.h. I'm interested if I got all the needed data from the EDID about a display panel.

I understand what you are saying (I think...), but I'm not sure how it applies to my situation -- my embedded LCD controller has no analogue for much of the stuff in fb_monspecs and has some extra stuff which are not present there.

If I explain what the situation is with the PXA LCD controller perhaps you can give me some advice onto how I can massage this into the current system, or extend the system to my needs.

Essentially the LCD controller<->panel interface has 16 data pins, an output enable, a pixel clock and (HV)sync. There is nothing 'intelligent' in the controller, it needs to be told explicitly how it should manage these pins. The settings depend on the panel you have attached and there is no way to automatically derive them, the panel is not like a monitor really, it just shifts in pixel data on each clock pulse and puts it on the display.

The settings which are of interest on a PXA255 are that aren't present in fb_monspecs, they specify the physical interface between the processor and the panel:

active(==TFT) or passive(==STN),
These are two fundamentally different types of panel. It impacts when the pixclock ticks (all the time or just when data is present), and some other timing stuff.
output enable polarity
panel is enabled on low or high
pixel clock polarity
should the panel shift in data on a rising or a falling edge
dual or single panel
some STN panels are physically two panels stacked on top of each other, this impacts the way pixel data is packed onto the data lines
4pix or 8pix STN mono
Monochrome STN panels take either 4 or 8 pixels at a time.

All of these differ from panel to panel, pretty much at the whim of the manufacturer...

The other settings I think are already accounted for in the mode db:
resolution, bit depth, color/mono/grayscale, pixel clock, h and vsync length, Left-Right-Upper-Lower margins.
However -- all these are fixed in hardware for any given panel (although you could emulate different resolutions in s/w I guess).

Because the driver is often used in an embedded environment the settings are often hardcoded at compile time.

My problem is that I need to support Arcom's development kits, which a customer might plug just about any TFT or STN panel into, so I need to be able to control all of the above settings from the command line or module parameters, or to pass in something like the LCD part # and have the settings looked up from a DB. However I would like to keep the overhead for others who just want a single static panel to be as small as possible.

I also don't know how applicable all this is to other embedded LCD controllers --- the StrongArm hardware is very close to the PXA hardware, and I think all controllers which are as low level as them will share the same settings (since they are down to the hardware interface). I don't know for sure though.

My thinking prior to this discussion was to go for a database which maps LCD part # to all the settings above, where each LCD is selectable from Kconfig and a default can be specified (sort of like NLS now). People with a static panel would only build in the one database entry, people like me could build in a selection and choose from the command line etc (with overrides for all the above).

Ian.

Signature · 10 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


_____________________________________________________________________
The message in this transmission is sent in confidence for the attention of the addressee only and should not be disclosed to any other party. Unauthorised recipients are requested to preserve this confidentiality. Please advise the sender if the addressee is not resident at the receiving end.  Email to and from Arcom is automatically monitored for operational and lawful business reasons.

This message has been checked for all viruses by MessageLabs Virus Control Centre.
#11 lore raw
In reply to James Simmons
Quoted 2 lines · James Simmons

behavior is struct fb_monspecs. Take a look at it in fb.h. I'm interested if I got all the needed data from the EDID about a display panel.

You're thinking too PC-centric. You don't get EDID data with embedded LCD panels. Instead, you get timing information, number of pixels per line, and other parameters either from a PDF or paper datasheet on the device.

Signature · 11 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
#12 lore raw
Quoted 9 lines · James Simmons
Quoted 2 lines

behavior is struct fb_monspecs. Take a look at it in fb.h. I'm interested if I got all the needed data from the EDID about a display panel.

You're thinking too PC-centric. You don't get EDID data with embedded LCD panels. Instead, you get timing information, number of pixels per line, and other parameters either from a PDF or paper datasheet on the device.

Your right. Want I would like to know is what do you guys need!!!

#7 lore raw
In reply to Ian Campbell
Quoted 6 lines

I understand what you are saying (I think...), but I'm not sure how it applies to my situation -- my embedded LCD controller has no analogue for much of the stuff in fb_monspecs and has some extra stuff which are not present there.

What is it you need exactly?

Quoted 2 lines

Essentially the LCD controller<->panel interface has 16 data pins, an output enable, a pixel clock and (HV)sync.

Is this the case for your setup or is this something true in general. I like to add data fields that could be used by everyone.

Quoted 22 lines

The settings which are of interest on a PXA255 are that aren't present in fb_monspecs, they specify the physical interface between the processor and the panel:

active(==TFT) or passive(==STN),
These are two fundamentally different types of panel. It impacts when the pixclock ticks (all the time or just when data is present), and some other timing stuff.

output enable polarity
panel is enabled on low or high
pixel clock polarity
should the panel shift in data on a rising or a falling edge
dual or single panel
some STN panels are physically two panels stacked on top of each other, this impacts the way pixel data is packed onto the data lines
4pix or 8pix STN mono
Monochrome STN panels take either 4 or 8 pixels at a time.

Quoted 2 lines

All of these differ from panel to panel, pretty much at the whim of the manufacturer...

Are these the fields you need in general?

Quoted 5 lines

The other settings I think are already accounted for in the mode db:
resolution, bit depth, color/mono/grayscale, pixel clock, h and vsync length, Left-Right-Upper-Lower margins.
However -- all these are fixed in hardware for any given panel (although you could emulate different resolutions in s/w I guess).

... snip ...

Quoted 6 lines

I also don't know how applicable all this is to other embedded LCD controllers --- the StrongArm hardware is very close to the PXA hardware, and I think all controllers which are as low level as them will share the same settings (since they are down to the hardware interface). I don't know for sure though.

Quoted 6 lines

My thinking prior to this discussion was to go for a database which maps LCD part # to all the settings above, where each LCD is selectable from Kconfig and a default can be specified (sort of like NLS now). People with a static panel would only build in the one database entry, people like me could build in a selection and choose from the command line etc (with overrides for all the above).

I have thought about it. That is why I toke so long to reply. I think the best approach is that we create a database of struct fb_monspecs for LCD panels. In struct fb_monspecs we have the following fields.

manufacturer[4]
monitor[14]
serial_no[14]
ascii[14] For expansion.

We can have it so that we can pass in a monitor string that can be used to select the proper LCD panel in the database. How does that sound?

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

#8 lore raw
Quoted 2 lines · James Simmons

We can have it so that we can pass in a monitor string that can be used to select the proper LCD panel in the database. How does that sound?

That's still a little problematical because some hardware people put a CPLD between the LCD controller and the LCD panel itself which may change the characteristics.

It's fairly common to have one LCD controller appear in many different devices (because its part of the CPU) and have the same display, yet need different timing.

For example, see sa1100fb.c:

static struct sa1100fb_mach_info lq039q2ds54_info __initdata = {

        .pixclock       = 171521,       .bpp            = 16,
        .xres           = 320,          .yres           = 240,
        .hsync_len      = 5,            .vsync_len      = 1,
        .left_margin    = 61,           .upper_margin   = 3,
        .right_margin   = 9,            .lower_margin   = 0,

.sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,

.lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
.lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
};

static struct sa1100fb_mach_info h3600_info __initdata = {

        .pixclock       = 174757,       .bpp            = 16,
        .xres           = 320,          .yres           = 240,
        .hsync_len      = 3,            .vsync_len      = 3,
        .left_margin    = 12,           .upper_margin   = 10,
        .right_margin   = 17,           .lower_margin   = 1,

.cmap_static = 1,

.lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
.lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
};

Both of these are the same LCD panel (type LQ039Q2DS54) yet there are two different sets of timing information, including the polarity of the line and field clocks (which are equivalent to hsync and vsync.)

Also note that such panels are generally fixed resolution, though there are a few rare exceptions where changing the colour depth is permitted.

Signature · 11 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
#10 lore raw
In reply to James Simmons
Quoted 1 line

Is this the case for your setup or is this something true in general.

I'm not entirely sure -- I know it's true in my case, I have a feeling it's true in general (apart from things like the CPLDs that Russell mentioned).

Quoted 1 line

I like to add data fields that could be used by everyone.

I totally agree -- as I said in my reply to Russell I don't want to come up with a solution which is only useful to me!

Quoted 1 line

Are these the fields you need in general?

I believe so -- although as I said I'm not 100% about it. I really need input from people who have experience with lcd controllers on other architectures than StrongArm and XScale.

Quoted 2 lines

We can have it so that we can pass in a monitor string that can be used to select the proper LCD panel in the database. How does that sound?

It sounds great, if we can work out which extra settings are needed

Ian.

Signature · 9 lines
Ian Campbell



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
#9 lore raw
In reply to Russell King
Quoted 3 lines · Russell King

It's fairly common to have one LCD controller appear in many different devices (because its part of the CPU) and have the same display, yet need different timing.

This was something that I was worried about -- it seems like this sort of thing would negate any benefit from building a database of panels for general use.

Perhaps it would be posible to build a database of panels as described in their datasheets. Boards which have a CPLD could perhaps define a per-board fixup function, since they know the sync lines are inverted or whatever.

I'm not sure though -- my experience is with our board which has a PXA255 and no CPLD messing with the display controller stuff. I'm wary of coming up with a solution which is only useful to me and noone else...

Ian.

Signature · 13 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




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
#13 lore raw
In reply to James Simmons

Hi James and others,

I've been playing with trying to get something which uses fb_monspecs put together. The patch is littered with FIXME, TODO and debugging cruft but it seems to work for the two panels I have bothered to put in the LCD DB. If the general approach is satisfactory for you I will look at tidying it up and making everything work properly. I'm not sure about the aesthetics physical_interface stuff in fb_monspecs but that can be changed as you wish. Perhaps a ->type field + a union to cover MONITOR/TFT/STN in a space efficient manner?? I'm not sure what sort of API/ABI guarentees are being made for fb_monspecs and fb_videomode at this time.

I couldn't find suitable places for a few settings. They are commented in fb.h (and hardcoded for now in pxafb). The settings are the bit depth and some color map stuff.

I'm not happy with the way the fb_videomode and the fb_monspecs are separated in lcddb.c. I'm not sure if there is syntax in C to allow me to put the pointer to fb_videomode inline in the fb_monspecs declaration. Perhaps I will define a datatype fb_lcd_info which is roughly the same as the commented out stuff in include/asm-arm/arch-pxa/pxafb.h and have fb_lcd_lookup construct the fb_monspec with dynamically allocated fb_videomode from that (which might be best anyway, since other code looks like it might expect the modedb to be dynamically allocated).

My only thought is that having done that, perhaps it makes sense to dispense with the fb_monspecs stuff and have drivers use fb_lcd_info directly. What does using fb_monspecs gain us over this scenario?

Ian.

Signature · 10 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


_____________________________________________________________________
The message in this transmission is sent in confidence for the attention of the addressee only and should not be disclosed to any other party. Unauthorised recipients are requested to preserve this confidentiality. Please advise the sender if the addressee is not resident at the receiving end.  Email to and from Arcom is automatically monitored for operational and lawful business reasons.

This message has been checked for all viruses by MessageLabs Virus Control Centre.
drivers/video/Makefile +2 -0
Index: linux-2.6-bkpxa/drivers/video/Makefile
===================================================================
@@ -88,4 +88,6 @@
 				      cfbfillrect.o
 obj-$(CONFIG_FB_LEO)               += leo.o sbuslib.o cfbimgblt.o cfbcopyarea.o \
 				      cfbfillrect.o
+obj-$(CONFIG_FB_PXA)		   += pxafb.o lcddb.o cfbimgblt.o cfbcopyarea.o cfbfillrect.o
+CFLAGS_pxafb.o = -DDEBUG
 
drivers/video/lcddb.c +87 -0

87 lines not on this page · raw message

drivers/video/pxafb.c +1423 -0

1,423 lines not on this page · raw message

drivers/video/pxafb.h +125 -0

125 lines not on this page · raw message

include/asm-arm/arch-pxa/pxafb.h +69 -0

69 lines not on this page · raw message

include/linux/fb.h +24 -0
Index: linux-2.6-bkpxa/include/linux/fb.h
===================================================================
@@ -273,6 +273,21 @@
 	__u32 whitey;
 };
 
+/* bit field for fb_monspecs->physical_interface */
+#define FB_LCD_PHYS_KIND	(1<<0) /* Type of panel: more than 1 bit?? */
+#define FB_LCD_PHYS_KIND_STN	(FB_LCD_PHYS_KIND*0)
+#define FB_LCD_PHYS_KIND_TFT	(FB_LCD_PHYS_KIND*1)
+
+#define FB_LCD_PHYS_OUTEN	(1<<1) /* Output enable polarity */
+#define FB_LCD_PHYS_OUTEN_LOW	(FB_LCD_PHYS_OUTEN*0)
+#define FB_LCD_PHYS_OUTEN_HIGH	(FB_LCD_PHYS_OUTEN*1)
+
+#define FB_LCD_PHYS_PIXPOL	(1<<2) /* Pixel clock polarity */
+#define FB_LCD_PHYS_PIXPOL_FALLING (FB_LCD_PHYS_PIXPOL*0)
+#define FB_LCD_PHYS_PIXPOL_RISING  (FB_LCD_PHYS_PIXPOL*1)
+
+/* TODO. For STN: Dual/Single, 4 or 8 bit mono, ACbias. */
+
 struct fb_monspecs {
 	struct fb_chroma chroma;
 	struct fb_videomode *modedb;	/* mode database */
@@ -301,6 +316,15 @@
 	__u8  revision;			/* ...and revision */
 	__u8  max_x;			/* Maximum horizontal size (cm) */
 	__u8  max_y;			/* Maximum vertical size (cm) */
+	__u32 physical_interface;	/* Physical interface properties */    
+	/* other things from the old pxafb_mach_info structure which I
+	 * can't figure out how to place here:
+	 *  - bpp/depth
+	 *  - cmap_greyscale
+	 *  - cmap_inverse
+	 *  - cmap_static
+	 */
+
 };
 
 #define FB_VBLANK_VBLANKING	0x001	/* currently in a vertical blank */