From: libing Date: Thu, 17 Apr 2014 09:34:50 +0000 (+0800) Subject: rk3288-mipi-dsi: the mipi lcd driver, fix the send command methods. X-Git-Tag: firefly_0821_release~5518 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d81c9a844d2ce9c6d8c4671558f3ea256b2d221b;p=firefly-linux-kernel-4.4.55.git rk3288-mipi-dsi: the mipi lcd driver, fix the send command methods. --- diff --git a/drivers/video/rockchip/screen/lcd_mipi.c b/drivers/video/rockchip/screen/lcd_mipi.c index ee81752fa243..2635134e6697 100755 --- a/drivers/video/rockchip/screen/lcd_mipi.c +++ b/drivers/video/rockchip/screen/lcd_mipi.c @@ -1,11 +1,22 @@ +/* + * Copyright (C) 2014 ROCKCHIP, Inc. + * drivers/video/rockchip/screen/lcd_mipi.c + * author: libing@rock-chips.com + * create date: 2014-04-10 + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ -#if defined(CONFIG_MIPI_DSI) #include "../transmitter/mipi_dsi.h" -#endif #include - -#if 1 +#if 0 #define MIPI_SCREEN_DBG(x...) printk(KERN_ERR x) #else #define MIPI_SCREEN_DBG(x...) @@ -47,11 +58,7 @@ static void rk_mipi_screen_pwr_enable(struct mipi_screen *screen) if(screen->lcd_rst_gpio != INVALID_GPIO){ mdelay (screen->lcd_rst_delay); - //gpio_direction_output(screen->lcd_rst_gpio, !screen->lcd_rst_atv_val); - //mdelay(screen->lcd_rst_delay); - //gpio_direction_output(screen->lcd_rst_gpio, screen->lcd_rst_atv_val); - //mdelay(screen->lcd_rst_delay); - gpio_direction_output(screen->lcd_rst_gpio, !screen->lcd_rst_atv_val); + gpio_direction_output(screen->lcd_rst_gpio, screen->lcd_rst_atv_val); mdelay(screen->lcd_rst_delay); } else{ @@ -62,7 +69,7 @@ static void rk_mipi_screen_pwr_enable(struct mipi_screen *screen) static void rk_mipi_screen_cmd_init(struct mipi_screen *screen) { u8 len, i; - u8 cmds[21] = {0}; + u8 cmds[25] = {0}, tempcmds[25] = {0}; struct list_head *screen_pos; struct mipi_dcs_cmd_ctr_list *dcs_cmd; @@ -71,37 +78,27 @@ static void rk_mipi_screen_cmd_init(struct mipi_screen *screen) dcs_cmd = list_entry(screen_pos, struct mipi_dcs_cmd_ctr_list, list); len = dcs_cmd->dcs_cmd.cmd_len + 1; - for( i = 1; i < len ; i++) + for( i = 1; i < len ; i++){ cmds[i] = dcs_cmd->dcs_cmd.cmds[i-1]; + tempcmds[i] = cmds[i]; + } printk("dcs_cmd.name:%s\n",dcs_cmd->dcs_cmd.name); if(dcs_cmd->dcs_cmd.type == LPDT){ cmds[0] = LPDT; + tempcmds[0] = LPDT; if(dcs_cmd->dcs_cmd.dsi_id == 0){ - MIPI_SCREEN_DBG("dcs_cmd.dsi_id == 0 line=%d\n",__LINE__); - - if(dcs_cmd->dcs_cmd.dtype == DATA_TYPE_DCS) - dsi_send_dcs_packet(0, cmds, len); - else - dsi_send_packet(0, cmds, len); + MIPI_SCREEN_DBG("dcs_cmd.dsi_id == 0 line=%d\n",__LINE__); + dsi_send_packet(0, cmds, len); } else if (dcs_cmd->dcs_cmd.dsi_id == 1){ MIPI_SCREEN_DBG("dcs_cmd.dsi_id == 1 line=%d\n",__LINE__); - if(dcs_cmd->dcs_cmd.dtype == DATA_TYPE_DCS) - dsi_send_dcs_packet(1, cmds, len); - else - dsi_send_packet(1, cmds, len); + dsi_send_packet(1, cmds, len); } else if (dcs_cmd->dcs_cmd.dsi_id == 2){ MIPI_SCREEN_DBG("dcs_cmd.dsi_id == 2 line=%d\n",__LINE__); - - if(dcs_cmd->dcs_cmd.dtype == DATA_TYPE_DCS){ - dsi_send_dcs_packet(0, cmds, len); - dsi_send_dcs_packet(1, cmds, len); - } - else{ - dsi_send_packet(0, cmds, len); - dsi_send_packet(1, cmds, len); - } + dsi_send_packet(0, cmds, len); + dsi_send_packet(1, tempcmds, len); + } else{ MIPI_SCREEN_DBG("dsi is err.\n"); @@ -111,35 +108,21 @@ static void rk_mipi_screen_cmd_init(struct mipi_screen *screen) } else if(dcs_cmd->dcs_cmd.type == HSDT){ cmds[0] = HSDT; + tempcmds[0] = HSDT; if(dcs_cmd->dcs_cmd.dsi_id == 0){ - MIPI_SCREEN_DBG("dcs_cmd.dsi_id == 0 line=%d\n",__LINE__); - - if(dcs_cmd->dcs_cmd.dtype == DATA_TYPE_DCS) - dsi_send_dcs_packet(0, cmds, len); - else - dsi_send_packet(0, cmds, len); + MIPI_SCREEN_DBG("dcs_cmd.dsi_id == 0 line=%d\n",__LINE__); + dsi_send_packet(0, cmds, len); } else if (dcs_cmd->dcs_cmd.dsi_id == 1){ MIPI_SCREEN_DBG("dcs_cmd.dsi_id == 1 line=%d\n",__LINE__); - if(dcs_cmd->dcs_cmd.dtype == DATA_TYPE_DCS) - dsi_send_dcs_packet(1, cmds, len); - else - dsi_send_packet(1, cmds, len); + dsi_send_packet(1, cmds, len); } else if (dcs_cmd->dcs_cmd.dsi_id == 2){ - MIPI_SCREEN_DBG("dcs_cmd.dsi_id == 2 line=%d\n",__LINE__); - - if(dcs_cmd->dcs_cmd.dtype == DATA_TYPE_DCS){ - dsi_send_dcs_packet(0, cmds, len); - dsi_send_dcs_packet(1, cmds, len); - } - else{ - dsi_send_packet(0, cmds, len); - dsi_send_packet(1, cmds, len); - } - + MIPI_SCREEN_DBG("dcs_cmd.dsi_id == 2 line=%d\n",__LINE__); + dsi_send_packet(0, cmds, len); + dsi_send_packet(1, tempcmds, len); } else{ MIPI_SCREEN_DBG("dsi is err."); @@ -165,18 +148,20 @@ int rk_mipi_screen(void) } dcs[0] = LPDT; - dcs[1] = dcs_exit_sleep_mode; - dsi_send_dcs_packet(0, dcs, 2); + 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_dcs_packet(1, dcs, 2); + dsi_send_packet(1, dcs, 3); msleep(10); dcs[0] = LPDT; - dcs[1] = dcs_set_display_on; - dsi_send_dcs_packet(0, dcs, 2); + dcs[1] = DTYPE_DCS_SWRITE_0P; + dcs[2] = dcs_set_display_on; + dsi_send_packet(0, dcs, 3); if(rk_dsi_num ==2) - dsi_send_dcs_packet(1, dcs, 2); + dsi_send_packet(1, dcs, 3); msleep(10); @@ -218,8 +203,7 @@ int rk_mipi_screen(void) } } - - + MIPI_SCREEN_DBG("++++++++++++++++%s:%d\n", __func__, __LINE__); return 0; } @@ -232,29 +216,31 @@ int rk_mipi_screen_standby(u8 enable) if(dsi_is_active(0) != 1) return -1; - + if(rk_dsi_num ==2) if((dsi_is_active(0) != 1) ||(dsi_is_active(1) != 1)) return -1; - + if(enable) { /*below is changeable*/ dcs[0] = LPDT; - dcs[1] = dcs_set_display_off; - dsi_send_dcs_packet(0, dcs, 2); + dcs[1] = DTYPE_DCS_SWRITE_0P; + dcs[2] = dcs_set_display_off; + dsi_send_packet(0, dcs, 3); if(rk_dsi_num ==2) - dsi_send_dcs_packet(1, dcs, 2); + dsi_send_packet(1, dcs, 3); - msleep(10); + msleep(30); dcs[0] = LPDT; - dcs[1] = dcs_enter_sleep_mode; - dsi_send_dcs_packet(0, dcs, 2); + dcs[1] = DTYPE_DCS_SWRITE_0P; + dcs[2] = dcs_enter_sleep_mode; + dsi_send_packet(0, dcs, 3); if(rk_dsi_num ==2) - dsi_send_dcs_packet(1, dcs, 2); - - msleep(10); + dsi_send_packet(1, dcs, 3); + msleep(100); + rk_mipi_screen_pwr_disable(gmipi_screen); MIPI_SCREEN_DBG("++++enable++++++++++++%s:%d\n", __func__, __LINE__); } @@ -271,7 +257,7 @@ static int rk_mipi_screen_init_dt(struct mipi_screen *screen) struct list_head *pos; struct property *prop; enum of_gpio_flags flags; - u32 value,i,debug,gpio,ret,cmds[20],length; + u32 value,i,debug,gpio,ret,cmds[25],length; memset(screen, 0, sizeof(*screen)); @@ -457,19 +443,7 @@ static int rk_mipi_screen_init_dt(struct mipi_screen *screen) dcs_cmd->dcs_cmd.dsi_id = value; } } - - ret = of_property_read_u32(childnode, "rockchip,data_type", &value); - if(ret){ - MIPI_SCREEN_DBG("%s: Can not read property: %s--->data_type\n", __func__,childnode->name); - } - else{ - if((value != 0) && (value != 1)){ - printk("err: rockchip, cmd_type not match.\n"); - } - else - dcs_cmd->dcs_cmd.dtype = value; - } - + ret = of_property_read_u32(childnode, "rockchip,cmd_type", &value); if(ret){ MIPI_SCREEN_DBG("%s: Can not read property: %s--->cmd_type\n", __func__,childnode->name); @@ -501,10 +475,9 @@ static int rk_mipi_screen_init_dt(struct mipi_screen *screen) if (debug) { list_for_each(pos, &screen->cmdlist_head) { dcs_cmd = list_entry(pos, struct mipi_dcs_cmd_ctr_list, list); - printk("\n dcs_name:%s,dcs_type:%d,dtype:%d,side_id:%d,cmd_len:%d,delay:%d\n\n", + printk("\n dcs_name:%s,dcs_type:%d,side_id:%d,cmd_len:%d,delay:%d\n\n", dcs_cmd->dcs_cmd.name, - dcs_cmd->dcs_cmd.type, - dcs_cmd->dcs_cmd.dtype, + dcs_cmd->dcs_cmd.type, dcs_cmd->dcs_cmd.dsi_id, dcs_cmd->dcs_cmd.cmd_len, dcs_cmd->dcs_cmd.delay);