Merge "dev: gcdb: display: fix ghost display issue of R69006" into lk.lnx.1.0-dev.1.0
diff --git a/dev/gcdb/display/include/panel_hx8394f_720p_video.h b/dev/gcdb/display/include/panel_hx8394f_720p_video.h
index 4442d3b..37425a0 100644
--- a/dev/gcdb/display/include/panel_hx8394f_720p_video.h
+++ b/dev/gcdb/display/include/panel_hx8394f_720p_video.h
@@ -59,42 +59,41 @@
 /* Panel on/off command information                                          */
 /*---------------------------------------------------------------------------*/
 static char hx8394f_720p_video_on_cmd0[] = {
-	0x04, 0x00, 0x29, 0xC0,
+	0x04, 0x00, 0x39, 0xC0,
 	0xB9, 0xFF, 0x83, 0x94,
-
 };
 
 static char hx8394f_720p_video_on_cmd1[] = {
-	0x07, 0x00, 0x29, 0xC0,
+	0x07, 0x00, 0x39, 0xC0,
 	0xBA, 0x63, 0x03, 0x68,
-	0x6b, 0xb2, 0xc0, 0xFF,
+	0x6B, 0xB2, 0xc0, 0xFF,
 };
 
 static char hx8394f_720p_video_on_cmd2[] = {
-	0x0B, 0x00, 0x29, 0xC0,
+	0x0B, 0x00, 0x39, 0xC0,
 	0xB1, 0x50, 0x12, 0x72,
-	0x09, 0x32, 0x34, 0x71,
-	0x31, 0x70, 0x2f, 0xFF,
+	0x09, 0x33, 0x54, 0x81,
+	0x31, 0x69, 0x2F, 0xFF,
 };
 
 static char hx8394f_720p_video_on_cmd3[] = {
-	0x07, 0x00, 0x29, 0xC0,
+	0x07, 0x00, 0x39, 0xC0,
 	0xB2, 0x00, 0x80, 0x64,
 	0x0E, 0x0D, 0x2F, 0xFF,
 };
 
 static char hx8394f_720p_video_on_cmd4[] = {
-	0x16, 0x00, 0x29, 0xC0,
+	0x16, 0x00, 0x39, 0xC0,
 	0xB4, 0x6C, 0x6D, 0x6C,
 	0x6A, 0x6C, 0x6D, 0x01,
 	0x05, 0xFF, 0x77, 0x00,
-	0x3f, 0x6C, 0x6D, 0x6C,
+	0x3F, 0x6C, 0x6D, 0x6C,
 	0x6D, 0x6C, 0x6D, 0x01,
 	0x01, 0xFF, 0xFF, 0xFF,
 };
 
 static char hx8394f_720p_video_on_cmd5[] = {
-	0x22, 0x00, 0x29, 0xC0,
+	0x22, 0x00, 0x39, 0xC0,
 	0xD3, 0x00, 0x00, 0x07,
 	0x07, 0x40, 0x07, 0x10,
 	0x00, 0x08, 0x10, 0x08,
@@ -107,7 +106,7 @@
 };
 
 static char hx8394f_720p_video_on_cmd6[] = {
-	0x2d, 0x00, 0x29, 0xC0,
+	0x2D, 0x00, 0x39, 0xC0,
 	0xD5, 0x1A, 0x1A, 0x1B,
 	0x1B, 0x00, 0x01, 0x02,
 	0x03, 0x04, 0x05, 0x06,
@@ -123,7 +122,7 @@
 };
 
 static char hx8394f_720p_video_on_cmd7[] = {
-	0x2d, 0x00, 0x29, 0xC0,
+	0x2D, 0x00, 0x39, 0xC0,
 	0xD6, 0x1A, 0x1A, 0x1B,
 	0x1B, 0x0B, 0x0A, 0x09,
 	0x08, 0x07, 0x06, 0x05,
@@ -139,7 +138,7 @@
 };
 
 static char hx8394f_720p_video_on_cmd8[] = {
-	0x3B, 0x00, 0x29, 0xC0,
+	0x3B, 0x00, 0x39, 0xC0,
 	0xE0, 0x00, 0x0C, 0x19,
 	0x20, 0x23, 0x26, 0x29,
 	0x28, 0x51, 0x61, 0x70,
@@ -147,41 +146,45 @@
 	0x8D, 0x99, 0x9A, 0x95,
 	0xA1, 0xB0, 0x57, 0x55,
 	0x58, 0x5C, 0x5e, 0x64,
-	0x6b, 0x7f, 0x00, 0x0C,
+	0x6B, 0x7F, 0x00, 0x0C,
 	0x19, 0x20, 0x23, 0x26,
 	0x29, 0x28, 0x51, 0x61,
 	0x70, 0x6F, 0x76, 0x86,
 	0x89, 0x8D, 0x99, 0x9A,
 	0x95, 0xA1, 0xB0, 0x57,
 	0x55, 0x58, 0x5C, 0x5e,
-	0x64, 0x6b, 0x7f, 0xFF,
+	0x64, 0x6B, 0x7F, 0xFF,
 };
 
 static char hx8394f_720p_video_on_cmd9[] = {
-	0x03, 0x00, 0x29, 0xC0,
-	0xC0, 0x1f, 0x73, 0xFF,
+	0x03, 0x00, 0x39, 0xC0,
+	0xC0, 0x1F, 0x73, 0xFF,
 };
 
 static char hx8394f_720p_video_on_cmd10[] = {
-	0x02, 0x00, 0x29, 0xC0,
-	0xCC, 0x0B, 0xFF, 0xFF,
+	0xCC, 0x0B, 0x15, 0x80
 };
 
 static char hx8394f_720p_video_on_cmd11[] = {
-	0x02, 0x00, 0x29, 0xC0,
-	0xd4, 0x02, 0xFF, 0xFF,
+	0xD4, 0x02, 0x15, 0x80
 };
 
 static char hx8394f_720p_video_on_cmd12[] = {
-	0x03, 0x00, 0x29, 0xC0,
-	0xB6, 0x7E, 0x7E, 0xFF,
+	0x05, 0x00, 0x39, 0xC0,
+	0xC7, 0x00, 0xC0, 0x00,
+	0xC0, 0xFF, 0xFF, 0xFF,
 };
 
 static char hx8394f_720p_video_on_cmd13[] = {
-	0x11, 0x00, 0x05, 0x80
+	0x03, 0x00, 0x39, 0xC0,
+	0xB6, 0x7D, 0x7D, 0xFF,
 };
 
 static char hx8394f_720p_video_on_cmd14[] = {
+	0x11, 0x00, 0x05, 0x80
+};
+
+static char hx8394f_720p_video_on_cmd15[] = {
 	0x29, 0x00, 0x05, 0x80
 };
 
