04.lcm兼容

 C Code \kernel-4.9-lc\drivers\misc\mediatek\lcm\FX_K101_IM2BA02_MIPI\FX_K101_IM2BA02_MIPI.c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

static unsigned int lcm_compare_id(void)
{
    unsigned int lcd_id = 0;
    
    //unsigned int array[4]={0};
    unsigned char buffer[4]={0};
    
    char  id0=0;
    char  id1=0;
    
    unsigned int has_match = 0 ;    
    int i = 0;

    for(i=0; i<2; i++)
    {
        read_reg_v2(0x04,buffer, 2); 
        MDELAY(10);
        
        id0 = buffer[0];  //93 
        id1 = buffer[1];  //65
        
        lcd_id = (id0<<8)|id1;
        
        printf("[LK/LCM] FX_K101_IM2BA02_MIPI lcm_compare_id id0 = 0x%x,id1 = 0x%x,lcd_id = 0x%x\n", id0, id1, lcd_id);
        
        if(lcd_id == 0x9365){
            has_match = 1;
            printf("FX_K101_IM2BA02_MIPI match!!!!\n");
            break ;
        }
    }
    
#ifdef BUILD_LK
    printf("[LK/LCM] %s, lcd_id = 0x%08x\n", __func__, lcd_id);
#else
    printk("[LK/LCM] %s, lcd_id = 0x%08x\n", __func__, lcd_id);
#endif
   
   return has_match ;
}

注意驱动和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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

static const struct of_device_id lcm_of_ids[] = {
    {.compatible = "mediatek,FX_K101_IM2BA02-lcm",}, //"mediatek,mt6580-lcm"
    {}
};

static struct platform_driver lcm_driver = {
    .probe = lcm_platform_probe,
    .driver = {
           .name = "FX_K101_IM2BA02_MIPI",
           .owner = THIS_MODULE,
           //.probe = lcm_probe,
#ifdef CONFIG_OF
           .of_match_table = lcm_of_ids,
#endif
           },
};

 \kernel-4.9-lc\arch\arm\boot\dts\mt6580.dts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

/ {
    model = "MT6580";
    compatible = "mediatek,MT6580";
    interrupt-parent = <&gic>;
    #address-cells = <2>;
    #size-cells = <2>;
    
    bus: bus {
        compatible = "simple-bus";
        #address-cells = <1>;
        #size-cells = <1>;
        ranges = <0 0 0 0xffffffff>;
        
        FX_K101_IM2BA02_lcm: FX_K101_IM2BA02_lcm {
            compatible = "mediatek,FX_K101_IM2BA02-lcm";
        };
        ZS101NI4042J4H8IIB_lcm: ZS101NI4042J4H8IIB_lcm {
            compatible = "mediatek,ZS101NI4042J4H8IIB-lcm";
        };
    };
};

 \kernel-4.9-lc\arch\arm\boot\dts\tb8321p2_bsp.dts

1
2
3
4
5
6
7
8
9
10
11

&FX_K101_IM2BA02_lcm {
    gpio_lcm_rst = <&pio 70 0>;
    gpio_lcm_bl_en = <&pio 83 0>;
    reg-lcm-supply = <&mt_pmic_vgp1_ldo_reg>;
};

&ZS101NI4042J4H8IIB_lcm {
    gpio_lcm_rst = <&pio 70 0>;
    gpio_lcm_bl_en = <&pio 83 0>;
    reg-lcm-supply = <&mt_pmic_vgp1_ldo_reg>;
};

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
2
3
4

unsigned char buffer[4]={0};
read_reg_v2(0x04,buffer, 2);
id0 = buffer[0];  //93 
id1 = buffer[1];  //65

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
2
3
4
5
6
7
8
9

unsigned int data_array[16];
unsigned char buffer[4]={0};
data_array[0]=0x00023902;
data_array[1]=0x000000E0;
dsi_set_cmdq(data_array,2,1);
    
read_reg_v2(0x00,buffer, 1); //0x98
read_reg_v2(0x01,buffer, 1); //0x81
read_reg_v2(0x02,buffer, 1); //0x0C

或者直接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_MIPIBNS080B31_MIPIBNS080H049_MIPI
读ID前下参数NCNCNC
0x000x00 0x000x00 0x000x00 0x00
0x010x00 0x000x00 0x000x00 0x00
0x040x93 0x650x00 0x000xC2 0x84
0x050x00 0x000x00 0x000x00 0x00
读ID前下参数NC{0xFF, 3, {0x98,0x81,0x01}}{0xFF, 3, {0x98,0x81,0x01}}
0x000x00 0x000x98 0x980x98 0x98
0x010x00 0x000x81 0x810x81 0x81
0x040x93 0x650x00 0x000xC2 0xC2
0x050x00 0x000x00 0x000x84 0x84

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值