4.1. LCD 
参考文档: 
1) 80-NA157-174_E_DSI_Programing_Guide_B-Family_Android_Devices.pdf

2) 80-NN766-1_A_Linux_Android_Display_Driver_Porting_Guide.pdf

3) 80-NH713-1_F_DSI_Timing_Parameters.xlsm

LCD调试主要有三个任务: 
4.1.1. 供电 
➢ DSI供电 
8974芯片内部的DSI模块需要三个外部供电 
mdss_dsi0: qcom,mdss_dsi@fd922800 { 
compatible = “qcom,mdss-dsi-ctrl”; 
label = “MDSS DSI CTRL->0”; 
cell-index = <0>; 
reg = <0xfd922800 0x1f8>, 
<0xfd922b00 0x2b0>, 
<0xfdf30000 0x108>; 
reg-names = “dsi_ctrl”, “dsi_phy”, “mmss_misc_phys”; 
//vdd-supply = <&pm8941_l22>; 
vdd-supply = <&pm8941_lvs3>; // lvs3 is for LCD vddio, not for dsi 
vddio-supply = <&pm8941_l12>; 
vdda-supply = <&pm8941_l2>; 
但是,根据高通的参考原理图,只有两个供电vddio-supply, vdda-supply是需要的。其中lvs3是用来给LCD vddio供电,不是给dsi用的。 
➢ LCD供电 
根据原理图看看LCD需要哪些供电 
qcom,mdss_dsi@fd922800{ 
qcom,dsi-pref-prim-pan = <&dsi_jdi_1080_vid>; 
qcom,platform-disp-en-gpio = <&msmgpio 82 0>; 
qcom,platform-disp-ep-gpio = <&msmgpio 51 0>; 
}; 
这两个GPIO是用来控制供电的,AVDD,VDD。 
供电需要根据具体的原理图来改。 
➢ GPIO配置 
主要有两个GPIO需要配置,reset和te。根据原理图配置 
qcom,platform-reset-gpio = <&pm8941_gpios 19 0>; 
qcom,platform-te-gpio = <&msmgpio 12 0>; 
4.1.2. 背光 
根据不同类型的屏幕,选择不同的背光,一般TFT用WLED来做背光,OLED是自发光的,背光电路由屏上的驱动IC提供。

    qcom,leds@d800 {
        status = "okay";
        qcom,wled_0 {
            label = "wled";
            linux,name = "wled:backlight";
            linux,default-trigger = "bkl-trigger";
            qcom,cs-out-en;
            qcom,op-fdbck = <0>;
            qcom,default-state = "on";
            qcom,max-current = <20>;
            qcom,ctrl-delay-us = <0>;
            qcom,boost-curr-lim = <3>;
            qcom,cp-sel = <0>;
            qcom,switch-freq = <2>;
            qcom,ovp-val = <2>;
            qcom,num-strings = <2>;
            qcom,id = <0>;
        };
    };

需要注意max-current,高通默认是25mA,但是LCD芯片的数据手册里大部分是20mA。设置过高,会导致屏幕发烫,多耗电。 
4.1.3. LCD驱动 
LCD的驱动已经由Vendor厂商做好了,除了一些GPIO的配置可能需要加入到驱动文件,剩下的主要是制作LCD的配置文件。 
&mdss_mdp { 
dsi_jdi_1080_vid: qcom,mdss_dsi_jdi_1080p_video { 
qcom,mdss-dsi-panel-name = “jdi 1080p video mode dsi panel”; 
qcom,mdss-dsi-panel-controller = <&mdss_dsi0>; 
qcom,mdss-dsi-panel-type = “dsi_video_mode”;○1 
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 = <1080>; 
qcom,mdss-dsi-panel-height = <1920>; 
qcom,mdss-dsi-h-front-porch = <96>;○2 
qcom,mdss-dsi-h-back-porch = <64>; 
qcom,mdss-dsi-h-pulse-width = <16>; 
qcom,mdss-dsi-h-sync-skew = <0>; 
qcom,mdss-dsi-v-back-porch = <16>; 
qcom,mdss-dsi-v-front-porch = <4>; 
qcom,mdss-dsi-v-pulse-width = <1>; 
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-underflow-color = <0xff>; 
qcom,mdss-dsi-border-color = <0>; 
qcom,mdss-dsi-on-command = [15 01 00 00 00 00 02 55 00○3 
05 01 00 00 78 00 02 29 00 
05 01 00 00 78 00 02 11 00]; 
qcom,mdss-dsi-off-command = [05 01 00 00 02 00 02 28 00 
05 01 00 00 79 00 02 10 00]; 
qcom,mdss-dsi-on-command-state = “dsi_lp_mode”; 
qcom,mdss-dsi-off-command-state = “dsi_hs_mode”; 
qcom,mdss-dsi-h-sync-pulse = <0>; 
qcom,mdss-dsi-traffic-mode = “burst_mode”; 
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 = [e7 4f 26 00 7e 6a 2a 3a 2d 03 04 00];○4 
qcom,mdss-dsi-t-clk-post = <0x04>; 
qcom,mdss-dsi-t-clk-pre = <0x1b>; 
qcom,mdss-dsi-bl-min-level = <1>; 
qcom,mdss-dsi-bl-max-level = <4095>; 
qcom,mdss-dsi-dma-trigger = “trigger_sw”; 
qcom,mdss-dsi-mdp-trigger = “none”; 
qcom,mdss-dsi-bl-pmic-control-type = “bl_ctrl_wled”; 
qcom,mdss-dsi-reset-sequence = <1 20>, <0 200>, <1 20>; 
qcom,mdss-pan-physical-width-dimension = <61>; 
qcom,mdss-pan-physical-height-dimension = <110>; 
}; 
}; 
从LCD厂商提供的资料,确定○1panel type是video还是command。LCD厂商也会提供○2porch值和初始化序列○3mdss-dsi-on-command。但是厂商提供的初始化序列的格式可能不匹配,需要我们自己来改。 
○4panel timings是用一个表计算出来的80-NH713-1_F_DSI_Timing_Parameters.xlsm,这个excel文件需要office2010及以上版本的软件才能运行里面的宏。 
4.1.4. LK里的显示驱动 
LK的显示驱动默认是关闭的。LK的显示和Kernel里的是独立的,增加LK里的显示是为了更快的显示Logo,给用户更好的体验。Kernel里第一屏数据大概要7秒左右才能显示出来。 
1) 使能LK里的显示 
bootable/bootloader/lk/target/msm8974/rules.mk 
DEFINES += DISPLAY_SPLASH_SCREEN=1 0->1 
2) 生成驱动文件 
使用高通的GCDG工具可以生成dtsi和h文件用于kernel和lk。 
device/qcom/common/display/tools/ 
perl parser.pl panel_nt35590_720p_cmd.xml panel

注意这个parser.pl需要xml库,需要安装以下两个库才能使用:libxml2, libxml-libxml-perl。 
如果驱动正常,手机开机是会显示一个小企鹅的图标。 
4.1.5. 调试 
1) 闪屏,花屏 
调节Porch值 
2) 背光亮度,颜色,对比度等 
需要和屏厂一起调试