RK提供的常规的mipi指令,比如0x15 0x39 等等,但是SDK本身不支持0x32命令,需要加入以下补丁:
rk3126补丁如下:
kenel使用:
diff --git a/drivers/video/rockchip/screen/lcd_mipi.c b/drivers/video/rockchip/screen/lcd_mipi.c
index 8eeef57..eba303d6 100755
--- a/drivers/video/rockchip/screen/lcd_mipi.c
+++ b/drivers/video/rockchip/screen/lcd_mipi.c
@@ -166,6 +166,7 @@ static void rk_mipi_screen_cmd_init(struct mipi_screen *screen)
int rk_mipi_screen(void)
{
u8 dcs[16] = {0}, rk_dsi_num;
+ u32 *p,data;
rk_dsi_num = gmipi_screen->mipi_dsi_num;
if (gmipi_screen->screen_init == 0) {
rk_mipi_screen_pwr_enable(gmipi_screen);
@@ -211,6 +212,47 @@ int rk_mipi_screen(void)
if (rk_dsi_num == 2) {
dsi_enable_video_mode(1, 1);
}
+ /* Sending 0x22 command and 0x32 commad */
+ p = ioremap(0x20008150, SZ_4);
+ data = ioread32(p);
+ data |= 0x100000;
+ data &= ~0x10;
+ iowrite32(data, p);
+ printk("mipi reg data1 = %x\n",data);
+ //writel(data, 0x20008150);
+ udelay(20);
+ /* 0x22 command */
+ data |= 0x100000;
+ data |= 0x10;
+ iowrite32(data, p);
+ printk("mipi reg data2 = %x\n",data);
+ // writel(data, 0x20008150);
+ msleep(10);
+ /* 0x32 command */
+ data = ioread32(p);
+ data |= 0x100000;
+ data &= ~0x10;
+ printk("mipi reg data3 = %x\n",data);
+ iowrite32(data, p);
+ udelay(20);
+ iounmap(p);
+ // writel(data,0x20008150);
+
+ msleep(20);
+ dcs[0] = HSDT;
+ dcs[1] = DTYPE_DCS_SWRITE_0P;
+ dcs[2] = dcs_exit_sleep_mode;
+ dsi_send_packet(0, dcs, 3);
+ if (rk_dsi_num == 2)
+ dsi_send_packet(1, dcs, 3);
+
+ msleep(2);
+
+ dcs[0] = HSDT;
+ dcs[1] = DTYPE_DCS_SWRITE_0P;
+ dcs[2] = dcs_set_display_on;
+ dsi_send_packet(0, dcs, 3);
+
} else {
rk_mipi_screen_pwr_enable(gmipi_screen);
UBOOT上使用:
diff --git a/drivers/video/screen/lcd_mipi.c b/drivers/video/screen/lcd_mipi.c
index b9e513c..9146c39 100755
--- a/drivers/video/screen/lcd_mipi.c
+++ b/drivers/video/screen/lcd_mipi.c
@@ -173,6 +173,7 @@ static void rk_mipi_screen_cmd_init(struct mipi_screen *screen)
int rk_mipi_screen(void)
{
+ u32 *p,data;
u8 dcs[16] = {0}, rk_dsi_num;
rk_dsi_num = gmipi_screen->mipi_dsi_num;
if(gmipi_screen->screen_init == 0){
@@ -219,6 +220,29 @@ int rk_mipi_screen(void)
if(rk_dsi_num == 2){
dsi_enable_video_mode(1,1);
}
+ /* Sending 0x22 command and 0x32 commad */
+ // p = ioremap(0xff770418, SZ_4);
+ // data = ioread32(p);
+ data = 0;
+ data |= 0x100000;
+ data &= ~0x10;
+ //iowrite32(data, p);
+ writel(data, 0x20008150);
+ udelay(20);
+ /* 0x22 command */
+ data |= 0x100000;
+ data |= 0x10;
+ //iowrite32(data, p);
+ writel(data, 0x20008150);
+ msleep(10);
+ /* 0x32 command */
+ //data = ioread32(p);
+ data |= 0x100000;
+ data &= ~0x10;
+ //iowrite32(data, p);
+ //iounmap(p);
+ writel(data,0x20008150);
+ msleep(20);
}
else{
rk_mipi_screen_pwr_enable(gmipi_screen);
diff --git a/drivers/video/transmitter/rk32_mipi_dsi.c b/drivers/video/transmitter/rk32_mipi_dsi.c
index 375dfdb..6db1188 100755
--- a/drivers/video/transmitter/rk32_mipi_dsi.c
+++ b/drivers/video/transmitter/rk32_mipi_dsi.c
@@ -986,6 +986,11 @@ static int rk32_mipi_dsi_host_init(struct dsi *dsi)
//rk32_dsi_set_bits(dsi, 0, outvact_lpcmd_time); //byte
//rk32_dsi_set_bits(dsi, 0, invact_lpcmd_time);
+ /* enable send command in low power mode */
+ rk32_dsi_set_bits(dsi, 4, outvact_lpcmd_time);
+ rk32_dsi_set_bits(dsi, 4, invact_lpcmd_time);
+ rk32_dsi_set_bits(dsi, 1, lp_cmd_en);
+
rk32_dsi_set_bits(dsi, 20, phy_hs2lp_time);
rk32_dsi_set_bits(dsi, 16, phy_lp2hs_time);
p>
RK3368 patch as follows:
diff –git a/drivers/video/screen/lcd_mipi.c b/drivers/video/screen/lcd_mipi.c
index 257ea7a.. E8e1c0bf 100755
– a/drivers/video/screen/lcd_mipi.
c + + + b/drivers/video/screen/lcd_mipi c
@ @ + 177-177, 6, 7 @ @ static void rk_mipi_screen_cmd_init (struct mipi_screen * screen)
Int rk_mipi_screen (void)
{
p + u32 * and data;
u8 DCS [16] = {0}, rk_dsi_num;
rk_dsi_num = gmipi_screen – & gt; mipi_dsi_num;
if (gmipi_screen – & gt; Screen_init = = 0) {
@ @ – 223, 6 + 224 @ @ int rk_mipi_screen (void)
if (rk_dsi_num = = 2) {
dsi_enable_video_mode (1, 1);
} +/* Sending 0 x22 command and 0 x32 commad */
+// p = ioremap (0 xff770418, SZ_4);
+ // data = ioread32(p);
+ data = 0;
+ data |= 0x040000;
+ data & amp; = ~0x04;
+// iowrite32 (data, p);
+ writel (data, 0 xff770418);
+ udelay (20);
+/* 0 x22 command */
+ data | = 0 x040000;
+ data |= 0x04;
+// iowrite32 (data, p);
+ writel (data, 0 xff770418);
+ msleep (10);
+/* 0 x32 command */
+// data = ioread32 (p);
+ data |= 0x040000;
+ data & amp; = ~0x04;
+// iowrite32 (data, p);
+// iounmap (p);
+ writel (data, 0 xff770418);
+ msleep (20);
} else {
rk_mipi_screen_pwr_enable (gmipi_screen);
p>