dev: gcbd: Added support for dual dsi simulator panel

This change adds support to skip the panel configuration in
bootloader for simulator panels and just passes the panel
string to the kernel and all the configuration are done in
the kernel.
* Reboot the device into fastboot mode
* Run the following command:
  fastboot oem select-display-panel
  <sim_video_panel/sim_dualdsi_video_panel>
* Reboot into apps bootloader
  fastboot reboot-bootloader

Change-Id: I0244b7f805cb1fc3db4d7f38910c0fce044ef886
diff --git a/dev/gcdb/display/gcdb_display.c b/dev/gcdb/display/gcdb_display.c
index 9574a16..97c3ddd 100755
--- a/dev/gcdb/display/gcdb_display.c
+++ b/dev/gcdb/display/gcdb_display.c
@@ -159,7 +159,7 @@
 	return ret;
 }
 
-bool gcdb_display_cmdline_arg(char *pbuf, uint16_t buf_size)
+bool gcdb_display_cmdline_arg(char *panel_name, char *pbuf, uint16_t buf_size)
 {
 	char *dsi_id = NULL;
 	char *panel_node = NULL;
@@ -171,28 +171,29 @@
 	int panel_mode = SPLIT_DISPLAY_FLAG | DUAL_PIPE_FLAG;
 	int prefix_string_len = strlen(DISPLAY_CMDLINE_PREFIX);
 
-	if (panelstruct.paneldata)
-	{
+	if (!strcmp(panel_name, SIM_VIDEO_PANEL)) {
+		dsi_id = SIM_DSI_ID;
+		panel_mode = 0;
+		panel_node = SIM_VIDEO_PANEL_NODE;
+	}  else if (!strcmp(panel_name, SIM_DUALDSI_VIDEO_PANEL)) {
+		dsi_id = SIM_DSI_ID;
+		panel_mode = 1;
+		panel_node = SIM_DUALDSI_VIDEO_PANEL_NODE;
+		slave_panel_node = SIM_DUALDSI_VIDEO_SLAVE_PANEL_NODE;
+	} else if (panelstruct.paneldata) {
 		dsi_id = panelstruct.paneldata->panel_controller;
 		panel_node = panelstruct.paneldata->panel_node_id;
 		panel_mode = panelstruct.paneldata->panel_operating_mode &
 							panel_mode;
 		slave_panel_node = panelstruct.paneldata->slave_panel_node_id;
-	}
-	else
-	{
+	} else {
 		if (target_is_edp())
-		{
 			default_str = "0:edp:";
-		}
 		else
-		{
 			default_str = "0:dsi:0:";
-		}
 
 		arg_size = prefix_string_len + strlen(default_str);
-		if (buf_size < arg_size)
-		{
+		if (buf_size < arg_size) {
 			dprintf(CRITICAL, "display command line buffer is small\n");
 			return false;
 		}
@@ -227,13 +228,10 @@
 	if (panel_mode)
 		arg_size += DSI_1_STRING_LEN + slave_panel_node_len;
 
-	if (buf_size < arg_size)
-	{
+	if (buf_size < arg_size) {
 		dprintf(CRITICAL, "display command line buffer is small\n");
 		ret = false;
-	}
-	else
-	{
+	} else {
 		strlcpy(pbuf, DISPLAY_CMDLINE_PREFIX, buf_size);
 		pbuf += prefix_string_len;
 		buf_size -= prefix_string_len;
diff --git a/dev/gcdb/display/gcdb_display.h b/dev/gcdb/display/gcdb_display.h
index 5727067..23c2811 100755
--- a/dev/gcdb/display/gcdb_display.h
+++ b/dev/gcdb/display/gcdb_display.h
@@ -57,7 +57,7 @@
 int target_ldo_ctrl(uint8_t enable);
 
 int gcdb_display_init(const char *panel_name, uint32_t rev, void *base);
-bool gcdb_display_cmdline_arg(char *pbuf, uint16_t buf_size);
+bool gcdb_display_cmdline_arg(char *panel_name, char *pbuf, uint16_t buf_size);
 void gcdb_display_shutdown();
 
 #endif /*_GCDB_DISPLAY_H_ */
diff --git a/dev/gcdb/display/include/display_resource.h b/dev/gcdb/display/include/display_resource.h
index 5caad1e..ce95769 100755
--- a/dev/gcdb/display/include/display_resource.h
+++ b/dev/gcdb/display/include/display_resource.h
@@ -43,6 +43,13 @@
 #define LK_OVERRIDE_PANEL_LEN  2
 
 #define NO_PANEL_CONFIG "none"
+#define SIM_VIDEO_PANEL "sim_video_panel"
+#define SIM_DUALDSI_VIDEO_PANEL "sim_dualdsi_video_panel"
+
+#define SIM_DSI_ID "dsi:0:"
+#define SIM_VIDEO_PANEL_NODE "qcom,mdss_dsi_sim_video"
+#define SIM_DUALDSI_VIDEO_PANEL_NODE "qcom,mdss_dsi_sim_video_0"
+#define SIM_DUALDSI_VIDEO_SLAVE_PANEL_NODE "qcom,mdss_dsi_sim_video_1"
 
 /*---------------------------------------------------------------------------*/
 /* Structure definition                                                      */
diff --git a/target/apq8084/target_display.c b/target/apq8084/target_display.c
index 3aa2379..1dd3a66 100755
--- a/target/apq8084/target_display.c
+++ b/target/apq8084/target_display.c
@@ -382,7 +382,7 @@
 		buf_size -= LK_OVERRIDE_PANEL_LEN;
 		strlcat(pbuf, HDMI_CONTROLLER_STRING, buf_size);
 	} else {
-		ret = gcdb_display_cmdline_arg(pbuf, buf_size);
+		ret = gcdb_display_cmdline_arg(panel_name, pbuf, buf_size);
 	}
 
 	return ret;
@@ -394,20 +394,20 @@
 
 	panel_name += strspn(panel_name, " ");
 
-	if (!strcmp(panel_name, NO_PANEL_CONFIG)) {
-		dprintf(INFO, "Skip panel configuration\n");
+	if ((!strcmp(panel_name, NO_PANEL_CONFIG))
+			|| (!strcmp(panel_name, SIM_VIDEO_PANEL))
+			|| (!strcmp(panel_name, SIM_DUALDSI_VIDEO_PANEL))) {
+		dprintf(INFO, "Selected panel: %s\nSkip panel configuration\n",
+								panel_name);
 		return;
-	}
-
-	if (!strcmp(panel_name, HDMI_PANEL_NAME)) {
+	} else if (!strcmp(panel_name, HDMI_PANEL_NAME)) {
 		dprintf(INFO, "%s: HDMI is primary\n", __func__);
 		return;
 	}
 
 	ret = gcdb_display_init(panel_name, MDP_REV_50, MIPI_FB_ADDR);
-	if (ret) {
+	if (ret)
 		msm_display_off();
-	}
 }
 
 void target_display_shutdown(void)
diff --git a/target/msm8226/target_display.c b/target/msm8226/target_display.c
index d21fb94..355d8c9 100755
--- a/target/msm8226/target_display.c
+++ b/target/msm8226/target_display.c
@@ -389,7 +389,7 @@
 
 bool target_display_panel_node(char *panel_name, char *pbuf, uint16_t buf_size)
 {
-	return gcdb_display_cmdline_arg(pbuf, buf_size);
+	return gcdb_display_cmdline_arg(panel_name, pbuf, buf_size);
 }
 
 void target_display_init(const char *panel_name)
@@ -398,8 +398,10 @@
         uint32_t ret = 0;
 	uint32_t fb_addr = MIPI_FB_ADDR;
 
-	if (!strcmp(panel_name, NO_PANEL_CONFIG)) {
-		dprintf(INFO, "Skip panel configuration\n");
+	if ((!strcmp(panel_name, NO_PANEL_CONFIG))
+			|| (!strcmp(panel_name, SIM_VIDEO_PANEL))) {
+		dprintf(INFO, "Selected panel: %s\nSkip panel configuration\n",
+								panel_name);
 		return;
 	}
 
diff --git a/target/msm8610/target_display.c b/target/msm8610/target_display.c
index cb9f3ce..66dbbdd 100755
--- a/target/msm8610/target_display.c
+++ b/target/msm8610/target_display.c
@@ -164,7 +164,7 @@
 
 bool target_display_panel_node(char *panel_name, char *pbuf, uint16_t buf_size)
 {
-	return gcdb_display_cmdline_arg(pbuf, buf_size);
+	return gcdb_display_cmdline_arg(panel_name, pbuf, buf_size);
 }
 
 void target_display_init(const char *panel_name)
diff --git a/target/msm8916/target_display.c b/target/msm8916/target_display.c
index ea9dcfe..6d189fa 100755
--- a/target/msm8916/target_display.c
+++ b/target/msm8916/target_display.c
@@ -363,7 +363,7 @@
 
 bool target_display_panel_node(char *panel_name, char *pbuf, uint16_t buf_size)
 {
-	return gcdb_display_cmdline_arg(pbuf, buf_size);
+	return gcdb_display_cmdline_arg(panel_name, pbuf, buf_size);
 }
 
 void target_display_init(const char *panel_name)
@@ -371,8 +371,10 @@
 	uint32_t panel_loop = 0;
 	uint32_t ret = 0;
 
-	if (!strcmp(panel_name, NO_PANEL_CONFIG)) {
-		dprintf(INFO, "Skip panel configuration\n");
+	if ((!strcmp(panel_name, NO_PANEL_CONFIG))
+			|| (!strcmp(panel_name, SIM_VIDEO_PANEL))) {
+		dprintf(INFO, "Selected panel: %s\nSkip panel configuration\n",
+								panel_name);
 		return;
 	}
 
diff --git a/target/msm8974/target_display.c b/target/msm8974/target_display.c
index 7d985a3..1c236b6 100755
--- a/target/msm8974/target_display.c
+++ b/target/msm8974/target_display.c
@@ -382,7 +382,7 @@
 		buf_size -= LK_OVERRIDE_PANEL_LEN;
 		strlcat(pbuf, HDMI_CONTROLLER_STRING, buf_size);
 	} else {
-		ret = gcdb_display_cmdline_arg(pbuf, buf_size);
+		ret = gcdb_display_cmdline_arg(panel_name, pbuf, buf_size);
 	}
 
 	return ret;
@@ -399,16 +399,16 @@
 
 	panel_name += strspn(panel_name, " ");
 
-	if (!strcmp(panel_name, NO_PANEL_CONFIG)) {
-		dprintf(INFO, "Skip panel configuration\n");
+	if ((!strcmp(panel_name, NO_PANEL_CONFIG))
+			|| (!strcmp(panel_name, SIM_VIDEO_PANEL))
+			|| (!strcmp(panel_name, SIM_DUALDSI_VIDEO_PANEL))) {
+		dprintf(INFO, "Selected panel: %s\nSkip panel configuration",
+								panel_name);
 		return;
-	}
-
-	if (!strcmp(panel_name, HDMI_PANEL_NAME)) {
+	} else if (!strcmp(panel_name, HDMI_PANEL_NAME)) {
 		dprintf(INFO, "%s: HDMI is primary\n", __func__);
 		return;
 	}
-
 	switch (hw_id) {
 	case HW_PLATFORM_LIQUID:
 		edp_panel_init(&(panel.panel_info));