lcd comaptible

https://blog.csdn.net/skyxiaojt/article/details/79174427


// lcd compatible

---
1. dectect lcd_id level
-------------------------
 
static int init_panel_data(struct panel_struct *panelstruct,
                           struct msm_panel_info *pinfo,
                           struct mdss_dsi_phy_ctrl *phy_db)
{
    oem_panel_detect();
    switch(panel_id) {
        ...
    }
    ...
}

void oem_panel_detect(void)
{
    uint8_t lcd_glass_id = 0;
    
    //config id as inpput
    gpio_tlmm_config(LCD_GLASS_GPIO_ID, 0, GPIO_INPUT,
                                      GPIO_NO_PULL, GPIO_2MA, GPIO_ENABLE);

    //detect pin level
    lcd_glass_id = gpio_status(LCD_GLASS_GPIO_ID0);

    dprintf(CRITICAL, "lcd_glass_id0=%d", lcd_glass_id);

    //set panel_id according to pin level
    if(GPIO_LEVEL_HIGH == lcd_glass_id) 
    {
           panel_id = XXXX;

    }else if(GPIO_LEVEL_LOW == lcd_glass_id)
    {
            panel_id = YYYY;        
    }
}


---
2  read id register
--------
mtk:
       
读ID的方法:
    读Page 6 的 0xF0 0xF1 0xF2寄存器的第一个值,读出来是 0x98,0x81,0x0d

#define LCM_ID_ILI9881D                (0x98810d)

static unsigned int lcm_compare_id(void)
 {
 
     int array[4];
     char buffer[5];
     char id_high=0;
     char id_midd=0;
     char id_low=0;
     int id=0;
     //首先进行复位操作
     SET_RESET_PIN(1);
     MDELAY(20);   
     SET_RESET_PIN(0);
     MDELAY(20);
     SET_RESET_PIN(1);
     MDELAY(120);
 
     //enable CMD2 Page6
     array[0]=0x00043902;
     array[1]=0x068198ff;
     dsi_set_cmdq(array, 2, 1);
     MDELAY(10);
 
 
     array[0]=0x00033700;
     dsi_set_cmdq(array, 1, 1);
 
     read_reg_v2(0xF0, buffer,1);
     id_high = buffer[0]; ///////////////////////0x98
 
     read_reg_v2(0xF1, buffer,1);
     id_midd = buffer[0]; ///////////////////////0x81
 
     read_reg_v2(0xF2, buffer,1);
     id_low = buffer[0]; ////////////////////////0x0d
 
     id =(id_high << 16) | (id_midd << 8) | id_low;
 
     #if defined(BUILD_LK)
     printf("ILI9881D compare-LK:0x%02x,0x%02x,0x%02x,0x%02x\n", id_high, id_midd, id_low, id);
     #else
     printk("ILI9881D compare:0x%02x,0x%02x,0x%02x,0x%02x\n", id_high, id_midd, id_low, id);
     #endif
 
     return (id == LCM_ID_ILI9881D)?1:0;
 }

qcom:
    

 

发布了31 篇原创文章 · 获赞 5 · 访问量 1万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 创作都市 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览