高通平台mipi panel kernel读包方法


熟悉高通平台mipi panel kernel读包方法,我想我们可以是的同一客户要是使用2块mipi panel的话我想我们可以通过读取id来下不同序列而不用更换boot.img,还有能否读id可以说明mipi通讯是否正常。

还有我们只需在lk下面读一次id再对全局变量赋值通过lk传递到kernel里面,通过不同赋值发送不同初始化序列,至于时序clk则调整好兼容2块屏的,也可以通过全局变量来区分。

在mipi_xxx.c中加入下面函数即可,很好用的!关键时候起作用。注意所读的寄存器必须是可读的,之前好几次读失败了原因就是这个。

static u32 mipi_truely_read_reg(struct msm_fb_data_type *mfd, u16 reg)

{
        u32 data;
        int len = 4;
        struct dsi_cmd_desc cmd_read_reg = {
                DTYPE_GEN_READ2, 1, 0, 1, 0, /* cmd 0x24 */
                        sizeof(reg), (char *) ®};

        mipi_dsi_buf_init(&truly_tx_buf);
        mipi_dsi_buf_init(&truly_rx_buf);

        /* mutex had been acquried at dsi_on */
        len = mipi_dsi_cmds_rx(mfd, &truly_tx_buf, &truly_rx_buf,
                               &cmd_read_reg, len);

        data = *(u32 *)truly_rx_buf.data;

        if (len != 4)
        printk("%s: invalid rlen=%d, expecting 4.\n", __func__, len);

        printk("%s: reg=0x%x.data=0x%08x.\n", __func__, reg, data);


        return data;
}


static int mipi_truly_lcd_on(struct platform_device *pdev)
{
        struct msm_fb_data_type *mfd;
       u32 data;

        mfd = platform_get_drvdata(pdev);

        if (!mfd)
                return -ENODEV;
        if (mfd->key != MFD_KEY)
                return -EINVAL;
        if (display_n) {        
                if (mipi_truly_lcd_reset() < 0) {
                        pr_err("mipi_truly_lcd_reset error\n");
                        return -EINVAL;
                }

                msleep(20);
                mipi_dsi_cmds_tx(mfd, &truly_tx_buf,
truly_video_display_on_cmds,ARRAY_SIZE(truly_video_display_on_cmds));
                printk("mipi_dsi_cmds_tx called here");
               mdelay(20);

              //add for testdata=mipi_truely_read_reg(mfd,0xE1);


        printk("data =0x%x",data);
        }
                
        display_n = TRUE;

        
        return 0;
}

static char A13[5]={0xC1,0x17,0x30,0x0E,0x26};
static char A14[2]={0x5e,0x55};
static char
A15[17]={0xE1,0x00,0x0B,0x14,0x13,0x13,0x1F,0x0D,0x0B,0x00,0x04,0x00,0x11,0x0C,0x1C,0x17,0x00};

 

log:

<4>[    5.672508] [(1980-01-06 05:56:05.862078335 UTC)]
mipi_truely_read_reg: reg=0xc1.data=0x260e3017.
<4>[    5.672588] [(1980-01-06 05:56:05.862156668 UTC)]
mipi_truely_read_reg: reg=0x5f.data=0x00000055.
<4>[    5.672733] [(1980-01-06 05:56:05.862301668 UTC)]
mipi_truely_read_reg: reg=0xe1.data=0x13140b00.

还有一个函数也可以写法不一样而已:

 

static struct dsi_cmd_desc novatek_manufacture_id_cmd = {
DTYPE_DCS_READ, 1, 0, 1, 5, sizeof(a10), a10};

static uint32 mipi_novatek_manufacture_id(struct msm_fb_data_type *mfd)
{
struct dsi_buf *rp, *tp;
struct dsi_cmd_desc *cmd;
uint32 *lp;

tp = &ili_tx_buf;
rp = &ili_rx_buf;
cmd = &novatek_manufacture_id_cmd;
mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 3);
lp = (uint32 *)rp->data;
printk("%s: manufacture_id=%x", __func__, *lp);
return *lp;
}


你可能感兴趣的:(8x60,7x27a,内核移植,驱动总结)