Original article :《Set LCD parameters in Linux Kernel"
From: http://blog.chinaunix.net/u3/113851/showart_2253712.html
- Kernel version: linux-2.6.34
Development Board: pw2440
CPU: cloud3440
LCD: 3.5 inch TFT (320x240), model name lq035nc111
- LCD parameters are to be set according to the LCD manual ARCH/ARM/mach-s3c2440/mach-smdk2440.c inside the s3c2410fb_display smdk2440_ LCD _cfg struct
- For example, you can obtain the following table from the lq035nc111 manual.
This table describes all the clock requirements of the parallel LCD. Here I refer to the "typ" column, which is a typical value.
- A very useful document file is the documentation/FB/framebuffer.txt file, which describes an architecture for us.
+ ---------- + --------------------------------------------- + ---------- + ------- +
| Items |
| Upper_margin |
| Items |
+ ----------###################################### ######### ---------- + ------- +
| # Items # |
| #|#| |
| #|#| |
| #|#| |
| Left # | # Right | hsync |
| Margin # | xres # margin | Len |
| <-------- >#< --------------- + --------------------------- >#< -------- >|< -----> |
| #|#| |
| #|#| |
| #|#| |
| # | Yres # |
| #|#| |
| #|#| |
| #|#| |
| #|#| |
| #|#| |
| #|#| |
| #|#| |
| #|#| |
| # Items # |
+ ----------###################################### ######### ---------- + ------- +
| Items |
| Lower_margin |
| Items |
+ ---------- + --------------------------------------------- + ---------- + ------- +
| Items |
| Vsync_len |
| Items |
+ ---------- + --------------------------------------------- + ---------- + ------- +There is also a useful formula
Pixelclock: Xfree: In MHz FB: in picoseconds (PS) Pixclock = 1000000/DCF |
- Combined with struct
static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {
.lcdcon5 = S3C2410_LCDCON5_FRM565 | S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME | S3C2410_LCDCON5_PWREN | S3C2410_LCDCON5_HWSWP,
.type = S3C2410_LCDCON1_TFT,
.width = LCD_WIDTH, .height = LCD_HEIGHT,
.pixclock = LCD_PIXCLOCK, .xres = LCD_WIDTH, .yres = LCD_HEIGHT, .bpp = 16, .left_margin = LCD_LEFT_MARGIN, .right_margin = LCD_RIGHT_MARGIN, .hsync_len = LCD_HSYNC_LEN, .upper_margin = LCD_UPPER_MARGIN , .lower_margin = LCD_LOWER_MARGIN, .vsync_len = LCD_VSYNC_LEN, };
|
- Pixclock: now we can set the parameters of this struct. The above 3rd summary table shows that the LCD clock DCLK should be 156ns, which corresponds to the pixel clock pixclock In the struct, let's take a look at the formula pixclock = 1000000/DCF mentioned in section 4. This DCF is the frequency corresponding to the DCLK of the LCD. Note that the unit is MHz, therefore, DCF = 1000 000 000/156Hz = 1000/156 MHz; pixclock = 1000000/(1000/156) = 156000 can be obtained;
- There is no ambiguity in setting width and height, corresponding to 320 and 240.
- BPP: in fact, in my LCD manual, this screen supports 24-bit color, but here we enter 16 bits. If you have time, try 24 bits.
- Other parameters: Fill in other parameters corresponding to the table in section 3rd
Xres <============> TEP Yres <==========> TVD Left_margin <============> THF Right_margin <============> THB Hsync_len <============> ths Upper_margin <============> tvf Lower_margin <============> TVB Vsync_len <============> TVs |
So my configuration is as follows:
#define LCD_WIDTH 320 #define LCD_HEIGHT 240 #define LCD_PIXCLOCK 156000
#define LCD_RIGHT_MARGIN 38 #define LCD_LEFT_MARGIN 20 #define LCD_HSYNC_LEN 30
#define LCD_UPPER_MARGIN 4 #define LCD_LOWER_MARGIN 15 #define LCD_VSYNC_LEN 3
|
Keywords:
Linux LCD parameters, Linux LCD driver parameters, and LCD parameters.