【平台信息】
芯片平台:SIM8950模组,基于高通SDM450平台,8核CortexA53 PM8953:电源管理+codec LCD屏幕:DriverIC —> TFT: ST7703I 分辨率:720× RGB×1280 LCM ID —> DAH:0x70 Interface —> MIPI 4 Lanes
缩略语 Display Serial Interface (DSI) MIPI Display Serial Interface (DSI V1.01 )
【硬件连接】
LCD_TFT CPU(SIM8950) 备注 1 LEDK P Backlight cathode. M_PWM(pin33) 连接SGM3759背光芯片 2 LEDA P Backlight anode. 同上 同上 4 TE O Tearing effect output M_GPIO_24(pin53) 5 ID I LCD ID NA 分压电阻,0.3V 6 RESET I Reset pin LCD0_RST_N(pin121) 8 VDDI1.8V P power supply 1.8V 1.8V 9 AVDD2.8V P power supply 2.8V 2.85V 10/12 D3P/D3N I MIPI DSI 3 lane pin143/pin144 13/14 D2P/D2N I MIPI DSI 2 lane pin141/pin142 17/18 CLKP/CLKN I MIPI DSI CLK pin135/pin136 20/21 D1P/D1N I MIPI DSI 1 lane pin139/pin140 23/24 D0P/D0N I/O MIPI DSI 0 lane pin137/pin138
【boot流程】
target_display_init
set_panel_cmd_string // 根据panel名称设置oem panel属性(未用到)
gcdb_display_init
oem_panel_select
lcd_select // 选择lcd id型号
// 如ST7703_720P_VIDEO_PANEL,对应panel_st7703_720p_video_sim.h
init_panel_data // 根据panel型号初始化参数和各回调函数
dsi_panel_init
msm_display_init
pdata->power_func(1, &(panel->panel_info)) // Turn on panel
pdata->dfps_func(&(panel->panel_info));
pdata->clk_func(1, &(panel->panel_info));
msm_display_config
msm_display_on
pdata->bl_func(1); // Turn on backlight
boot_linux_from_flash // 从flash引导内核
flash_read(ptn, offset, buf, page_size) // Read boot.img header from flash
memcpy(image_addr, (void *)buf, page_size); // copy kernel to ddr
boot_linux(kernel_addr, cmdline,...); // 引导内核
update_cmdline // 更新命令行,用于传入待启动的内核
target_display_panel_node // 解析panel_st7703_720p_video_sim.h对应的结构体
gcdb_display_cmdline_arg
mdss_dsi_get_panel_data
mdss_dsi_set_panel_node
panel_name_to_dt_string // 查表lookup_skip_panels,查询panel的dt名字
// 然后通过cmdline传递给内核,内核再解析查找panel dtsi
…
dprintf(INFO, "display kernel cmdline:%s\n", display_cmd_line);
//mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_lt8912_hdmi_video_sim:1:qcom,mdss_dsi_st7703_720p_video_sim2:cfg:dual_dsi
//dsi_id=dsi:0 panel_node=qcom,mdss_dsi_lt8912_hdmi_video_sim
【内核流程】
1、DTS设备树配置
参考文档:kernel\msm-3.18\Documentation\devicetree\bindings\fb\mdss-dsi-panel.txt kernel/msm-4.9/arch/arm64/boot/dts/qcom/dsi-panel-st7703-720p-video_sim.dtsi
&mdss_mdp {
dsi_st7703_720p_video_sim: qcom,mdss_dsi_st7703_720p_video_sim {
qcom,mdss-dsi-panel-name = "st7703 720p video mode dsi panel";
qcom,mdss-dsi-panel-controller = <&mdss_dsi0>;
qcom,mdss-dsi-panel-type = "dsi_video_mode";
qcom,mdss-dsi-panel-destination = "display_1";
qcom,mdss-dsi-panel-framerate = <60>;
qcom,mdss-dsi-virtual-channel-id = <0>;
qcom,mdss-dsi-stream = <0>;
qcom,mdss-dsi-panel-width = <720>;
qcom,mdss-dsi-panel-height = <1440>;
qcom,mdss-dsi-h-front-porch = <40>;
qcom,mdss-dsi-h-back-porch = <40>;
qcom,mdss-dsi-h-pulse-width = <10>;
qcom,mdss-dsi-h-sync-skew = <0>;
qcom,mdss-dsi-v-back-porch = <11>;
qcom,mdss-dsi-v-front-porch = <9>;
qcom,mdss-dsi-v-pulse-width = <3>;
qcom,mdss-dsi-h-left-border = <0>;
qcom,mdss-dsi-h-right-border = <0>;
qcom,mdss-dsi-v-top-border = <0>;
qcom,mdss-dsi-v-bottom-border = <0>;
qcom,mdss-dsi-bpp = <24>;
qcom,mdss-dsi-color-order = "rgb_swap_rgb";
qcom,mdss-dsi-underflow-color = <0xff>;
qcom,mdss-dsi-border-color = <0>;
qcom,cont-splash-enabled;
qcom,mdss-dsi-on-command = [...]
qcom,mdss-dsi-off-command = [...];
qcom,mdss-dsi-on-command-state = "dsi_lp_mode";
qcom,mdss-dsi-off-command-state = "dsi_hs_mode";
qcom,mdss-dsi-h-sync-pulse = <1>;
qcom,mdss-dsi-traffic-mode = "burst_mode";
qcom,mdss-dsi-lane-map = "lane_map_0123";
qcom,mdss-dsi-bllp-eof-power-mode;
qcom,mdss-dsi-bllp-power-mode;
qcom,mdss-dsi-lane-0-state;
qcom,mdss-dsi-lane-1-state;
qcom,mdss-dsi-lane-2-state;
qcom,mdss-dsi-lane-3-state;
qcom,mdss-dsi-panel-timings = [7A 1A 12 00 3E 42 16 1E 14 03 04 00];
qcom,mdss-dsi-t-clk-post = <0x04>;
qcom,mdss-dsi-t-clk-pre = <0x1A>;
qcom,mdss-dsi-dma-trigger = "trigger_sw";
qcom,mdss-dsi-mdp-trigger = "none";
qcom,mdss-dsi-bl-min-level = <1>;
qcom,mdss-dsi-bl-max-level = <255>;
qcom,mdss-dsi-reset-sequence = <1 20>, <0 2>, <1 120>;
qcom,mdss-dsi-panel-timings-phy-v2 = [...]
qcom,mdss-dsi-bl-pmic-control-type = "bl_ctrl_pwm"; ---》背光控制类型
qcom,mdss-dsi-bl-pmic-pwm-frequency = <100>;
qcom,mdss-dsi-bl-pmic-bank-select = <0>;
qcom,mdss-dsi-pwm-gpio = <&pm8953_mpps 4 0>; ---》背光pwm控制管脚配置
qcom,panel-supply-entries = <&dsi_panel_pwr_supply>;
...
kernel/msm-4.9/arch/arm64/boot/dts/qcom/msm8953-mtp.dtsi
#include "dsi-panel-st7703-720p-video_sim.dtsi"
#include "msm8953-mdss-panels.dtsi"
&mdss_dsi {
hw-config = "single_dsi";
};
&mdss_dsi0 {
qcom,dsi-pref-prim-pan = <&dsi_st7703_720p_video_sim>;
pinctrl-names = "mdss_default", "mdss_sleep";
pinctrl-0 = <&mdss_dsi_active &mdss_te_active>;
pinctrl-1 = <&mdss_dsi_suspend &mdss_te_suspend>;
qcom,platform-te-gpio = <&tlmm 24 0>;
qcom,platform-reset-gpio = <&tlmm 61 0>;
qcom,platform-bklight-en-gpio = <&tlmm 59 0>;
qcom,platform-downstream-device = <&mdss_sec_dsi0>;
qcom,dsi-panel-bias-vreg;
};
kernel\msm-4.9\arch\arm64\boot\dts\qcom\msm8953-mdss-panels.dtsi
&soc {
dsi_panel_pwr_supply: dsi_panel_pwr_supply {
#address-cells = <1>;
#size-cells = <0>;
qcom,panel-supply-entry@0 {
reg = <0>;
qcom,supply-name = "vdd";
qcom,supply-min-voltage = <2850000>;
qcom,supply-max-voltage = <2850000>;
qcom,supply-enable-load = <100000>;
qcom,supply-disable-load = <100>;
};
qcom,panel-supply-entry@1 {
reg = <1>;
qcom,supply-name = "vddio";
qcom,supply-min-voltage = <1800000>;
qcom,supply-max-voltage = <1800000>;
qcom,supply-enable-load = <100000>;
qcom,supply-disable-load = <100>;
};
qcom,panel-supply-entry@2 {
reg = <2>;
qcom,supply-name = "lab";
qcom,supply-min-voltage = <4600000>;
qcom,supply-max-voltage = <6000000>;
qcom,supply-enable-load = <100000>;
qcom,supply-disable-load = <100>;
};
qcom,panel-supply-entry@3 {
reg = <3>;
qcom,supply-name = "ibb";
qcom,supply-min-voltage = <4600000>;
qcom,supply-max-voltage = <6000000>;
qcom,supply-enable-load = <100000>;
qcom,supply-disable-load = <100>;
qcom,supply-post-on-sleep = <10>;
};
};
};
kernel\msm-4.9\arch\arm64\boot\dts\qcom\msm8953-mdss.dtsi
mdss_dsi: qcom,mdss_dsi@0 {
compatible = "qcom,mdss-dsi";
hw-config = "single_dsi";
#address-cells = <1>;
#size-cells = <1>;
gdsc-supply = <&gdsc_mdss>;
vdda-supply = <&pm8953_s3>;
vcca-supply = <&pm8953_l3>;
...
mdss_dsi0: qcom,mdss_dsi_ctrl0@1a94000 {
compatible = "qcom,mdss-dsi-ctrl";
label = "MDSS DSI CTRL->0";
cell-index = <0>;
reg = <0x1a94000 0x400>,
<0x1a94400 0x580>,
<0x193e000 0x30>;
reg-names = "dsi_ctrl", "dsi_phy", "mmss_misc_phys";
qcom,timing-db-mode;
qcom,mdss-mdp = <&mdss_mdp>;
vdd-supply = <&pm8953_l17>;
vddio-supply = <&pm8953_l6>;
clocks = <&clock_gcc_mdss clk_gcc_mdss_byte0_clk>,
<&clock_gcc_mdss clk_gcc_mdss_pclk0_clk>,
<&clock_gcc clk_gcc_mdss_esc0_clk>,
<&clock_gcc_mdss clk_byte0_clk_src>,
<&clock_gcc_mdss clk_pclk0_clk_src>,
<&mdss_dsi0_pll clk_dsi0pll_byte_clk_mux>,
<&mdss_dsi0_pll clk_dsi0pll_pixel_clk_mux>,
<&mdss_dsi0_pll clk_dsi0pll_byte_clk_src>,
<&mdss_dsi0_pll clk_dsi0pll_pixel_clk_src>,
<&mdss_dsi0_pll
clk_dsi0pll_shadow_byte_clk_src>,
<&mdss_dsi0_pll
clk_dsi0pll_shadow_pixel_clk_src>;
clock-names = "byte_clk", "pixel_clk", "core_clk",
"byte_clk_rcg", "pixel_clk_rcg",
"pll_byte_clk_mux", "pll_pixel_clk_mux",
"pll_byte_clk_src", "pll_pixel_clk_src",
"pll_shadow_byte_clk_src",
"pll_shadow_pixel_clk_src";
qcom,platform-strength-ctrl = [ff 06
ff 06
ff 06
ff 06
ff 00];
qcom,platform-regulator-settings = [1d
1d 1d 1d 1d];
qcom,platform-lane-config = [00 00 10 0f
00 00 10 0f
00 00 10 0f
00 00 10 0f
00 00 10 8f];
};
参考文档: kernel\msm-3.18\Documentation\devicetree\bindings\fb\mdss-dsi-panel.txt
2、内核驱动加载
mdss_dsi_ctrl_driver_init
mdss_dsi_ctrl_probe
mdss_dsi_pinctrl_init
mdss_dsi_config_panel
mdss_dsi_find_panel_of_node
mdss_dsi_panel_init
mdss_panel_parse_dt
mdss_panel_parse_display_timings
mdss_dsi_panel_timing_from_dt
mdss_dsi_parse_hdr_settings
mdss_dsi_parse_panel_features
mdss_panel_parse_bl_settings
dsi_panel_device_register
3、LCD背光驱动 背光设备树解析:
mdss_dsi_ctrl_probe() / kernel/msm-3.18/drivers/video/msm/mdss/mdss_dsi.c
|___mdss_panel_parse_bl_setting() / kernel/msm-3.18/drivers/video/msm/mdss/mdss_dsi_panel.c
设置背光亮度代码:
mdss_fb_probe() kernel/msm-3.18/drivers/video/msm/mdss/mdss_fb.c
|___mdss_fb_set_bl_brightness()
|___mdss_fb_set_brightness()
|___pdata->set_backlight()
|___ctrl_pdata->panel_data.set_backlight = mdss_dsi_panel_bl_ctrl()
mdss_dsi_panel_bl_ctrl() / kernel/msm-3.18/drivers/video/msm/mdss/mdss_dsi_panel.c
【参考资料】
1、原厂参考资料 《SIM8950 Series Display Driver Development Guide_V1.00.pdf》
2、如何通过cmdline获取panel型号的dtsi文件节点(qcom,lcd,id) https://blog.csdn.net/chenzhen1080/article/details/74762543
3、高通平台LCD开发 https://blog.csdn.net/ctx_ubuntu/article/details/89209940
4、高通平台点亮屏幕调试 https://blog.csdn.net/weixin_44981258/article/details/105218316?utm_medium=distribute.pc_relevant.none-task-blog-2defaultbaidujs_utm_term~default-8.pc_relevant_aa&spm=1001.2101.3001.4242.5&utm_relevant_index=11
|