+/*
+ * 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 <linux/delay.h>
-
-#if 1
+#if 0
#define MIPI_SCREEN_DBG(x...) printk(KERN_ERR x)
#else
#define MIPI_SCREEN_DBG(x...)
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{
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;
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");
}
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.");
}
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);
}
}
-
-
+
MIPI_SCREEN_DBG("++++++++++++++++%s:%d\n", __func__, __LINE__);
return 0;
}
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__);
}
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));
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);
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);