零、点亮新lcm
1. 修改vendor\mediatek\proprietary\bootable\bootloader\lk\project\len6737m_35_m0.mk
CUSTOM_LK_LCM="rm68200_hd720_dsi_vdo"(该为指定LCM)
2. 修改kernel-3.18\arch\arm\configs\len6737m_35_m0_debug_defconfig、len6737m_35_m0_defconfig
CONFIG_CUSTOM_KERNEL_LCM="rm68200_hd720_dsi_vdo"(该为指定LCM)
CONFIG_LCM_HEIGHT="1280"
CONFIG_LCM_WIDTH="720"
3. 修改Y:\code2\mtk6737_pb5_1_0_cmcc\device\alibaba\b905_lezhou\ProjectConfig.mk
CONFIG_LCM_HEIGHT="1280"
CONFIG_LCM_WIDTH="720"
4. 添加驱动代码,放到kernel-3.18\drivers\misc\mediatek\lcm目录
创建文件夹rm68200_dsi_vdo_common文件夹中包含 rm68200_dsi_vdo_common.c、Makefile
5. 添加驱动代码,放到vendor\mediatek\proprietary\bootable\bootloader\lk\dev\lcm\目录
创建文件夹rm68200_dsi_vdo_common文件夹中包含 rm68200_dsi_vdo_common.c、Makefile
6. 修改kernel-3.18\drivers\misc\mediatek\lcm\mt65xx_lcm_list.h
+ extern LCM_DRIVER rm68200_hd720_dsi_vdo_lcm_drv;
修改kernel-3.18\drivers\misc\mediatek\lcm\mt65xx_lcm_list.c
+ #if defined(RM68200_HD720_DSI_VDO)
+ &rm68200_hd720_dsi_vdo_lcm_drv,
+ #endif
7. 修改vendor\mediatek\proprietary\bootable\bootloader\lk\dev\lcm\mt65xx_lcm_list.c
+ extern LCM_DRIVER rm68200_hd720_dsi_vdo_lcm_drv;
+ #if defined(RM68200_HD720_DSI_VDO)
+ &rm68200_hd720_dsi_vdo_lcm_drv,
+ #endif
8. 修改驱动代码...\lcm\rm68200_dsi_vdo_common\rm68200_dsi_vdo_common.c
通常客户只给一个初始化代码,需要将其修改成数组格式 - 使用Emeditor,正则表达式
8.1 客户给的格式:
GP_COMMAD_PA(3); //下面SPI_WriteData()三次
SPI_WriteData(0xed);SPI_WriteData(0x60);SPI_WriteData(0x10);
8.2 改成我们需要的格式(SPI_WriteData 先写地址再写数据,跟I2C一样):
{0xed, 2,{0x60, 0x10}},
8.3 ---->以下不改
{0x11,1,{0x00}}, // sleep-out
{REGFLAG_DELAY, 120, {}},
{0x29,1,{0x00}}, // display-on
{REGFLAG_DELAY, 10, {}},
{REGFLAG_END_OF_TABLE, 0x00, {}}
8.4 修改mipi通道数
params->dsi.LANE_NUM = LCM_THREE_LANE; // LCM_FOUR_LANE; -- 根据实际模组打样来配置(询问FAE得知)
-- 通常fwvga为2 hd为3/4,fhd为4(分辨率高的mipi通道数多)
-- 同为hd,3路mipi要比4路mipi的时钟高一些
8.5 屏的参数
以下为常修改值--FAE提供--可以由数据手册算出
params->dsi.vertical_sync_active = 3;
params->dsi.vertical_backporch = 12; //后沿
params->dsi.vertical_frontporch = 8; //前沿
params->dsi.vertical_active_line = FRAME_HEIGHT;
params->dsi.horizontal_sync_active = 2;
params->dsi.horizontal_backporch = 28; // 修改前后沿也能影响闪屏效果
params->dsi.horizontal_frontporch = 50;
params->dsi.horizontal_active_pixel = FRAME_WIDTH;
8.6 兼容
-- 系统通过读ID进行兼容,如果只配了一个屏则不读ID
-- 点亮新屏的时候,可以先不兼容,或先把读ID函数写死return 1
#define LCM_ID 0x6820
lcm_compare_id(void){
...
return (LCM_ID == id)?1:0; // 点新屏时可写死 return 1;
}
一、常用调试方法:
1. 查看机器中lcm型号:
adb shell
cat /proc/cmdline // androidN 没有
// 自行添加
alps/vendor/mediatek/proprietary/bootable/bootloader/lk/app/mt_boot/mt_boot.c
- //#define SERIAL_NUM_FROM_BARCODE
+ #define SERIAL_NUM_FROM_BARCODE
int boot_linux_from_storage(void)
+ snprintf(cmdline_tmpbuf, CMDLINE_TMP_CONCAT_SIZE, "lcm=%1d-%s", DISP_IsLcmFound(), mt_disp_get_lcm_id());
+ cmdline_append(cmdline_tmpbuf);
+ snprintf(cmdline_tmpbuf, CMDLINE_TMP_CONCAT_SIZE, "fps=%1d", mt_disp_get_lcd_time());
+ cmdline_append(cmdline_tmpbuf);
+ snprintf(cmdline_tmpbuf, CMDLINE_TMP_CONCAT_SIZE, "vram=%1d", DISP_GetVRamSize());
+ cmdline_append(cmdline_tmpbuf);
2. 查看系统分辨率
cat /system/build.prop | grep lcd_density // 得“240”
3. 修改系统分辨率
device\lentek\len6737t_35g_m0\system.prop
ro.sf.lcd_density=240 // 240就是系统的分辨率--可以通过修改这个值(参考其他工程)
4. 闪屏
修改kernel-3.18\drivers\misc\mediatek\lcm\rm68200_dsi_vdo_common\rm68200_dsi_vdo_common.c
params->dsi.PLL_CLOCK = 200; //200~240;修改这个值
二、屏的分辨率
fwvga -- 856*480
hd/hd720 -- 1280*720
fhd -- 1920*1080
驱动中
#define FRAME_WIDTH (720)
#define FRAME_HEIGHT (1280)
三、相同ic的lcm做兼容 - 不通模组厂的模组可以通过内置电阻不通,而使lcm的ID脚输出电压不同,把ID脚接到PMU上,lcm_compare_id()时通过PMU读取电压值,根据电压值做判断
0 - 0v
470k - 0.2~0.3v
150k - 0.7~0.8v
51k - 1.2~1.3v
1. 查看硬件原理图,可知lcm的ID脚“AUX_IN1_LCD_ID” 连接在pmu的“AUX_IN1”脚
2. 修改驱动, 主要是lcm_compare_id():
+ #define AUXADC_LCM_VOLTAGE_CHANNEL 1 // 根据原理图,lcm的ID脚接在pmu的“AUX_IN1”脚,所以是1
/* 根据mtk-online 不只屏,accdet也会用到
AUX_IN0 -- channel 0
AUX_IN1 -- channel 1
AUX_IN2 -- channel 12
AUX_IN3 -- channel 13
AUX_IN4 -- channel 14
*/
+ extern int IMM_GetOneChannelValue(int dwChannel, int data[4], int* rawdata);
static unsigned int lcm_compare_id(void)
{
+ int data[4] = {0,0,0,0};
+ int rawdata = 0;
+ int lcm_vol = 0;
+ int res = 0;
unsigned int id = 0;
unsigned char buffer[3];
unsigned int array[16];
SET_RESET_PIN(1); //NOTE:should reset LCM firstly
MDELAY(6);
SET_RESET_PIN(0);
MDELAY(6);
SET_RESET_PIN(1);
MDELAY(50);
+ #ifdef AUXADC_LCM_VOLTAGE_CHANNEL
+ res = IMM_GetOneChannelValue(AUXADC_LCM_VOLTAGE_CHANNEL,data,&rawdata); // 通过PMU读取电压值,根据电压值做判断
+ if(res < 0)
+ {
+ #ifdef BUILD_LK
+ printf("[adc_uboot]: get data error\n");
+ #endif
+ return 0;
+ }
+ #endif
+ lcm_vol = data[0]*1000+data[1]*10;
array[0] = 0x00043902;// read id return two byte,version and id
array[1] = 0xf36192df;
dsi_set_cmdq(array, 2, 1);
MDELAY(10);
array[0] = 0x00023700;
dsi_set_cmdq(array, 1, 1);
read_reg_v2(0xDF, buffer, 2);
id = buffer[0]<<8 | buffer[1]; //we only need ID
#if defined (BUILD_LK)
printf("jd9261_hsd_qhd_dsi_vdo, id = 0x%08x\n", id);
#else
printk("jd9261_hsd_qhd_dsi_vdo, id = 0x%08x\n", id);
#endif
- return (id == 0x9261)?1:0;
+ return ((id == 0x9261) && (lcm_vol < 1000)) ? 1 : 0; // lcm模组1 读出来是:880mv
或者 return ((id == 0x9261) && (lcm_vol > 1000)) ? 1 : 0; // lcm模组2 读出来是:1170mv
}
四、打开ESD - 打静电的时候出现花屏(按电源键休眠再唤醒才会恢复正常)
1. 在lcm的驱动中的添加 - 【验证为无效】
static void lcm_get_params(LCM_PARAMS * params)
{
...
params->dsi.esd_check_enable = 1;
params->dsi.customization_esd_check_enable = 1;
params->dsi.lcm_esd_check_table[0].cmd = 0x0a;
params->dsi.lcm_esd_check_table[0].count = 1;
params->dsi.lcm_esd_check_table[0].paralist[0] = 0x9c;
2. 验证有效的方法
五、如何计算帧率(刷新频率)
1. LCD 刷新率 控制在50fps-65fps,须通过fps工具(svn->com.edburnette.fps2d_4.apk)
2. 由公式计算,apk 会比 公式 低几个fps(如算出60fps,apk实测约58fps)
公式:
mtk : PLL_CLOCK = (height + vsa + vbp + vfp) * (width + hsa + hbp + hfp) * 24 * fps / lane / 2
展讯: PLL_CLOCK = (height + vsa + vbp + vfp) * (width + hsa + hbp + hfp) * 24 * fps / lane
高通: PLL_CLOCK = (height + vsa + vbp + vfp) * (width + hsa + hbp + hfp) * 24 * fps
3. 修改 params->dsi.PLL_CLOCK=200; // 246
4. 帧率的高低会影响:只亮背光、GPS、闪屏、功耗、射频、wifi等
5. PLL_CLOCK 过GMS要求60~65
六、如何调整上下颠倒
1. 若支持反扫,修改驱动初始化数组【未验证】
通用寄存器(加在11 29前面):
{0x36, 1, {0x03}},
{0x37, 1, {0x09}}, // 正扫
{0x37, 1, {0x05}}, // 反扫
9369:【k27】
{0xC1,2,{0x00,0x12}}, // 0x12->0x0A rotation 180;(D4;D3)
2. 若不支持,翻转系统:(开机logo的第一张会是倒的,需要把图片翻转)
lk:
vendor/mediatek/proprietary/bootable/bootloader/lk/project/magc6737m_65_n.mk
MTK_LCM_PHYSICAL_ROTATION=180
kernel:
kernel-3.18/arch/arm64/configs/magc6737m_65_n_debug_defconfig
CONFIG_MTK_LCM_PHYSICAL_ROTATION="180"
system:
device/magcomm/magc6737m_65_n/ProjectConfig.mk
MTK_LCM_PHYSICAL_ROTATION=180
七、如何控制gpio口
1. dtsi中 添加节点"mtkfb1":
/ {
soc {
+ mtkfb1: mtkfb1@5e200000 {
+ compatible = "mediatek,mtkfb1";
+ reg = <0x7F000000 0x1000000>;
+ };
2. dts中填充节点"mtkfb1":
/* DISPSYS GPIO standardization */
&pio {
mtkfb_pins_lcm_1_8v_en_out0_gpio: lcm_1_8v_en_out0_gpio {
pins_cmd_dat {
pins = ;
slew-rate = <1>;
output-low;
};
};
mtkfb_pins_lcm_1_8v_en_out1_gpio: lcm_1_8v_en_out1_gpio {
pins_cmd_dat {
pins = ;
slew-rate = <1>;
output-high;
};
};
mtkfb_pins_lcm_2_5v_en_out0_gpio: lcm_2_5v_en_out0_gpio {
pins_cmd_dat {
pins = ;
slew-rate = <1>;
output-low;
};
};
mtkfb_pins_lcm_2_5v_en_out1_gpio: lcm_2_5v_en_out1_gpio {
pins_cmd_dat {
pins = ;
slew-rate = <1>;
output-high;
};
};
mtkfb_pins_lcm_3_3v_en_out0_gpio: lcm_3_3v_en_out0_gpio {
pins_cmd_dat {
pins = ;
slew-rate = <1>;
output-low;
};
};
mtkfb_pins_lcm_3_3v_en_out1_gpio: lcm_3_3v_en_out1_gpio {
pins_cmd_dat {
pins = ;
slew-rate = <1>;
output-high;
};
};
mtkfb_pins_default: default {
};
};
&mtkfb1 {
pinctrl-names = "default", "lcm_1_8v_en_out0_gpio", "lcm_1_8v_en_out1_gpio", "lcm_2_5v_en_out0_gpio", "lcm_2_5v_en_out1_gpio", "lcm_3_3v_en_out0_gpio", "lcm_3_3v_en_out1_gpio";
pinctrl-0 = <&mtkfb_pins_default>;
pinctrl-1 = <&mtkfb_pins_lcm_1_8v_en_out0_gpio>;
pinctrl-2 = <&mtkfb_pins_lcm_1_8v_en_out1_gpio>;
pinctrl-3 = <&mtkfb_pins_lcm_2_5v_en_out0_gpio>;
pinctrl-4 = <&mtkfb_pins_lcm_2_5v_en_out1_gpio>;
pinctrl-5 = <&mtkfb_pins_lcm_3_3v_en_out0_gpio>;
pinctrl-6 = <&mtkfb_pins_lcm_3_3v_en_out1_gpio>;
status = "okay";
};
/* DISPSYS GPIO standardization end */
3. dws配置pin脚:
EintMode|Def.Mode M0|M1|M2|M3|M4|M5|M6|M7|InPull En|InPull SelHigh|Def.Dir|In|Out|OutHigh|VarName1
GPIO61 0:GPIO61 1 0 0 OUT 0 1 0 GPIO_LCM_PWR2_EN
GPIO63 0:GPIO63 1 0 0 OUT 0 1 0 GPIO_LCM_PWR_EN
GPIO64 0:GPIO64 1 0 0 OUT 0 1 0 GPIO_LCM_BL_EN
4. 驱动中: 在读ID 和初始化之前要上电操作
static unsigned int lcm_compare_id(void)
lcd_power_en(1);
static void lcm_init(void)
lcd_power_en(1);
static void lcm_suspend(void)
lcd_power_en(0);
static void lcd_power_en(unsigned char enabled)
{
if (enabled)
{
#ifdef BUILD_LK
mt_set_gpio_mode(GPIO_LCM_PWR2_EN, GPIO_MODE_00); //ldo1.8V
mt_set_gpio_dir(GPIO_LCM_PWR2_EN, GPIO_DIR_OUT);
mt_set_gpio_out(GPIO_LCM_PWR2_EN, GPIO_OUT_ONE);
MDELAY(10);
mt_set_gpio_mode(GPIO_LCM_BL_EN, GPIO_MODE_00); //ldo2.5V
mt_set_gpio_dir(GPIO_LCM_BL_EN, GPIO_DIR_OUT);
mt_set_gpio_out(GPIO_LCM_BL_EN, GPIO_OUT_ONE);
MDELAY(10);
mt_set_gpio_mode(GPIO_LCM_PWR_EN, GPIO_MODE_00); //ldo3.3V
mt_set_gpio_dir(GPIO_LCM_PWR_EN, GPIO_DIR_OUT);
mt_set_gpio_out(GPIO_LCM_PWR_EN, GPIO_OUT_ONE);
#else
mt_lcm_ldo_set_gpio(1); // kernel中通过DTS控制gpio
#endif
}
else // disable
{
#ifdef BUILD_LK
mt_set_gpio_mode(GPIO_LCM_PWR2_EN, GPIO_MODE_00); //ldo1.8V
mt_set_gpio_dir(GPIO_LCM_PWR2_EN, GPIO_DIR_OUT);
mt_set_gpio_out(GPIO_LCM_PWR2_EN, GPIO_OUT_ZERO);
MDELAY(10);
mt_set_gpio_mode(GPIO_LCM_BL_EN, GPIO_MODE_00); //ldo2.5V
mt_set_gpio_dir(GPIO_LCM_BL_EN, GPIO_DIR_OUT);
mt_set_gpio_out(GPIO_LCM_BL_EN, GPIO_OUT_ZERO);
MDELAY(10);
mt_set_gpio_mode(GPIO_LCM_PWR_EN, GPIO_MODE_00); //ldo3.3V
mt_set_gpio_dir(GPIO_LCM_PWR_EN, GPIO_DIR_OUT);
mt_set_gpio_out(GPIO_LCM_PWR_EN, GPIO_OUT_ZERO);
#else
mt_lcm_ldo_set_gpio(0); // kernel中通过DTS控制gpio
#endif
}
}
#ifndef BUILD_LK
struct platform_device *lcm_ldo_dev;
struct pinctrl *lcm_ldo_pinctrl;
struct device_node *lcm_ldo_node;
struct pinctrl_state *pinctrl_lcm_1_8v_en_low;
struct pinctrl_state *pinctrl_lcm_1_8v_en_high;
struct pinctrl_state *pinctrl_lcm_2_5v_en_low;
struct pinctrl_state *pinctrl_lcm_2_5v_en_high;
struct pinctrl_state *pinctrl_lcm_3_3v_en_low;
struct pinctrl_state *pinctrl_lcm_3_3v_en_high;
void nlcm_ldo_get_gpio_pinctrl(void)
{
int ret = 0;
lcm_ldo_node = of_find_compatible_node(NULL, NULL, "mediatek,mtkfb1");
if (lcm_ldo_node == NULL) {
pr_err("LCM_LDO- get LCM_LDO node failed\n");
}
lcm_ldo_dev = of_find_device_by_node(lcm_ldo_node);
if(lcm_ldo_dev == NULL)
return ;
lcm_ldo_pinctrl = devm_pinctrl_get(&lcm_ldo_dev->dev);
if (IS_ERR(lcm_ldo_pinctrl)) {
dev_err(&lcm_ldo_dev->dev, "Cannot find usb lcm_ldo_pinctrl!\n");
}
pr_debug("****%s:%d nlcm_ldo_get_gpio_pinctrl !!!!!\n", __func__, __LINE__);
pinctrl_lcm_1_8v_en_low = pinctrl_lookup_state(lcm_ldo_pinctrl, "lcm_1_8v_en_out0_gpio");
if (IS_ERR(pinctrl_lcm_1_8v_en_low)) {
ret = PTR_ERR(pinctrl_lcm_1_8v_en_low);
printk("Cannot find lcm_1_8v_en_out0_gpio\n");
}
pinctrl_lcm_1_8v_en_high = pinctrl_lookup_state(lcm_ldo_pinctrl, "lcm_1_8v_en_out1_gpio");
if (IS_ERR(pinctrl_lcm_1_8v_en_high)) {
ret = PTR_ERR(pinctrl_lcm_1_8v_en_high);
printk("Cannot find lcm_1_8v_en_out1_gpio\n");
}
pinctrl_lcm_2_5v_en_low = pinctrl_lookup_state(lcm_ldo_pinctrl, "lcm_2_5v_en_out0_gpio");
if (IS_ERR(pinctrl_lcm_2_5v_en_low)) {
ret = PTR_ERR(pinctrl_lcm_2_5v_en_low);
printk("Cannot find lcm_2_5v_en_out0_gpio\n");
}
pinctrl_lcm_2_5v_en_high = pinctrl_lookup_state(lcm_ldo_pinctrl, "lcm_2_5v_en_out1_gpio");
if (IS_ERR(pinctrl_lcm_2_5v_en_high)) {
ret = PTR_ERR(pinctrl_lcm_2_5v_en_high);
printk("Cannot find lcm_2_5v_en_out1_gpio\n");
}
pinctrl_lcm_3_3v_en_low = pinctrl_lookup_state(lcm_ldo_pinctrl, "lcm_3_3v_en_out0_gpio");
if (IS_ERR(pinctrl_lcm_3_3v_en_low)) {
ret = PTR_ERR(pinctrl_lcm_3_3v_en_low);
printk("Cannot find lcm_3_3v_en_out0_gpio\n");
}
pinctrl_lcm_3_3v_en_high = pinctrl_lookup_state(lcm_ldo_pinctrl, "lcm_3_3v_en_out1_gpio");
if (IS_ERR(pinctrl_lcm_3_3v_en_high)) {
ret = PTR_ERR(pinctrl_lcm_3_3v_en_high);
printk("Cannot find lcm_3_3v_en_out1_gpio\n");
}
pr_debug("****%s:%d end Init Drive NLEDS KS!!!!!\n", __func__, __LINE__);
}
int mt_lcm_ldo_set_gpio( unsigned int level)
{
nlcm_ldo_get_gpio_pinctrl(); // 从dts中获取gpio的控制pin脚
if (level == 0)
{
pinctrl_select_state(lcm_ldo_pinctrl, pinctrl_lcm_1_8v_en_low);
MDELAY(10);
pinctrl_select_state(lcm_ldo_pinctrl, pinctrl_lcm_2_5v_en_low);
MDELAY(10);
pinctrl_select_state(lcm_ldo_pinctrl, pinctrl_lcm_3_3v_en_low);
}
else
{
pinctrl_select_state(lcm_ldo_pinctrl, pinctrl_lcm_1_8v_en_high);
MDELAY(10);
pinctrl_select_state(lcm_ldo_pinctrl, pinctrl_lcm_2_5v_en_high);
MDELAY(10);
pinctrl_select_state(lcm_ldo_pinctrl, pinctrl_lcm_3_3v_en_high);
}
return 0;
}
#endif
案例一 : 机器温升超标 - 修改lcm亮度为70%
平台: androidM,MTK6580
步骤: 1. 修改alps\kernel-3.18\drivers\misc\mediatek\leds\mt6580\leds.c
mt_mt65xx_led_set()中
level = level*70/100; // 改为70%
mt_mt65xx_led_set_cust(level) // 在此之前 或 disp_aal_notify_backlight_changed(
案例二 : lcm上有升压IC,需要将enable脚拉高
现象 :
平台 : androidN,MTK6737
排查过程: 1. 根据原理图,找到enable脚接到GPIO129
2. 配置GPIO129(DTS & DWS)
2.1 dtsi中 添加节点"mtkfb1":
/ {
soc {
+ mtkfb1: mtkfb1@0 {
+ compatible = "mediatek,mtkfb1";
+ };
2.2 dts中填充节点"mtkfb1":
/* DISPSYS GPIO standardization */
&pio {
mtkfb1_pins_lcm_1_8v_en_out0_gpio: lcm_1_8v_en_out0_gpio {
pins_cmd_dat {
pins = ;
slew-rate = <1>;
output-low;
};
};
mtkfb1_pins_lcm_1_8v_en_out1_gpio: lcm_1_8v_en_out1_gpio {
pins_cmd_dat {
pins = ;
slew-rate = <1>;
output-high;
};
};
mtkfb1_pins_default: default {
};
};
&mtkfb1 {
pinctrl-names = "default", "lcm_1_8v_en_out0_gpio", "lcm_1_8v_en_out1_gpio";
pinctrl-0 = <&mtkfb1_pins_default>;
pinctrl-1 = <&mtkfb1_pins_lcm_1_8v_en_out0_gpio>;
pinctrl-2 = <&mtkfb1_pins_lcm_1_8v_en_out1_gpio>;
status = "okay";
};
/* DISPSYS GPIO standardization end */
2.3 dws配置pin脚:
EintMode|Def.Mode M0|M1|M2|M3|M4|M5|M6|M7|InPull En|InPull SelHigh|Def.Dir|In|Out|OutHigh|VarName1
GPIO129 0:GPIO129 1 0 0 OUT 0 1 0 GPIO_LCM_BL_EN
3. 驱动:
static unsigned int lcm_compare_id(void)
lcd_power_en(1);
static void lcm_init(void)
lcd_power_en(1);
static void lcm_suspend(void)
lcd_power_en(0);
static void lcd_power_en(unsigned char enabled)
{
if (enabled)
{
#ifdef BUILD_LK
MDELAY(10);
mt_set_gpio_mode(GPIO_LCM_BL_EN, GPIO_MODE_00);
mt_set_gpio_dir(GPIO_LCM_BL_EN, GPIO_DIR_OUT);
mt_set_gpio_out(GPIO_LCM_BL_EN, GPIO_OUT_ONE);
#else
mt_lcm_ldo_set_gpio(1);
#endif
}
else
{
#ifdef BUILD_LK
mt_set_gpio_mode(GPIO_LCM_BL_EN, GPIO_MODE_00);
mt_set_gpio_dir(GPIO_LCM_BL_EN, GPIO_DIR_OUT);
mt_set_gpio_out(GPIO_LCM_BL_EN, GPIO_OUT_ZERO);
#else
mt_lcm_ldo_set_gpio(0);
#endif
}
}
#ifndef BUILD_LK //#ifdef CONFIG_OF
struct platform_device *lcm_ldo_dev;
struct pinctrl *lcm_ldo_pinctrl;
struct device_node *lcm_ldo_node;
struct pinctrl_state *pinctrl_lcm_1_8v_en_low;
struct pinctrl_state *pinctrl_lcm_1_8v_en_high;
void nlcm_ldo_get_gpio_pinctrl(void)
{
int ret = 0;
lcm_ldo_node = of_find_compatible_node(NULL, NULL, "mediatek,mtkfb1");
if (lcm_ldo_node == NULL) {
pr_err("LCM_LDO- get LCM_LDO node failed\n");
}
lcm_ldo_dev = of_find_device_by_node(lcm_ldo_node);
if(lcm_ldo_dev == NULL)
return ;
lcm_ldo_pinctrl = devm_pinctrl_get(&lcm_ldo_dev->dev);
if (IS_ERR(lcm_ldo_pinctrl)) {
dev_err(&lcm_ldo_dev->dev, "Cannot find usb lcm_ldo_pinctrl!\n");
}
pr_debug("****%s:%d nlcm_ldo_get_gpio_pinctrl !!!!!\n", __func__, __LINE__);
pinctrl_lcm_1_8v_en_low = pinctrl_lookup_state(lcm_ldo_pinctrl, "lcm_1_8v_en_out0_gpio");
if (IS_ERR(pinctrl_lcm_1_8v_en_low)) {
ret = PTR_ERR(pinctrl_lcm_1_8v_en_low);
printk("Cannot find lcm_1_8v_en_out0_gpio\n");
}
pinctrl_lcm_1_8v_en_high = pinctrl_lookup_state(lcm_ldo_pinctrl, "lcm_1_8v_en_out1_gpio");
if (IS_ERR(pinctrl_lcm_1_8v_en_high)) {
ret = PTR_ERR(pinctrl_lcm_1_8v_en_high);
printk("Cannot find lcm_1_8v_en_out1_gpio\n");
}
pr_debug("****%s:%d end Init Drive NLEDS KS!!!!!\n", __func__, __LINE__);
}
int mt_lcm_ldo_set_gpio( unsigned int level)
{
nlcm_ldo_get_gpio_pinctrl();
if (level == 0)
{
pinctrl_select_state(lcm_ldo_pinctrl, pinctrl_lcm_1_8v_en_low);
}
else
{
pinctrl_select_state(lcm_ldo_pinctrl, pinctrl_lcm_1_8v_en_high);
}
return 0;
}
#endif
处理方案:
总结 :
案例三 : 开机lk过后,开机动画之前会闪屏 - 关闭esd check
现象 : 连续闪6下后正常
平台 : android,MTK6737
排查过程: 1. 检查lcm驱动中是否有打开esd check函数 - 否
2. 关闭读id - 去掉兼容的其他lcm - 还是闪
3. 在初始化数组中关闭esd check - ok
st7703_hd_dsi_vdo_common.c
lcm_initialization_setting[] = {
- {0xBa,27,{0x32,0x81,0x05,0xF9,0x0e,0x0e,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x25,0x00,0x91,0x0a,0x00,0x00,0x02,0x4F,0x11,0x00,0x00,0x37}},// 0x11
+ {0xBa,27,{0x32,0x81,0x05,0xF9,0x0e,0x0e,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x25,0x00,0x91,0x0a,0x00,0x00,0x02,0x4F,0x01,0x00,0x00,0x37}},// 0x01
处理方案:
总结 :
案例四 : 开机花屏 - 修改lcm时序
现象 : 合入供应商提供的lcm初始化数组,背光亮了,但是花屏
平台 : androidO,MTK6737
排查过程: 1. fae来现场调试,无果,带了一块屏回去。回去之后多方尝试后提供一组时序
params->dsi.vertical_sync_active = 8;
params->dsi.vertical_backporch = 37;
params->dsi.vertical_frontporch = 65;
params->dsi.horizontal_sync_active = 14;
params->dsi.horizontal_backporch = 25;
params->dsi.horizontal_frontporch = 45;
合入之后顺利点亮,但是还有花屏现象,等fae现场优化
2.
3.
处理方案: 少数屏对时序要求很严格,这组数据并非从数据手册能算出,而是要根据搭配的玻璃,凭经验去尝试(fae说话,带验证)
总结 :
案例五 : 开机logo的第一张会是倒的,第二张开机logo和开机动画均正常显示
现象 :
平台 : androidO,MTK6739
排查过程: 1. vendor/mediatek/proprietary/bootable/bootloader/lk/project/k39tv1_bsp_1g.mk
- DEFINES += MTK_LCM_PHYSICAL_ROTATION_HW
+ #DEFINES += MTK_LCM_PHYSICAL_ROTATION_HW