TI am335x系列(am3352)LCD驅動修改移植
阿新 • • 發佈:2019-01-04
1、/arch/arm/mach-omap2/board-am335xevm.c/lcdc_init(){得到LCD硬體引數struct da8xx_lcdc_platform_data} -> am33xx_register_lcdc() -> omap_device_build() -> omap_device_build_ss() -> platform_device_add_data(){pdev->dev.platform_data = d}
2、platform_device端註冊過程:
omap_device_build_ss(){pdev = platform_device_alloc(pdev_name, pdev_id);} -> omap_device_register() -> platform_device_add()
3、platform_device裝置名確定過程:
am33xx_register_lcdc(){char *dev_name = "da8xx_lcdc";} -> omap_device_build() -> omap_device_build_ss(){pdev = platform_device_alloc(pdev_name, pdev_id);}
4、通過裝置名搜尋找到裝置驅動檔案: drivers/video/da8xx-fb.c
5、board-am335xevm.c記錄的屏的型別有:
.type = "TFC_S9700RTWV35TR_01B",
.type = "NHD-4.3-ATXI#-T-1",
da8xx-fb.c記錄的屏的型別有:
.name = "Sharp_LCD035Q3DG01",
.name = "Sharp_LK043T1DG01",
.name = "TFC_S9700RTWV35TR_01B",
.name = "NHD-4.3-ATXI#-T-1",
6、配置驅動程式進入fb_probe()獲取LCD硬體引數用於配置struct da8xx_lcdc_platform_data:
struct da8xx_lcdc_platform_data *fb_pdata = device->dev.platform_data;
7、匹配合適的屏,並輸出屏的型別(通過dmesg檢視匹配資訊是否正確),否則退出驅動:
{
if (i == ARRAY_SIZE(known_lcd_panels)) {
dev_err(&device->dev, "GLCD: No valid panel found\n");
ret = -ENODEV;
goto err_pm_runtime_disable;
} else
dev_info(&device->dev, "GLCD: Found %s panel\n",
fb_pdata->type);
}
8、fb_probe()接下來複位LCD並配置硬體引數,最後申請fb_info註冊framebuffer裝置
9、硬體資源設定:
am33xx_register_lcdc(){oh = omap_hwmod_lookup(oh_name);} -> omap_device_build(...struct omap_hwmod *oh,...){struct omap_hwmod *ohs[] = { oh };} -> omap_device_build_ss(...struct omap_hwmod **ohs,...) -> omap_device_alloc(...struct omap_hwmod **ohs,...){od->hwmods
= hwmods(來至於引數ohs);} -> omap_device_fill_resources(od, res){omap_hwmod_fill_resources(od->hwmods[i], res){填充 struct resource}} -> platform_device_add_resources(){pdev->resource = r;}
10、資源來源omap_hwmod:
omap_hwmod_lookup(oh_name) -> _lookup(name) -> 遍歷連結串列omap_hwmod_list並返回struct omap_hwmod
11、被返回的返回struct omap_hwmod來至於:
MACHINE_START -> am33xx_init_early() -> am33xx_hwmod_init() -> omap_hwmod_register(){將am33xx_lcdc_hwmod新增到omap_hwmod_list連結串列當中}
static struct omap_hwmod am33xx_lcdc_hwmod = {
......
.slaves = am33xx_lcdc_slaves,//記錄了物理起始地址
......
};
12、總結:兩個資料結構共同決定LCD控制暫存器的配置引數:
static struct lcd_ctrl_config lcd_cfg = {
&disp_panel,
.ac_bias = 255,
.ac_bias_intrpt = 0,
.dma_burst_sz = 16,
.bpp = 32,
.fdd = 0x80,
.tft_alt_mode = 0,
.stn_565_mode = 0,
.mono_8bit_mode = 0,
.invert_line_clock = 1,
.invert_frm_clock = 1,
.sync_edge = 0,
.sync_ctrl = 1,
.raster_order = 0,
};
static struct da8xx_panel known_lcd_panels[] = {
[2] = {
.name = "TFC_S9700RTWV35TR_01B",
.width = 800,
.height = 480,
.hfp = 39,
.hbp = 39,
.hsw = 47,
.vfp = 13,
.vbp = 29,
.vsw = 2,
.pxl_clk = 30000000,
.invert_pxl_clk = 0,
},
}