LCD parameters in Linux LCD drivers

Source: Internet
Author: User

Original article :《Set LCD parameters in Linux Kernel"

From: http://blog.chinaunix.net/u3/113851/showart_2253712.html

 

 

  1. Kernel version: linux-2.6.34
    Development Board: pw2440
    CPU: cloud3440
    LCD: 3.5 inch TFT (320x240), model name lq035nc111
  2. 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
  3. 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.

  4. 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

  5. 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,
    };

  6. 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;
  7. There is no ambiguity in setting width and height, corresponding to 320 and 240.
  8. 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.
  9. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.