高通平台读取液晶(ILI9881C芯片)ID的方法---根据此读取ID方法可适配多个屏幕

在此,先做简单记录,后续液晶调试之后再重新修改
static char to_page1[] = {0x04,0x00,0x39,0xC0,0xFF,0x98,0x81,0x01}; //切换到page1
static char read_max_package[4] = {0x08,0x00,0x37,0x80}; //设置包数据大小
static char read_id_reg0[4] = {0x00,0x00,0x06,0xA0}; //读取00寄存器的ID值
static char read_id_reg1[4] = {0x01,0x00,0x06,0xA0}; //读取01地址的ID值
static char read_id_reg2[4] = {0x02,0x00,0x06,0xA0}; //读取02地址的ID值
static struct mipi_dsi_cmd ili9881c_panel_set_cmd[] = {
{sizeof(to_page1),to_page1},
};
static struct mipi_dsi_cmd ili9881c_panel_set_pkt_size_cmd[] = {
{sizeof(read_max_package),read_max_package},
};
static struct mipi_dsi_cmd ili9881c_panel_manufacture_id_cmd0[] = {
{sizeof(read_id_reg0),read_id_reg0},
};
static struct mipi_dsi_cmd ili9881c_panel_manufacture_id_cmd1[] = {
{sizeof(read_id_reg1),read_id_reg1},
};
static struct mipi_dsi_cmd ili9881c_panel_manufacture_id_cmd2[] = {
{sizeof(read_id_reg2),read_id_reg2},
};
static uint32_t mdss_dsi_read_panel_id(void){
char rec_buf[24];
char *rp = rec_buf;
uint32_t *lp,ret,data= 0;
ret = mipi_dsi_cmds_tx(ili9881c_panel_set_cmd,ARRAY_SIZE(ili9881c_panel_set_cmd));
mdelay(10);
ret = mipi_dsi_cmds_tx(ili9881c_panel_set_pkt_size_cmd,ARRAY_SIZE(ili9881c_panel_set_pkt_size_cmd));
mdelay(10);
ret = mipi_dsi_cmds_tx(ili9881c_panel_manufacture_id_cmd0,ARRAY_SIZE(ili9881c_panel_manufacture_id_cmd0));
if(ret < 0) {
dprintf(CRITICAL,“mipi read panel id faild\n”);
}
mdelay(10);
ret = mipi_dsi_cmds_rx(&rp, 3);
lp = (uint32_t *)rp;
data = (uint32_t)*lp;
data = ntohl(data);
data = data & 0xFF;
lp = (uint32_t *)rp;
data = (uint32_t)*lp;
dprintf(CRITICAL, “[PHC]: panel ID: 0x%x\n”, data);

ret = mipi_dsi_cmds_tx(ili9881c_panel_manufacture_id_cmd1,ARRAY_SIZE(ili9881c_panel_manufacture_id_cmd1));
mdelay(10);
ret = mipi_dsi_cmds_rx(&rp, 3);
lp = (uint32_t *)rp;
data = (uint32_t)*lp;
data = ntohl(data);
data = data & 0xFF;
lp = (uint32_t *)rp;
data = (uint32_t)*lp;
dprintf(CRITICAL, "[PHC]: panel ID: 0x%x\n", data);
      
ret = mipi_dsi_cmds_tx(ili9881c_panel_manufacture_id_cmd2,ARRAY_SIZE(ili9881c_panel_manufacture_id_cmd2));mdelay(10);
ret = mipi_dsi_cmds_rx(&rp, 3);
lp = (uint32_t *)rp;
data = (uint32_t)*lp;
data = ntohl(data);
data = data & 0xFF;
lp = (uint32_t *)rp;
data = (uint32_t)*lp;
dprintf(CRITICAL, "[PHC]: panel ID: 0x%x\n", data);
return data;

}
打印结果:
[PHC]: panel ID: 0x9800a51d
[PHC]: panel ID: 0x8100c8f1
[PHC]: panel ID: 0xc00e1eb

你可能感兴趣的:(linux驱动)