6/02/2012

How to add support for a new MDDI client on Linux platforms.

Below are the steps to be followed to add support for a OEM specific MDDI client/bridge chip.

Qualcomm (QC) delivered codebase has support for the MDDI clients used on QC internal platform. These client specific driver files can be modified to support OEM specific MDDI bride chips. Below are the steps that can be used to add support for a specific Toshiba MDDI client on MSM and QSD LE / Android builds.


1. Edit the drivers/video/Kconfig to add a config option:

config FB_MSM_MDDI_TOSHIBA_WVGA
bool "MDDI Toshiba WVGA panel"
select FB_MSM_MDDI_TOSHIBA_COMMON
---help---
Support for MDDI Tohsiba (800x480) WVGA panel

2. Edit drivers/video/msm/Makefile to specify source files

obj-$(CONFIG_FB_MSM_MDDI_TOSHIBA_WVGA) += mddi_toshiba_wvga.o

3. Make any necessary changes in the common toshiba client driver file (drivers/video/msm/mddi_toshiba.c), for example in toshiba_common_initial_setup() routine

if (TM_GET_PID(mfd->panel.id) == LCD_TOSHIBA_2P4_WVGA) {
mddi_wait(400);
write_client_reg(DRAMPWR, 0x00000001, TRUE);
write_client_reg(CNT_DIS, 0x00000002, TRUE);
write_client_reg(BITMAP0, 0x01E00320, TRUE);
write_client_reg(PORT_ENB, 0x00000001, TRUE);
write_client_reg(PORT, 0x00000004, TRUE);
write_client_reg(PXL, 0x0000003A, TRUE);
write_client_reg(MPLFBUF, 0x00000000, TRUE);
write_client_reg(HCYCLE, 0x00000253, TRUE);
write_client_reg(HSW, 0x00000003, TRUE);
write_client_reg(HDE_START, 0x00000017, TRUE);
write_client_reg(HDE_SIZE, 0x0000018F, TRUE);
write_client_reg(VCYCLE, 0x000001FF, TRUE);
write_client_reg(VSW, 0x00000001, TRUE);
write_client_reg(VDE_START, 0x00000003, TRUE);
write_client_reg(VDE_SIZE, 0x000001DF, TRUE);
write_client_reg(START, 0x00000001, TRUE);
mddi_wait(1);
write_client_reg(TIMER0CTRL, 0x00000060, TRUE);
write_client_reg(TIMER0LOAD, 0x00001388, TRUE);
write_client_reg(TIMER1CTRL, 0x00000060, TRUE);
write_client_reg(TIMER1LOAD, 0x00001388, TRUE);
write_client_reg(PWM1OFF, 0x00000087, TRUE);
} else {
write_client_reg(DRAMPWR, 0x00000001, TRUE);
write_client_reg(TIMER0CTRL, 0x00000060, TRUE);
write_client_reg(TIMER0LOAD, 0x00001388, TRUE);
write_client_reg(TIMER1CTRL, 0x00000060, TRUE);
write_client_reg(TIMER1LOAD, 0x00001388, TRUE);
write_client_reg(PWM1OFF, 0x00001387, TRUE);
}


4. Add a panel specific source driver drivers/video/msm/mddi_toshiba_wvga.c


a.. In the below code, the MDDI client / panel configuration variables (lcd.v_back_porch, lcd.v_front_porch, lcd.v_pulse_width, clk_rate, clk_min, clk_max) are obtained from the MDDI client chip / LCD panel specifications respectively.
a.. Note the use of mddi_toshiba_device_register()

#include "msm_fb.h"
#include "mddihost.h"
#include "mddi_toshiba.h"

static int __init mddi_toshiba_wvga_init(void)
{
int ret;
struct msm_panel_info pinfo;

pinfo.xres = 800;
pinfo.yres = 480;
pinfo.pdest = DISPLAY_2;
pinfo.type = MDDI_PANEL;
pinfo.mddi.vdopkt = MDDI_DEFAULT_PRIM_PIX_ATTR;
pinfo.wait_cycle = 0;
pinfo.bpp = 18;
pinfo.lcd.vsync_enable = TRUE;
pinfo.lcd.refx100 = 6118;
pinfo.lcd.v_back_porch = 6;
pinfo.lcd.v_front_porch = 0;
pinfo.lcd.v_pulse_width = 0;
pinfo.lcd.hw_vsync_mode = FALSE;
pinfo.lcd.vsync_notifier_period = (1 * HZ);
pinfo.bl_max = 4;
pinfo.bl_min = 1;
pinfo.clk_rate = 192000000;
pinfo.clk_min = 190000000;
pinfo.clk_max = 200000000;
pinfo.fb_num = 2;

ret = mddi_toshiba_device_register(&pinfo, TOSHIBA_VGA_PRIM,
LCD_TOSHIBA_2P4_WVGA);
if (ret) {
printk(KERN_ERR "%s: failed to register device!\n", __func__);
return ret;
}

return ret;
}

module_init(mddi_toshiba_wvga_init)

No comments:

Post a Comment