一:背光配置
二:LK部分配置
三:Kernel部分配置
高通LCD背光: 有三种模式:
PWM mode :PMIC输出PWM控制背光芯片
DCS mode :通过MIPI配置LCM IC寄存器输出PWM
WLED mode :GPIO I2C等控制背光芯片
1.1 :bootloader(LK(litte kernel))部分修改:增加LCM供应商提供的(lcd显示驱动接口)文件时,要增加相应的背光配置:
确认背光模式:本项目是 WLED模式
/bootable/bootloader/lk/dev/gcdb/display/include/panel_otm1285a_auo_hd_video.h
static struct backlight otm1285a_auo_hd_video_backlight = {
1,1,255,100,0,0, //第一个位 0:PWM mode; 1:WLED mode; 2:DCS mode
};
确认引脚:/bootable/bootloader/lk/target/msm8909/include/target/display.h
static struct gpio_pin bkl_gpio
确认占空比 频率:
PWM mode : /bootable/bootloader/lk/target/msm8909/target_display.c
#define PWM_DUTY_US 13 //占空比
#define PWM_PERIOD_US 27 //频率?
WLED mode :lk/platform/msm_shared/mipi_dsi.c
static char lcm_pwm_cmd1[] = {
0x02, 0x00, 0x29, 0xC0,
0x51, 0x7F, 0xFF, 0xFF,
};
在背光入口函数: 修改增加背光芯片驱动控制, 例如GPIO控制
/bootable/bootloader/lk/target/msm8909/target_display.c
bkl_gpio.pin_id = 36; //背光控制引脚设定
1.2:kernel部分:增加LCM供应商提供的文件时,需要增加背光配置,参考硬件原理图和背光驱动芯片的PWM工作频率范围,在设备树中添加属性,比如frequecny,bank,gpio等等
/kernel/arch/arm/boot/dtsi/qom/msm8909-mtp.dtsi
//改成 pwm 或者 wled 或者 dcs 模式
&spi_gc9305_qvga_cmd {
qcom,mdss-spi-bl-pmic-control-type = "bl_ctrl_wled";//WLED mode
qcom,mdss-spi-bl-pmic-bank-select = <0>; //PWM BANK : 0
qcom,mdss-dsi-bl-pmic-pwm-frequency = <100>;
qcom,mdss-dsi-pwm-gpio = <&pm8909_mpps 2 0>;
qcom,cont-splash-enabled;
};
PWM MODEL:
驱动文件修改: MPP 2 配置为PWM 输出
/kernel/arch/arm/boot/dtsi/qom/msm8909-pm8909-mtp.dtsi
mpp@a100 { /* MPP 2 */
/* Backlight PWM */
qcom,mode = <1>; /* Digital output */
qcom,invert = <0>; /* Disable invert */
qcom,src-sel = <4>; /* DTEST1 */
qcom,vin-sel = <0>; /* VPH_PWR */
qcom,master-en = <1>; /* Enable MPP */
};
驱动文件修改: 配置PWM基础属性:
/kernel/arch/arm/boot/dtsi/msm-pm8909.dts
pm8909_pwm: pwm@bc00 {
compatible = "qcom,qpnp-pwm";//pwm 寄存器地址 偏移量
reg = <0xbc00 0x100>; //
reg-names = "qpnp-lpg-channel-base";
qcom,channel-id = <0>; //pwm通道ID
qcom,supported-sizes = <6>, <9>;//PWM 占空比
#pwm-cells = <2>;
};
WLED MODE:
修改DTS文件 : /kernel/arch/arm/boot/dtsi/qom/msm8909-mtp.dtsi
backlight_1wire:bklt-1wire {
compatible = "qcom,leds-gpio-bklt";
status = "disabled";
qcom,bklt-1wire = <&msm_gpio 15 0>;//36?
linux,name = "bklt-1wire";
linux,default-trigger = "bkl-trigger";
};
在目录 /kernel/drivers/leds 新增 leds-msm-bklt-wd3138.c
修改编译配置 /kernel/drivers/leds/Makefile : obj-$(CONFIG_LEDS_MSM_GPIO_FLASH) += leds-msm-bklt-wd3138.o
修改编译配置 /kernel/drivers/leds/Kconfig
/kernel/arch/arm/config/msm8909-1gb_defconfig : CONFIG_LEDS_WD3138 = y
2.1: 增加屏的初始化文件(供应商提供参数,自己按照平台格式添加初始化命令),以ST0281为例 :/bootable/bootloader/lk/dev/gcdb/display/include/panel_gc9305_qvga_spi_cmd.h
2.2: /boottable/bootloader/lk/target/msm8909/include/target/display.h : 修改设置 LCD 屏引脚参数
2.3: 增加本项目LCD屏选项 : /boottable/bootloader/lk/target/msm8909/oem_panel.c
增加头文件 : #include "include/panel_gc9305_qvga_spi_cmd.h"
在选择屏幕列表中添加 本项目LCD屏
enum {
HX8394D_480P_VIDEO_PANEL,
...
GC9305_QVGA_SPI_CMD_PANEL,
};
在panel list中添加 panel_name 和 panel_id
static struct panel_list supp_panels[] = {
...
{"gc9305_qvga_cmd", GC9305_QVGA_SPI_CMD_PANEL},
};
在 init_panel_data函数中添加 本项目LCD屏幕结构体初始化:
case GC9305_QVGA_SPI_CMD_PANEL:
panelstruct->paneldata = &gc9305_qvga_cmd_panel_data;
panelstruct->panelres = &gc9305_qvga_cmd_panel_res;
panelstruct->color = &gc9305_qvga_cmd_color;
panelstruct->panelresetseq= &gc9305_qvga_cmd_reset_seq;
panelstruct->backlightinfo = &gc9305_qvga_cmd_backlight;
pinfo->spi.panel_cmds = gc9305_qvga_cmd_on_command;
pinfo->spi.num_of_panel_cmds= GC9305_QVGA_CMD_ON_COMMAND;
pan_type = PANEL_TYPE_SPI;
break;
选择本项目LCD:
屏幕的自适应方式配置 oem_panel_select() :
if((280000 <= lcd_id)&&(lcd_id < 480000)) /* 0.38 */
panel_id = OTM1285A_AUO_HD_VIDEO_PANEL;
else
panel_id = ILI9881C_YUSUN_HD_VIDEO_PANEL;
panel_id = GC9305_QVGA_SPI_CMD_PANEL; //根据lcd_ID值范围实现自适应
添加屏幕驱动文件: /kernel/arch/arm/boot/dts/qcom/..添加 spi-panel-gc9305-qvga-cmd.dtsi
增加对屏幕的支持: /kernel/arch/arm/boot/dts/qcom/msm8909-mtp.dtsi 文件中增加对屏幕的支持
增加头文件 #include "spi-panel-gc9305-qvga-cmd.dtsi"
设置背光控制模式 :
&spi_gc9305_qvga_cmd {
qcom,mdss-spi-bl-pmic-control-type = "bl_ctrl_wled";
qcom,mdss-spi-bl-pmic-bank-select = <0>;
qcom,cont-splash-enabled;
};
。。。。。。。高通LCD移植大致思路以上,中间调试BUG 思路 结果 细节日后慢慢补充,以上。