platform: Add function to detect the panel and pick up corresponding DT

For 8909, add function to detect the panel as HD/qHD based on the value
read from a register and update the bits 11:12 of the hlos_subtype
accordingly, so as to pick the correct DT.

Change-Id: Ic2e3b053c6423afe5c6604c3d6b84fd0a54dc027
diff --git a/platform/init.c b/platform/init.c
index 4783eba..aeb4f20 100644
--- a/platform/init.c
+++ b/platform/init.c
@@ -135,3 +135,8 @@
 {
 	return ((val & 0x3E) >> 1);
 }
+
+__WEAK uint32_t platform_detect_panel()
+{
+	return 0;
+}
diff --git a/platform/msm8909/include/platform/iomap.h b/platform/msm8909/include/platform/iomap.h
index e199906..2523f49 100644
--- a/platform/msm8909/include/platform/iomap.h
+++ b/platform/msm8909/include/platform/iomap.h
@@ -246,6 +246,7 @@
 #define BOOT_CONFIG_OFFSET          0x0000602C
 #define BOOT_CONFIG_REG             (SEC_CTRL_CORE_BASE + BOOT_CONFIG_OFFSET)
 
+#define SECURITY_CONTROL_CORE_FEATURE_CONFIG0    0x0005E004
 /* EBI2 */
 #define TLMM_EBI2_EMMC_GPIO_CFG     (TLMM_BASE_ADDR + 0x00111000)
 #endif
diff --git a/platform/msm8909/platform.c b/platform/msm8909/platform.c
index 6479681..83f9060 100644
--- a/platform/msm8909/platform.c
+++ b/platform/msm8909/platform.c
@@ -208,3 +208,22 @@
 {
 	return ((val & 0x0E) >> 1);
 }
+
+uint32_t platform_detect_panel()
+{
+	uint32_t panel;
+
+	/* Bits 28:29 of this register are read to know
+	the panel config, and pick up DT accordingly.
+
+	00 -no limit, suport HD
+	01 - limit to 720P
+	10- limit to qHD
+	11- limit to fWVGA
+
+	*/
+	panel = readl(SECURITY_CONTROL_CORE_FEATURE_CONFIG0);
+	panel = (panel & 0x30000000) >> 28;
+
+	return panel;
+}
diff --git a/platform/msm_shared/board.c b/platform/msm_shared/board.c
index 3b2493d..89fb195 100644
--- a/platform/msm_shared/board.c
+++ b/platform/msm_shared/board.c
@@ -236,11 +236,11 @@
 		}
 
 		/* HLOS subtype
-		 * bit no                        |31    20 | 19        16| 15          8 | 7     0|
-		 * board.platform_hlos_subtype = |reserved | Boot device | DDR detection | subtype|
-		 *                               |  bits   |             |   bits        |
+		 * bit no                        |31    20 | 19        16|15    13 |12      11 | 10          8 | 7     0|
+		 * board.platform_hlos_subtype = |reserved | Boot device |Reserved | Panel     | DDR detection | subtype|
+		 *                               |  bits   |             |  bits   | Detection |
 		 */
-		board.platform_hlos_subtype = (board_get_ddr_subtype() << 8) | (platform_get_boot_dev() << 16);
+		board.platform_hlos_subtype = (board_get_ddr_subtype() << 8) | (platform_get_boot_dev() << 16) | (platform_detect_panel() << 11);
 	}
 	else
 	{