我们知道,调试lk里面mipi lcd显示,需要在kernel里面参数数组里面改写包头(长包
还是短包)和注意4字节对齐,不够则补齐0xff;
其实我们kernel是对参数进行了封装,参数经过DMA发送到DSI_BASE偏移0x44的寄
存器中的值是和lk里面是一致的。
在mipi_dsi_host.c中mipi_dsi_cmd_dma_tx()函数打开DSI_HOST_DEBUG宏即可
打印出真正发送到dsi寄存器里面的值。
所以以后可以先在kernel里面打印出来再填充到lk里面,再也不用手动改写数组了。理论
上任何带参数的短包都可以使用长包发送,因为kernel里面会对其封装成长包格式。
int mipi_dsi_cmd_dma_tx(struct dsi_buf *tp)
{
unsigned long flags;
#ifdef DSI_HOST_DEBUG
int i;
char *bp;
bp = tp->data;
printk("%s: ", __func__);
for (i = 0; i < tp->len; i++)
printk("0x%02x ", *bp++);
printk("\n");
#endif
if (tp->len == 0) {
pr_err("%s: Error, len=0\n", __func__);
return 0;
}
----
}
看看很简单的在lk里面发送mipi参数的函数,是直接将lk里面的参数发送到dsi相关寄存
器的,并没有对其封装。
int mipi_dsi_cmds_tx(struct mipi_dsi_cmd *cmds, int count)
{
int ret = 0;
struct mipi_dsi_cmd *cm;
int i = 0;
char pload[256];
uint32_t off;
/* Align pload at 8 byte boundry */
off = pload;
off &= 0x07;
if (off)
off = 8 - off;
off += pload;
cm = cmds;
for (i = 0; i < count; i++) {
memcpy((void *)off, (cm->payload), cm->size);
writel(off, DSI_DMA_CMD_OFFSET); //0x44
writel(cm->size, DSI_DMA_CMD_LENGTH); // reg 0x48 for this
build
dsb();
ret += dsi_cmd_dma_trigger_for_panel();
udelay(80);
if (cm->wait)
mdelay(cm->wait);
cm++;
}
return ret;
}
下面有带log kernel里面的打印:
static char sharp_param0[2] = {0xb0,0x04};
static char sharp_param1[2] = {0x00,0x0};
static char sharp_param2[2] = {0x00,0x0};
static char sharp_param3[2] = {0xd6,0x01};
static char sharp_param4[2] = {0x51,0x0f};
static char sharp_param5[2] = {0x53,0x04};
static char sharp_param6[2] = {0x36,0xc0};
static struct dsi_cmd_desc sharp_video_init_cmds[] = {
{DTYPE_DCS_WRITE1, 1, 0, 0, 0,sizeof(sharp_param0),sharp_param0},
{DTYPE_DCS_LWRITE, 1, 0, 0, 0,sizeof(sharp_param1),sharp_param1},
{DTYPE_DCS_WRITE, 1, 0, 0, 0,sizeof(sharp_param2),sharp_param2},
{DTYPE_DCS_WRITE1, 1, 0, 0, 0,sizeof(sharp_param3),sharp_param3},
{DTYPE_DCS_WRITE1, 1, 0, 0, 0,sizeof(sharp_param4),sharp_param4},
{DTYPE_DCS_WRITE1, 1, 0, 0, 0,sizeof(sharp_param5),sharp_param5},
{DTYPE_DCS_WRITE1, 1, 0, 0, 0,sizeof(sharp_param6),sharp_param6},
{DTYPE_DCS_WRITE, 1, 0, 0, 0,sizeof(display_on),display_on},
{DTYPE_DCS_WRITE, 1, 0, 0, 40,sizeof(exit_sleep),exit_sleep},
};
LOG:
<4>[ 4.824752] mipi_sharp_lcd_on
<4>[ 4.824752] mipi_dsi_cmd_dma_tx: 0xb0 0x04 0x15 0x80
<4>[ 4.824813] mipi_dsi_cmd_dma_tx: 0x02 0x00 0x39 0xc0 0x00 0x00 0xff
0xff
<4>[ 4.824843] mipi_dsi_cmd_dma_tx: 0x00 0x00 0x05 0x80
<4>[ 4.824904] mipi_dsi_cmd_dma_tx: 0xd6 0x01 0x15 0x80
<4>[ 4.824935] mipi_dsi_cmd_dma_tx: 0x51 0x0f 0x15 0x80
<4>[ 4.824965] mipi_dsi_cmd_dma_tx: 0x53 0x04 0x15 0x80
<4>[ 4.824996] mipi_dsi_cmd_dma_tx: 0x36 0xc0 0x15 0x80
<4>[ 4.825026] mipi_dsi_cmd_dma_tx: 0x29 0x00 0x05 0x80
<4>[ 4.825057] mipi_dsi_cmd_dma_tx: 0x11 0x00 0x05 0x80
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。