NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on The site is now set to read only.

LCD RGB 640x480 VGA Addition

From Texas Instruments Wiki
Jump to: navigation, search

To integrate support for the Logic PD LCD display to the davincifb driver, a few additions and modifications must be made.

First, add the function davincifb_lcd_rgb_config to set up the registers of the VENC to output red, green, blue (RGB) data, and control signals. This function configures the video processing back end (VPBE) registers to output RGB666 non-interlaced color data and control signals. In addition, this function configures the timings for the LCD by calling another function (set_lcd_timings) that was added. This function call sets up all timings required to make the LCD work properly. To ease the use of this function, a structure called lcd_timing_params was created with all of the LCD timing data in it. This structure contains all of the timing parameters that must be set to ensure proper timing on the LCD.

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 other wise. If unsure you may try both ;)

Changing DaVinci Display Drivers

MV Tree

I'm not using MV tree for a long time but as of MV 4.0.1 you need to modify drivers/media/video/davinci/logicpd_encoder.c as it is the easiest way. In that file you will see something like:

static struct logicpd_encoder_config logicpd_encoder_configuration = {
	.output[0] = {
		      .output_name = VID_ENC_OUTPUT_LCD,
		      .no_of_standard = LOGICPD_ENCODER_GRAPHICS_NUM_STD,
		      .standards[0] = {
				       .name = VID_ENC_STD_640x480,
				       .std = 1,
				       .if_type = VID_ENC_IF_PRGB,
				       .interlaced = 0,
				       .xres = 800,
				       .yres = 480,
				       .fps = {55, 1},
				       .left_margin = 40,
				       .right_margin = 40,
				       .upper_margin = 29,
				       .lower_margin = 13,
				       .hsync_len = 48,
				       .vsync_len = 3,
				       .flags = 0},	/* hsync -ve, vsync -ve */
		      .standards[1] = {

You should change your values according the values you derived in previous section. Do not forget to change 'interlaced' to zero as well. fps definition is not so critical I guess, so something between 55-60 should suffice. flags field can be used to invert signals, however, zero is suitable for most of the display modules. Do not worry about the mode name VID_ENC_STD_640x480 if you are lazy as me to add a new mode to the list ;)

After changing this file, use kernel config menu and be sure that logicpd encoder is selected under drivers -> multimedia devices -> Video Capture Adapters. Then compile and boot your new kernel:(Assuming tftpboot)

$make menuconfig
$make CROSS_COMPILE=/path-to-your-MV-toolchain-directory/bin/arm_v5t-le uImage
$cp arch/arm/boot/uImage /tftpboot

Note that you should have following line in your bootargs:

... video=davincifb:osd0=800x480x16,2000K@0x0,0:osd1=800x480,2000K@0x0,0:vid0=800x480x16,3000K@0x0,0:vid1=800x480x16,3000K@0x0,0  
davinci_enc_mngr.ch0_output=LCD davinci_enc_mngr.ch0_mode=640x480 ...

GIT Tree

Current GIT kernel doesn't include full fledged VPSS support so implementing LCD support will not be as easy. I have ported MV display drivers to against 2.6.30-rc6 but I expect TI to release new drivers for GIT kernel real soon, so waiting for new drivers seems logical.