Linux LCD timing handling and interfacing

From Low cost, low power, android ARM system board by - pico WiKi
Jump to navigation Jump to search

Linux LCD Timing Handling and Interfacing

Linux framebuffer drivers timing information is explained in detail at Documentation/fb/framebuffer.txt under Linux source tree. We will try to summarize this information here a bit.

Following diagram shows which timing value from your LCD datasheet corresponds to which framebuffer settings.

Lcd datasheet to linux.jpg

LCD datasheets generally mention about back porch, front porch and so on whereas Linux uses notation of margins instead.

HSYNC and VSYNC Controlled LCD Displays

If your LCD uses hsync and vsync then you can easly convert LCD timing values to Linux display driver values using the diagram above.

DE Controller LCD Displays

In this type of displays, there are no such signals named hsync, vsync or back/front porch. Instead, they use horizontal/vertical period, valid and blank definitions. In this case you should refer to the timing diagram in LCD datasheet and convert these values to Linux framebuffer definitions by hand. Again you can refer to the above picture for conversion. In general following equations can be used:

xres = horizontal valid
left margin = horizontal period - horizontal valid
right margin = 0
hsync_len = 0
yres = vertical valid
upper margin = vertical period - vertical valid
lower margin = 0
vsync_len = 0

You may need to interchange left-right margin and/or lower-upper margin values if your LCD datasheet diagrams shows otherwise.

To calculate pixclock you can use this formula:

pixclock = KHZ2PICOS(
            (xres + left_margin + right_margin + hsync_len)* 
            (yres + upper_margin + lower_margin + vsync_len) *
             refresh / 1000

parts ©