@@ -196,15 +199,15 @@
 	{0x34, hx8394f_720p_video_on_cmd7, 0x00},
 	{0x40, hx8394f_720p_video_on_cmd8, 0x00},
 	{0x8, hx8394f_720p_video_on_cmd9, 0x00},
-	{0x8, hx8394f_720p_video_on_cmd10, 0x00},
-	{0x8, hx8394f_720p_video_on_cmd11, 0x00},
-	{0x8, hx8394f_720p_video_on_cmd12, 0x00},
-	{0x4, hx8394f_720p_video_on_cmd13, 0x96},
-	{0x4, hx8394f_720p_video_on_cmd14, 0x0a}
+	{0x4, hx8394f_720p_video_on_cmd10, 0x00},
+	{0x4, hx8394f_720p_video_on_cmd11, 0x00},
+	{0xc, hx8394f_720p_video_on_cmd12, 0x00},
+	{0x8, hx8394f_720p_video_on_cmd13, 0x00},
+	{0x4, hx8394f_720p_video_on_cmd14, 0x96},
+	{0x4, hx8394f_720p_video_on_cmd15, 0x32}
 };
 
-#define HX8394F_720P_VIDEO_ON_COMMAND 15
-
+#define HX8394F_720P_VIDEO_ON_COMMAND 16
 
 static char hx8394f_720p_videooff_cmd0[] = {
 	0x28, 0x00, 0x05, 0x80
diff --git a/dev/gcdb/display/include/panel_truly_wuxga_video.h b/dev/gcdb/display/include/panel_truly_wuxga_video.h
new file mode 100644
index 0000000..136d31b
--- /dev/null
+++ b/dev/gcdb/display/include/panel_truly_wuxga_video.h
@@ -0,0 +1,144 @@
+/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution.
+ *  * Neither the name of The Linux Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef _PANEL_TRULY_WUXGA_VIDEO_H_
+
+#define _PANEL_TRULY_WUXGA_VIDEO_H_
+/*---------------------------------------------------------------------------*/
+/* HEADER files                                                              */
+/*---------------------------------------------------------------------------*/
+#include "panel.h"
+
+/*---------------------------------------------------------------------------*/
+/* Panel configuration                                                       */
+/*---------------------------------------------------------------------------*/
+
+static struct panel_config truly_wuxga_video_panel_data = {
+  "qcom,mdss_dsi_truly_wuxga_video", "dsi:0:", "qcom,mdss-dsi-panel",
+  10, 0, "DISPLAY_1", 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, NULL
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel resolution                                                          */
+/*---------------------------------------------------------------------------*/
+static struct panel_resolution truly_wuxga_video_panel_res = {
+  1920, 1200, 96, 64, 16, 0, 4, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel Color Information                                                   */
+/*---------------------------------------------------------------------------*/
+static struct color_info truly_wuxga_video_color = {
+  24, 0, 0xff, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Panel Command information                                                 */
+/*---------------------------------------------------------------------------*/
+static char truly_wuxga_video_on_cmd0[] = {
+0x00, 0x00, 0x32, 0x80, };
+
+static struct mipi_dsi_cmd truly_wuxga_video_on_command[] = {
+{ 0x4 , truly_wuxga_video_on_cmd0, 0x00}
+};
+#define TRULY_WUXGA_VIDEO_ON_COMMAND 1
+
+
+static char truly_wuxga_video_off_cmd0[] = {
+0x00, 0x00, 0x22, 0x80 };
+
+static struct mipi_dsi_cmd truly_wuxga_video_off_command[] = {
+{ 0x4 , truly_wuxga_video_off_cmd0, 0x0}
+};
+#define TRULY_WUXGA_VIDEO_OFF_COMMAND 2
+
+
+static struct command_state truly_wuxga_video_state = {
+  0, 1
+};
+
+/*---------------------------------------------------------------------------*/
+/* Command mode panel information                                            */
+/*---------------------------------------------------------------------------*/
+
+static struct commandpanel_info truly_wuxga_video_command_panel = {
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/*---------------------------------------------------------------------------*/
+/* Video mode panel information                                              */
+/*---------------------------------------------------------------------------*/
+
+static struct videopanel_info truly_wuxga_video_video_panel = {
+  0, 0, 0, 0, 1, 1, 1, 0, 0x9
+};
+
+/*---------------------------------------------------------------------------*/
+/* Lane Configuration                                                        */
+/*---------------------------------------------------------------------------*/
+
+static struct lane_configuration truly_wuxga_video_lane_config = {
+  4, 0, 1, 1, 1, 1, 0
+};
+
+
+/*---------------------------------------------------------------------------*/
+/* Panel Timing                                                              */
+/*---------------------------------------------------------------------------*/
+const uint32_t truly_wuxga_video_timings[] = {
+  0xf3, 0x3a, 0x26, 0x00, 0x6c, 0x6e, 0x2c, 0x3e, 0x2f, 0x03, 0x04, 0x00
+};
+
+static const uint32_t truly_wuxga_14nm_video_timings[] = {
+	0x24, 0x1f, 0x8, 0x9, 0x5, 0x3, 0x4, 0xa0,
+	0x24, 0x1f, 0x8, 0x9, 0x5, 0x3, 0x4, 0xa0,
+	0x24, 0x1f, 0x8, 0x9, 0x5, 0x3, 0x4, 0xa0,
+	0x24, 0x1f, 0x8, 0x9, 0x5, 0x3, 0x4, 0xa0,
+	0x24, 0x1c, 0x8, 0x9, 0x5, 0x3, 0x4, 0xa0,
+};
+
+static struct panel_timing truly_wuxga_video_timing_info = {
+  0, 4, 0x02, 0x2d
+};
+
+static struct panel_reset_sequence truly_wuxga_video_panel_reset_seq = {
+{ 1, 0, 1, }, { 200, 200, 200, }, 2
+};
+
+/*---------------------------------------------------------------------------*/
+/* Backlight Settings                                                        */
+/*---------------------------------------------------------------------------*/
+
+static struct backlight truly_wuxga_video_backlight = {
+  1, 1, 4095, 100, 1, "PMIC_8941"
+};
+
+#define TRULY_WUXGA_VIDEO_SIGNATURE 0xFFFF
+
+#endif /*_TRULY_WUXGA_VIDEO_H_*/
diff --git a/target/msm8952/oem_panel.c b/target/msm8952/oem_panel.c
index 37c6db6..d990f45 100755
--- a/target/msm8952/oem_panel.c
+++ b/target/msm8952/oem_panel.c
@@ -60,6 +60,7 @@
 #include "include/panel_r69006_1080p_video.h"
 #include "include/panel_hx8394f_720p_video.h"
 #include "include/panel_truly_720p_video.h"
+#include "include/panel_truly_wuxga_video.h"
 
 /*---------------------------------------------------------------------------*/
 /* static panel selection variable                                           */
@@ -80,6 +81,7 @@
 	R69006_1080P_VIDEO_PANEL,
 	HX8394F_720P_VIDEO_PANEL,
 	TRULY_720P_VIDEO_PANEL,
+	TRULY_WUXGA_VIDEO_PANEL,
 	UNKNOWN_PANEL
 };
 
@@ -106,7 +108,8 @@
 	{"r69006_1080p_cmd",R69006_1080P_CMD_PANEL},
 	{"r69006_1080p_video",R69006_1080P_VIDEO_PANEL},
 	{"hx8394f_720p_video", HX8394F_720P_VIDEO_PANEL},
-	{"truly_720p_video", TRULY_720P_VIDEO_PANEL}
+	{"truly_720p_video", TRULY_720P_VIDEO_PANEL},
+	{"truly_wuxga_video", TRULY_WUXGA_VIDEO_PANEL}
 };
 
 static uint32_t panel_id;
@@ -619,6 +622,32 @@
 		pinfo->mipi.signature 	= TRULY_720P_VIDEO_SIGNATURE;
 		pinfo->mipi.tx_eot_append = true;
 		break;
+	case TRULY_WUXGA_VIDEO_PANEL:
+		panelstruct->paneldata    = &truly_wuxga_video_panel_data;
+		panelstruct->paneldata->panel_with_enable_gpio = 1;
+		panelstruct->panelres     = &truly_wuxga_video_panel_res;
+		panelstruct->color        = &truly_wuxga_video_color;
+		panelstruct->videopanel   = &truly_wuxga_video_video_panel;
+		panelstruct->commandpanel = &truly_wuxga_video_command_panel;
+		panelstruct->state        = &truly_wuxga_video_state;
+		panelstruct->laneconfig   = &truly_wuxga_video_lane_config;
+		panelstruct->paneltiminginfo
+			= &truly_wuxga_video_timing_info;
+		panelstruct->panelresetseq
+					 = &truly_wuxga_video_panel_reset_seq;
+		panelstruct->backlightinfo = &truly_wuxga_video_backlight;
+		pinfo->mipi.panel_on_cmds
+			= truly_wuxga_video_on_command;
+		pinfo->mipi.num_of_panel_on_cmds
+			= TRULY_WUXGA_VIDEO_ON_COMMAND;
+		pinfo->mipi.panel_off_cmds
+			= truly_wuxga_video_off_command;
+		pinfo->mipi.num_of_panel_off_cmds
+			= TRULY_WUXGA_VIDEO_OFF_COMMAND;
+		memcpy(phy_db->timing,
+			truly_wuxga_video_timings, TIMING_SIZE);
+		pinfo->mipi.signature 	= TRULY_WUXGA_VIDEO_SIGNATURE;
+		break;
 	case UNKNOWN_PANEL:
 	default:
 		memset(panelstruct, 0, sizeof(struct panel_struct));
diff --git a/target/msmtitanium/oem_panel.c b/target/msmtitanium/oem_panel.c
index 1d5ebb1..afbd5d8 100644
--- a/target/msmtitanium/oem_panel.c
+++ b/target/msmtitanium/oem_panel.c
@@ -49,6 +49,7 @@
 #include "include/panel_truly_1080p_cmd.h"
 #include "include/panel_r69006_1080p_video.h"
 #include "include/panel_r69006_1080p_cmd.h"
+#include "include/panel_truly_wuxga_video.h"
 
 
 /*---------------------------------------------------------------------------*/
@@ -59,6 +60,7 @@
 	TRULY_1080P_CMD_PANEL,
 	R69006_1080P_VIDEO_PANEL,
 	R69006_1080P_CMD_PANEL,
+	TRULY_WUXGA_VIDEO_PANEL,
 	UNKNOWN_PANEL
 };
 
@@ -71,6 +73,7 @@
 	{"truly_1080p_cmd", TRULY_1080P_CMD_PANEL},
 	{"r69006_1080p_video", R69006_1080P_VIDEO_PANEL},
 	{"r69006_1080p_cmd", R69006_1080P_CMD_PANEL},
+	{"truly_wuxga_video", TRULY_WUXGA_VIDEO_PANEL},
 };
 
 static uint32_t panel_id;
@@ -110,7 +113,7 @@
 	switch (panel_id) {
 	case TRULY_1080P_VIDEO_PANEL:
 		panelstruct->paneldata    = &truly_1080p_video_panel_data;
-		panelstruct->paneldata->panel_with_enable_gpio = 1;
+		panelstruct->paneldata->panel_with_enable_gpio = 0;
 		panelstruct->panelres     = &truly_1080p_video_panel_res;
 		panelstruct->color        = &truly_1080p_video_color;
 		panelstruct->videopanel   = &truly_1080p_video_video_panel;
@@ -138,7 +141,7 @@
 		break;
 	case TRULY_1080P_CMD_PANEL:
 		panelstruct->paneldata    = &truly_1080p_cmd_panel_data;
-		panelstruct->paneldata->panel_with_enable_gpio = 1;
+		panelstruct->paneldata->panel_with_enable_gpio = 0;
 		panelstruct->panelres     = &truly_1080p_cmd_panel_res;
 		panelstruct->color        = &truly_1080p_cmd_color;
 		panelstruct->videopanel   = &truly_1080p_cmd_video_panel;
@@ -219,6 +222,32 @@
 		pinfo->mipi.tx_eot_append = true;
 		pinfo->mipi.rx_eot_ignore = true;
 		break;
+	case TRULY_WUXGA_VIDEO_PANEL:
+		panelstruct->paneldata    = &truly_wuxga_video_panel_data;
+		panelstruct->paneldata->panel_with_enable_gpio = 1;
+		panelstruct->panelres     = &truly_wuxga_video_panel_res;
+		panelstruct->color        = &truly_wuxga_video_color;
+		panelstruct->videopanel   = &truly_wuxga_video_video_panel;
+		panelstruct->commandpanel = &truly_wuxga_video_command_panel;
+		panelstruct->state        = &truly_wuxga_video_state;
+		panelstruct->laneconfig   = &truly_wuxga_video_lane_config;
+		panelstruct->paneltiminginfo
+			= &truly_wuxga_video_timing_info;
+		panelstruct->panelresetseq
+					 = &truly_wuxga_video_panel_reset_seq;
+		panelstruct->backlightinfo = &truly_wuxga_video_backlight;
+		pinfo->mipi.panel_on_cmds
+			= truly_wuxga_video_on_command;
+		pinfo->mipi.num_of_panel_on_cmds
+			= TRULY_WUXGA_VIDEO_ON_COMMAND;
+		pinfo->mipi.panel_off_cmds
+			= truly_wuxga_video_off_command;
+		pinfo->mipi.num_of_panel_off_cmds
+			= TRULY_WUXGA_VIDEO_OFF_COMMAND;
+		memcpy(phy_db->timing,
+			truly_wuxga_14nm_video_timings, MAX_TIMING_CONFIG * sizeof(uint32_t));
+		pinfo->mipi.signature 	= TRULY_WUXGA_VIDEO_SIGNATURE;
+		break;
 	case UNKNOWN_PANEL:
 	default:
 		memset(panelstruct, 0, sizeof(struct panel_struct));
diff --git a/target/msmtitanium/target_display.c b/target/msmtitanium/target_display.c
index 2032014..59b0453 100644
--- a/target/msmtitanium/target_display.c
+++ b/target/msmtitanium/target_display.c
@@ -69,6 +69,10 @@
   "msmgpio", 59, 3, 1, 0, 1
 };
 
+static struct gpio_pin enable_gpio = {
+  "msmgpio", 12, 3, 1, 0, 1
+};
+
 
 #define VCO_DELAY_USEC 1000
 #define GPIO_STATE_LOW 0
@@ -218,6 +222,15 @@
 
 	if (enable) {
 
+		if (pinfo->mipi.use_enable_gpio) {
+			gpio_tlmm_config(enable_gpio.pin_id, 0,
+				enable_gpio.pin_direction, enable_gpio.pin_pull,
+				enable_gpio.pin_strength,
+				enable_gpio.pin_state);
+
+			gpio_set_dir(enable_gpio.pin_id, 2);
+		}
+
 		gpio_tlmm_config(bkl_gpio.pin_id, 0,
 				bkl_gpio.pin_direction, bkl_gpio.pin_pull,
 				bkl_gpio.pin_strength, bkl_gpio.pin_state);
@@ -241,6 +254,7 @@
 
 	} else if(!target_cont_splash_screen()) {
 		gpio_set_dir(reset_gpio.pin_id, 0);
+		gpio_set_dir(enable_gpio.pin_id, 0);
 	}
 
 	return ret;