您的位置:首页 > 编程语言 > Go语言

mipi屏在内核可以显示logo但是u-boot无法显示的问题【转】

2017-11-28 11:16 711 查看
本文转载自:http://blog.csdn.net/fulinus/article/details/45071721

平台:瑞芯的rk3288

u-boot版本:u-boot-2014.10

kernel版本:3.10

mipi屏型号:LQ079L1SX01


作者:fulinux

*****本文允许转载,不过请注明出处:http://blog.csdn.net/fulinus****

问题:

u-boot启动不能显示logo的问题。

分析:

内核可以正常使用,那说明硬件没有问题,内核和u-boot使用的是同一个dts文件描述的设备树,所以dts文件中的信息应该也是没有问题的。那很可能是u-boot的mipi通信问题。

过程:

经过多次调试,我们在内核中初始化mipi屏的probe函数中加入了一个rk32_dsi_enable函数,竟然把原本需要在u-boot中需要显示的logo:






给显示出来了。抓住这个机会对rk32_dsi_enable函数逐步屏蔽,发现了关键问题,在比较u-boot做的这部分工作发现u-boot的mipi初始化时没有发送初始化指令,于是我在u-boot中添加如下代码,强制给mipi控制器发送如下指令:


cmds[0] = LPDT;
cmds[1] = 0x05;
cmds[2] = 0x11;
dsi_send_packet(0, cmds, 3);
dsi_send_packet(1, cmds, 3);

cmds[0] = LPDT;
cmds[1] = 0x15;
cmds[2] = 0x51;
cmds[3] = 0xff;
dsi_send_packet(0, cmds, 4);
dsi_send_packet(1, cmds, 4);

cmds[0] = LPDT;
cmds[1] = 0x15;
cmds[2] = 0x55;
cmds[3] = 0x02;
dsi_send_packet(0, cmds, 4);
dsi_send_packet(1, cmds, 4);

cmds[0] = LPDT;
cmds[1] = 0x15;
cmds[2] = 0x53;
cmds[3] = 0x2c;
dsi_send_packet(0, cmds, 4);
dsi_send_packet(1, cmds, 4);

cmds[0] = LPDT;
cmds[1] = 0x05;
cmds[2] = 0x29;
dsi_send_packet(0, cmds, 3);
dsi_send_packet(1, cmds, 3);


果不其然,OK了,这些指令就是mipi的dts文件中的信息。

不过这个代码可不行,于是进一步分析问题是在这里:

list_for_each(screen_pos, &screen->cmdlist_head){


发现cmdlist_head的是空的,说明没有解析到dts文件的信息,解析dts文件的信息在:

rk_mipi_screen_init_dt函数中:


/*get the initial command list*/
node = fdtdec_next_compatible(blob, 0, COMPAT_ROCKCHIP_MIPI_SONCMDS);
if (node < 0) {
MIPI_SCREEN_DBG("Can not get node of COMPAT_ROCKCHIP_MIPI_SONCMDS\n");
} else {
#if 1
noffset = fdt_first_subnode(blob, node);
const char *name = fdt_get_name(blob, noffset, NULL);
printf("XJH_DEBUG1:%s\n", name);
noffset = fdt_next_subnode(blob, noffset);
const char *name1 = fdt_get_name(blob, noffset, NULL);
printf("XJH_DEBUG2:%s\n", name1);
#endif
printf ("fulinux mipi_oncmds 1\n");
for (noffset = fdt_first_subnode(blob,node);
noffset >= 0;
noffset = fdt_next_subnode(blob, noffset)) {
printf ("fulinux mipi_oncmds 2\n");
MIPI_SCREEN_DBG("build MIPI LCD init cmd tables\n");
dcs_cmd = calloc(1,sizeof(struct mipi_dcs_cmd_ctr_list));
strcpy(dcs_cmd->dcs_cmd.name, fdt_get_name(blob, noffset, NULL));
MIPI_SCREEN_DBG("%s\n",dcs_cmd->dcs_cmd.name);

dcs_cmd->dcs_cmd.type = fdtdec_get_int(blob, noffset, "rockchip,cmd_type", -1);
MIPI_SCREEN_DBG("dcs_cmd.type=%02x\n",dcs_cmd->dcs_cmd.type);

dcs_cmd->dcs_cmd.dsi_id = fdtdec_get_int(blob, noffset, "rockchip,dsi_id", -1);
MIPI_SCREEN_DBG("dcs_cmd.dsi_id=%02x\n",dcs_cmd->dcs_cmd.dsi_id);

fdt_getprop(blob, noffset, "rockchip,cmd", &length);
dcs_cmd->dcs_cmd.cmd_len = length / sizeof(u32) ;
err = fdtdec_get_int_array(blob, noffset, "rockchip,cmd", cmds, dcs_cmd->dcs_cmd.cmd_len);
MIPI_SCREEN_DBG("length=%d,cmd_len = %d err = %d\n",length,dcs_cmd->dcs_cmd.cmd_len,err);

for (i = 0; i < (length / sizeof(u32)); i++) {
MIPI_SCREEN_DBG("cmd[%d]=0x%08x, ",i+1,cmds[i]);
dcs_cmd->dcs_cmd.cmds[i] = cmds[i];
}
MIPI_SCREEN_DBG("\n");

dcs_cmd->dcs_cmd.delay = fdtdec_get_int(blob, noffset, "rockchip,cmd_delay", -1);
MIPI_SCREEN_DBG("dcs_cmd.delay=%d\n",dcs_cmd->dcs_cmd.delay);

list_add_tail(&dcs_cmd->list, &screen->cmdlist_head);
}
}
return 0;


u-boot的log显示没有打印printf ("fulinux mipi_oncmds 2\n");这条信息。但是前面有个类似功能的代码是正常的。那说明问题在dts解析时出现了问题。考虑一下是不是dts文件中的格式有问题呢?经过反复的调试和摸索,原来是谁在填写mipi屏的dts文件时拉掉了这句:

compatible = "rockchip,screen-on-cmds";


这个问题告诉我们大厦是一步步建起来的不能跳过基础的东西!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