C Code \kernel-4.9-lc\drivers\misc\mediatek\lcm\FX_K101_IM2BA02_MIPI\FX_K101_IM2BA02_MIPI.c
1 | static unsigned int lcm_compare_id(void) |
注意驱动和dts里面的"mediatek,mt6580-lcm"都要改成两个独立的名字
否则一个驱动匹配了,另外一个驱动就不会跑proble了
C Code \kernel-4.9-lc\drivers\misc\mediatek\lcm\FX_K101_IM2BA02_MIPI\lcm_drv_FX_K101_IM2BA02_MIPI.c
1 | static const struct of_device_id lcm_of_ids[] = { |
\kernel-4.9-lc\arch\arm\boot\dts\mt6580.dts
1 | / { |
\kernel-4.9-lc\arch\arm\boot\dts\tb8321p2_bsp.dts
1 | &FX_K101_IM2BA02_lcm { |
9365:
lanes:
{0xE0, 1, {0x00}}
{0xE1, 1, {0x93}},
{0xE2, 1, {0x65}},
{0xE3, 1, {0xF8}},
{0x80, 1, {0x02}}, //0x03:4-lane; 0x02:3-lane;
bist:
{0xE0, 1, {0x01}},
{0x4A, 1, {0x35}}, //BIST MODE
id
1 | unsigned char buffer[4]={0}; |
9881C:
{0xFF, 3, {0x98,0x81,0x03}},
//CMD_Page 4
{0xFF, 3, {0x98,0x81,0x04}},
{0x00, 1, {0x00}}, //add for 3 lanes //或者{0x00, 2, {0x01,0x00}}
{0x2F, 1, {0x01}}, //BIST MODE //或者{0x2F, 2, {0x01,0x01}}
{0x3B, 1, {0xC0}}, //0x98 //PUMP SHIFT CLK 影响背光亮度
... ...
//CMD_Page 1
{0xFF,03,{0x98,81,01}},
... ...
{0xFF, 3, {0x98,0x81,0x00}},
id
1 | unsigned int data_array[16]; |
或者直接read_reg_v2(0x0A,buffer, 1); //0x08
有些9881的屏直接读不到ID,需要先下{0xFF, 3, {0x98,0x81,0x01}},
read_reg_v2(0x0A,buffer, 2); //LP模式和HP模式读出来的id还不一样
if(lcd_id == 0x0800 || lcd_id == 0x9c00){ //The LP mode read value is 08, and HP mode read value is 9c
如果读ID有冲突,可以配合硬件使用ADC方式:
IMM_GetOneChannelValue(xxx_chanel, &lcm_vol);
1287:
{0x00,1,{0x00}},
{0xFF,3,{0x12,0x87,0x01}},
{0x00,1,{0x80}},
{0xFF,2,{0x12,0x87}},
{0x00,1,{0x92}},
{0xFF,2,{0x20,0x02}},//MIPI 3 lanes
//SLP OUT
{0x11, 0, {0x00}},
{REGFLAG_DELAY, 100, {}},
//DISP ON
{0x29, 0, {0x00}},
{REGFLAG_DELAY, 200, {}},
//--- TE----//
//{0x35, 0, {0x00}},
//{REGFLAG_END_OF_TABLE, 0x00, {}}
F112:
{0xB9,3,{0xF1,0x12,0x84}},
//4 lanes: 0x33 3 lanes:0x32
{0xBA,27,{0x32,0x81,0x05,0xF9,0x0E,0x0E,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x25,0x00,0x91,0x0A,0x00,0x00,0x00,0x4F,0x01,0x00,0x00,0x37}},
---------------------------------------------------------------------------------------------------------------
示例:
SAT080AT31I21BH3_MIPI: 0x9365
BNS080B31_MIPI: 0x9881,需要下{0xFF, 3, {0x98,0x81,0x01}}才能读到ID
BNS080H049_MIPI: IC为0x9881,但IC厂将ID改成了0xC284,有意思的是下参数前后读出来的ID不一样
寄存器\屏名称 | SAT080AT31I21BH3_MIPI | BNS080B31_MIPI | BNS080H049_MIPI |
读ID前下参数 | NC | NC | NC |
0x00 | 0x00 0x00 | 0x00 0x00 | 0x00 0x00 |
0x01 | 0x00 0x00 | 0x00 0x00 | 0x00 0x00 |
0x04 | 0x93 0x65 | 0x00 0x00 | 0xC2 0x84 |
0x05 | 0x00 0x00 | 0x00 0x00 | 0x00 0x00 |
读ID前下参数 | NC | {0xFF, 3, {0x98,0x81,0x01}} | {0xFF, 3, {0x98,0x81,0x01}} |
0x00 | 0x00 0x00 | 0x98 0x98 | 0x98 0x98 |
0x01 | 0x00 0x00 | 0x81 0x81 | 0x81 0x81 |
0x04 | 0x93 0x65 | 0x00 0x00 | 0xC2 0xC2 |
0x05 | 0x00 0x00 | 0x00 0x00 | 0x84 0x84 |