Merge "target: Add support to check if display is disabled"
diff --git a/include/stdlib.h b/include/stdlib.h
index 4a90831..de63213 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -50,7 +50,7 @@
 #define ROUNDDOWN(a, b) ((a) & ~((b)-1))
 
 /* Macro returns UINT_MAX in case of overflow */
-#define ROUND_TO_PAGE(x,y) (ROUNDUP((x),(y)+1) < (x))?UINT_MAX:ROUNDUP((x),(y)+1)
+#define ROUND_TO_PAGE(x,y) ((ROUNDUP((x),((y)+1)) < (x))?UINT_MAX:ROUNDUP((x),((y)+1)))
 
 /* allocate a buffer on the stack aligned and padded to the cpu's cache line size */
 #define STACKBUF_DMA_ALIGN(var, size) \
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
index 74e0688..b931ca4 100644
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -514,6 +514,7 @@
 	HW_PLATFORM_SUBTYPE_SWOC_NOWGR_CIRC = 13,
 	HW_PLATFORM_SUBTYPE_8909_PM660 = 15,
 	HW_PLATFORM_SUBTYPE_8909_COMPAL_ALPHA = 19,
+	HW_PLATFORM_SUBTYPE_8909_PM660_V1 = 18,
 	HW_PLATFORM_SUBTYPE_32BITS = 0x7FFFFFFF
 };
 
diff --git a/target/msm8909/init.c b/target/msm8909/init.c
index 3ce3073..5289a6e 100644
--- a/target/msm8909/init.c
+++ b/target/msm8909/init.c
@@ -839,7 +839,8 @@
 
 uint32_t target_get_pmic()
 {
-	if (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_8909_PM660)
+	if ((board_hardware_subtype() == HW_PLATFORM_SUBTYPE_8909_PM660) ||
+		(board_hardware_subtype() == HW_PLATFORM_SUBTYPE_8909_PM660_V1))
 		return PMIC_IS_PM660;
 	else
 		return PMIC_IS_PM8909;
diff --git a/target/msm8909/oem_panel.c b/target/msm8909/oem_panel.c
index e4da42e..051f3cb 100644
--- a/target/msm8909/oem_panel.c
+++ b/target/msm8909/oem_panel.c
@@ -62,6 +62,7 @@
 
 enum {
 	BG_WTP = 0x0F,
+	WTP_V1 = 0x12,
 };
 /*---------------------------------------------------------------------------*/
 /* static panel selection variable                                           */
@@ -484,6 +485,7 @@
 	case HW_PLATFORM_RCM:
 		switch (platform_subtype) {
 		case BG_WTP:
+		case WTP_V1:
 			panel_id = AUO_390P_CMD_PANEL;
 			break;
 		default:
diff --git a/target/msm8909/target_display.c b/target/msm8909/target_display.c
index 526b138..cbb921c 100755
--- a/target/msm8909/target_display.c
+++ b/target/msm8909/target_display.c
@@ -201,7 +201,8 @@
 	if (bl->bl_interface_type == BL_DCS)
 		return 0;
 
-	if (!((HW_PLATFORM_SUBTYPE_8909_PM660 == platform_subtype) &&
+	if (!(((HW_PLATFORM_SUBTYPE_8909_PM660 == platform_subtype) ||
+		(HW_PLATFORM_SUBTYPE_8909_PM660_V1 == platform_subtype)) &&
 		((MSM8909W == platform) || (APQ8009W == platform)) &&
 		(HW_PLATFORM_MTP == hw_id))) {
 		struct pm8x41_mpp mpp;
@@ -298,7 +299,8 @@
 	uint32_t hw_subtype = board_hardware_subtype();
 	uint32_t platform = board_platform_id();
 
-	if ((HW_PLATFORM_SUBTYPE_8909_PM660 == hw_subtype) &&
+	if (((HW_PLATFORM_SUBTYPE_8909_PM660 == hw_subtype) ||
+		(HW_PLATFORM_SUBTYPE_8909_PM660_V1 == hw_subtype)) &&
 		((MSM8909W == platform) || (APQ8009W == platform)) &&
 		(HW_PLATFORM_MTP == hw_id)) {
 		struct pm8x41_gpio bobgpio_param = {
@@ -353,7 +355,8 @@
 	uint32_t platform = board_platform_id();
 
 	if (enable) {
-		if ((HW_PLATFORM_SUBTYPE_8909_PM660 == hw_subtype) &&
+		if (((HW_PLATFORM_SUBTYPE_8909_PM660 == hw_subtype) ||
+			(HW_PLATFORM_SUBTYPE_8909_PM660_V1 == hw_subtype)) &&
 			((MSM8909W == platform) || (APQ8009W == platform)) &&
 			(HW_PLATFORM_MTP == hw_id))
 			regulator_enable(REG_LDO12 | REG_LDO5 | REG_LDO11 | REG_LDO18);