target: msm8996: Make HDMI as primary by default for APQ8096

Set the default primary display panel to HDMI whenever the
platform is APQ8096-mediabox.

CRs-Fixed: 1036047
Change-Id: Ia9faee45f6a89cc505409baba59a79c75bbd3600
diff --git a/dev/gcdb/display/gcdb_display_param.c b/dev/gcdb/display/gcdb_display_param.c
index 44b3454..139708c 100644
--- a/dev/gcdb/display/gcdb_display_param.c
+++ b/dev/gcdb/display/gcdb_display_param.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-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
@@ -290,7 +290,7 @@
 	uint32_t arg_size = 0;
 	bool ret = true, rc;
 	int ret_val;
-	char *default_str;
+	const char *default_str;
 	struct panel_struct panelstruct;
 	int panel_mode = SPLIT_DISPLAY_FLAG | DUAL_PIPE_FLAG | DST_SPLIT_FLAG;
 	int prefix_string_len = strlen(DISPLAY_CMDLINE_PREFIX);
@@ -318,11 +318,7 @@
 			panel_node = NO_PANEL_CONFIG;
 			panel_mode = 0;
 		} else {
-			if (target_is_edp())
-				default_str = "0:edp:";
-			else
-				default_str = "0:dsi:0:";
-
+			default_str = "0";
 			arg_size = prefix_string_len + strlen(default_str);
 			if (buf_size < arg_size) {
 				dprintf(CRITICAL, "display command line buffer is small\n");
diff --git a/include/platform.h b/include/platform.h
index dd23381..2eaa95b 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -78,6 +78,7 @@
 uint32_t platform_detect_panel();
 uint32_t platform_get_max_periph();
 int platform_is_msm8996();
+int platform_is_apq8096_mediabox();
 bool platform_use_qmp_misc_settings();
 void set_device_unlock_value(int type, bool status);
 void get_product_name(unsigned char *buf);
diff --git a/platform/msm8996/platform.c b/platform/msm8996/platform.c
index a3c2d3e..e98db35 100644
--- a/platform/msm8996/platform.c
+++ b/platform/msm8996/platform.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-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
@@ -169,6 +169,13 @@
 		return 0;
 }
 
+int platform_is_apq8096_mediabox()
+{
+		return ((board_platform_id() == APQ8096) &&
+		(board_hardware_id() == HW_PLATFORM_DRAGON) &&
+		(board_hardware_subtype() == HW_PLATFORM_SUBTYPE_SVLTE1));
+}
+
 uint64_t platform_get_ddr_start()
 {
 	return ddr_start;
diff --git a/target/msm8996/target_display.c b/target/msm8996/target_display.c
index e7cc537..19e8b56 100644
--- a/target/msm8996/target_display.c
+++ b/target/msm8996/target_display.c
@@ -706,7 +706,8 @@
 	struct oem_panel_data oem = mdss_dsi_get_oem_data();
 	char vic_buf[HDMI_VIC_LEN] = "0";
 
-	if (!strcmp(oem.panel, HDMI_PANEL_NAME)) {
+	if ((!strcmp(oem.panel, HDMI_PANEL_NAME)) || \
+		((!strlen(oem.panel)) && (platform_is_apq8096_mediabox()))) {
 		if (buf_size < (prefix_string_len + LK_OVERRIDE_PANEL_LEN +
 				strlen(HDMI_CONTROLLER_STRING))) {
 			dprintf(CRITICAL, "command line argument is greater than buffer size\n");
@@ -757,7 +758,8 @@
 		dprintf(INFO, "Selected panel: %s\nSkip panel configuration\n",
 			oem.panel);
 		return;
-	} else if (!strcmp(oem.panel, HDMI_PANEL_NAME)) {
+	} else if ((!strcmp(oem.panel, HDMI_PANEL_NAME)) || \
+		((!strlen(oem.panel)) && (platform_is_apq8096_mediabox()))) {
 		dprintf(INFO, "%s: HDMI is primary\n", __func__);
 		mdss_hdmi_display_init(MDP_REV_50, (void *) HDMI_FB_ADDR);
 		return;
@@ -777,7 +779,8 @@
 void target_display_shutdown(void)
 {
 	struct oem_panel_data oem = mdss_dsi_get_oem_data();
-	if (!strcmp(oem.panel, HDMI_PANEL_NAME)) {
+	if ((!strcmp(oem.panel, HDMI_PANEL_NAME)) || \
+		((!strlen(oem.panel)) && (platform_is_apq8096_mediabox()))) {
 		msm_display_off();
 	} else {
 		gcdb_display_shutdown();