Merge "platform: msm-shared: Include date in boot security patch"
diff --git a/dev/gcdb/display/include/panel_edo_rm67162_qvga_cmd.h b/dev/gcdb/display/include/panel_edo_rm67162_qvga_cmd.h
index d91a1b7..eaa4563 100644
--- a/dev/gcdb/display/include/panel_edo_rm67162_qvga_cmd.h
+++ b/dev/gcdb/display/include/panel_edo_rm67162_qvga_cmd.h
@@ -38,7 +38,7 @@
 /*---------------------------------------------------------------------------*/
 static struct panel_config edo_rm67162_qvga_cmd_panel_data = {
 	"qcom,mdss_dsi_edo_rm67162_qvga_cmd", "dsi:0:", "qcom,mdss-dsi-panel",
-	10, 1, "DISPLAY_1", 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+	10, 1, "DISPLAY_1", 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL
 };
 
 /*---------------------------------------------------------------------------*/
@@ -90,7 +90,7 @@
 
 static char edo_rm67162_qvga_cmd_on_cmd6[] = {
 	0x02, 0x00, 0x29, 0xC0,
-	0x51, 0x00, 0xFF, 0xFF,
+	0x51, 0xFF, 0xFF, 0xFF,
 };
 
 static char edo_rm67162_qvga_cmd_on_cmd7[] = {
@@ -172,7 +172,7 @@
 /* Lane configuration                                                        */
 /*---------------------------------------------------------------------------*/
 static struct lane_configuration edo_rm67162_qvga_cmd_lane_config = {
-	1, 0, 1, 0, 0, 0
+	1, 0, 1, 0, 0, 0, 0
 };
 
 /*---------------------------------------------------------------------------*/
@@ -183,7 +183,7 @@
 };
 
 static struct panel_timing edo_rm67162_qvga_cmd_timing_info = {
-	0, 4, 0x20, 0x2c
+	0, 4, 0x09, 0x2c
 };
 
 /*---------------------------------------------------------------------------*/
@@ -197,7 +197,7 @@
 /* Backlight setting                                                         */
 /*---------------------------------------------------------------------------*/
 static struct backlight edo_rm67162_qvga_cmd_backlight = {
-	1, 1, 4095, 100, 1, "PMIC_8941"
+	2, 1, 255, 100, 2, "BL_CTL_DCS"
 };
 
 #endif /*_PANEL_EDO_RM67162_QVGA_CMD_H_*/
diff --git a/platform/msm_shared/include/regulator.h b/platform/msm_shared/include/regulator.h
index 9759354..fa68fff 100644
--- a/platform/msm_shared/include/regulator.h
+++ b/platform/msm_shared/include/regulator.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2017,2019 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
@@ -71,7 +71,9 @@
 #define REG_LDO6	BIT(5)
 #define REG_LDO11	BIT(10)
 #define REG_LDO12	BIT(11)
+#define REG_LDO13	BIT(12)
 #define REG_LDO14	BIT(13)
+#define REG_LDO15	BIT(14)
 #define REG_LDO17	BIT(16)
 #define REG_LDO18	BIT(17)
 #define REG_LDO28	BIT(27)
diff --git a/target/msm8952/oem_panel.c b/target/msm8952/oem_panel.c
index 27f7eec..55619e7 100644
--- a/target/msm8952/oem_panel.c
+++ b/target/msm8952/oem_panel.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, 2018 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2016, 2018-2019 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
@@ -65,6 +65,7 @@
 #include "include/panel_lead_fl10802_fwvga_video.h"
 #include "include/panel_hx8399c_fhd_pluse_video.h"
 #include "include/panel_hx8399c_hd_plus_video.h"
+#include "include/panel_edo_rm67162_qvga_cmd.h"
 #include "include/panel_nt35695b_truly_fhd_video.h"
 #include "include/panel_nt35695b_truly_fhd_cmd.h"
 
@@ -94,6 +95,7 @@
 	HX8399C_HD_PLUS_VIDEO_PANEL,
 	NT35695B_TRULY_FHD_VIDEO_PANEL,
 	NT35695B_TRULY_FHD_CMD_PANEL,
+	RM67162_QVGA_CMD_PANEL,
 	UNKNOWN_PANEL
 };
 
@@ -128,6 +130,7 @@
 	{"hx8399c_hd_plus_video", HX8399C_HD_PLUS_VIDEO_PANEL},
 	{"nt35695b_truly_fhd_video", NT35695B_TRULY_FHD_VIDEO_PANEL},
 	{"nt35695b_truly_fhd_cmd", NT35695B_TRULY_FHD_CMD_PANEL},
+	{"rm67162_qvga_cmd", RM67162_QVGA_CMD_PANEL},
 };
 
 static uint32_t panel_id;
@@ -815,6 +818,37 @@
 		pinfo->mipi.signature    = HX8399C_HD_PLUS_VIDEO_SIGNATURE;
 		pinfo->mipi.tx_eot_append = true;
 		break;
+	case RM67162_QVGA_CMD_PANEL:
+		panelstruct->paneldata    = &edo_rm67162_qvga_cmd_panel_data;
+		panelstruct->panelres     = &edo_rm67162_qvga_cmd_panel_res;
+		panelstruct->color        = &edo_rm67162_qvga_cmd_color;
+		panelstruct->videopanel   =
+				&edo_rm67162_qvga_cmd_video_panel;
+		panelstruct->commandpanel =
+				&edo_rm67162_qvga_cmd_command_panel;
+		panelstruct->state        = &edo_rm67162_qvga_cmd_state;
+		panelstruct->laneconfig   =
+				&edo_rm67162_qvga_cmd_lane_config;
+		panelstruct->paneltiminginfo
+				= &edo_rm67162_qvga_cmd_timing_info;
+		panelstruct->panelresetseq
+				= &edo_rm67162_qvga_cmd_reset_seq;
+		panelstruct->backlightinfo = &edo_rm67162_qvga_cmd_backlight;
+		pinfo->labibb = NULL;
+		pinfo->mipi.panel_on_cmds
+				= edo_rm67162_qvga_cmd_on_command;
+		pinfo->mipi.num_of_panel_on_cmds
+				= EDO_RM67162_QVGA_CMD_ON_COMMAND;
+		pinfo->mipi.panel_off_cmds
+				= edo_rm67162_qvga_cmd_off_command;
+		pinfo->mipi.num_of_panel_off_cmds
+				= EDO_RM67162_QVGA_CMD_OFF_COMMAND;
+		if (phy_db->pll_type == DSI_PLL_TYPE_12NM)
+			memcpy(phy_db->timing,
+				edo_rm67162_qvga_cmd_12nm_timings,
+				TIMING_SIZE_12NM);
+		pinfo->mipi.tx_eot_append = true;
+		break;
 	case NT35695B_TRULY_FHD_VIDEO_PANEL:
 		panelstruct->paneldata    = &nt35695b_truly_fhd_video_panel_data;
 		panelstruct->panelres     = &nt35695b_truly_fhd_video_panel_res;
@@ -1008,7 +1042,10 @@
 		}
 
 		if (platform_is_sdm429()) {
-			panel_id = HX8399C_HD_PLUS_VIDEO_PANEL;
+			if (hw_subtype == HW_PLATFORM_SUBTYPE_429W_PM660) /* Spyro target */
+				panel_id = RM67162_QVGA_CMD_PANEL;
+			else
+				panel_id = HX8399C_HD_PLUS_VIDEO_PANEL;
 		}
 
 		/* QRD EVT1 uses OTM1906C, and EVT2 uses HX8394F */
diff --git a/target/msm8952/regulator.c b/target/msm8952/regulator.c
index ee08d30..ecb2ba3 100644
--- a/target/msm8952/regulator.c
+++ b/target/msm8952/regulator.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, 2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015, 2018-2019, 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
@@ -32,6 +32,7 @@
 #include <bits.h>
 #include <debug.h>
 #include <platform.h>
+#include <board.h>
 
 
 static uint32_t ldo1[][11]=
@@ -101,6 +102,56 @@
 	},
 };
 
+static uint32_t ldo6_pm660[][11]=
+{
+	{
+		LDOA_RES_TYPE, 6,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_DISABLE,
+		KEY_MICRO_VOLT, 4, 0,
+		KEY_CURRENT, 4, 0,
+	},
+
+	{
+		LDOA_RES_TYPE, 6,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_ENABLE,
+		KEY_MICRO_VOLT, 4, 800000,
+		KEY_CURRENT, 4, 150,
+	},
+};
+
+static uint32_t ldo13_pm660[][11]=
+{
+	{
+		LDOA_RES_TYPE, 13,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_DISABLE,
+		KEY_MICRO_VOLT, 4, 0,
+		KEY_CURRENT, 4, 0,
+	},
+
+	{
+		LDOA_RES_TYPE, 13,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_ENABLE,
+		KEY_MICRO_VOLT, 4, 1800000,
+		KEY_CURRENT, 4, 40,
+	},
+};
+
+static uint32_t ldo15_pm660[][11]=
+{
+	{
+		LDOA_RES_TYPE, 15,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_DISABLE,
+		KEY_MICRO_VOLT, 4, 0,
+		KEY_CURRENT, 4, 0,
+	},
+
+	{
+		LDOA_RES_TYPE, 15,
+		KEY_SOFTWARE_ENABLE, 4, GENERIC_ENABLE,
+		KEY_MICRO_VOLT, 4, 2800000,
+		KEY_CURRENT, 4, 40,
+	},
+};
 
 static uint32_t ldo17[][11]=
 {
@@ -121,6 +172,8 @@
 
 void regulator_enable(uint32_t enable)
 {
+	uint32_t hw_subtype = board_hardware_subtype();
+
 	if (platform_is_msm8956()) {
 		if (enable & REG_LDO1)
 			rpm_send_data(&ldo1[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
@@ -134,11 +187,26 @@
 			rpm_send_data(&ldo2[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
 	}
 
+	if (platform_is_sdm429() && hw_subtype
+			== HW_PLATFORM_SUBTYPE_429W_PM660) {
+		if (enable & REG_LDO13)
+			rpm_send_data(&ldo13_pm660[GENERIC_ENABLE][0],
+				36, RPM_REQUEST_TYPE);
+		if (enable & REG_LDO15)
+			rpm_send_data(&ldo15_pm660[GENERIC_ENABLE][0],
+				36, RPM_REQUEST_TYPE);
+	}
+
 	if (enable & REG_LDO17)
 		rpm_send_data(&ldo17[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
 
-	if (enable & REG_LDO6)
-		rpm_send_data(&ldo6[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
+	if (enable & REG_LDO6) {
+		if (platform_is_sdm429() && hw_subtype
+				== HW_PLATFORM_SUBTYPE_429W_PM660)
+			rpm_send_data(&ldo6_pm660[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
+		else
+			rpm_send_data(&ldo6[GENERIC_ENABLE][0], 36, RPM_REQUEST_TYPE);
+	}
 }
 
 void regulator_disable(uint32_t enable)
diff --git a/target/msm8952/target_display.c b/target/msm8952/target_display.c
index 38cf975..7d74abe 100644
--- a/target/msm8952/target_display.c
+++ b/target/msm8952/target_display.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2019, 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
@@ -452,6 +452,12 @@
 		pinfo->mipi.use_enable_gpio = 1;
 	} else if (platform_is_sdm439() || platform_is_sdm429()) {
 		reset_gpio.pin_id = 60;
+		if (platform_is_sdm429() && hw_subtype
+			== HW_PLATFORM_SUBTYPE_429W_PM660) {
+			reset_gpio.pin_id = 60;
+			pinfo->mipi.use_enable_gpio = 1;
+			enable_gpio.pin_id = 69;
+		}
 	} else if ((hw_id == HW_PLATFORM_QRD) &&
 		   (hw_subtype == HW_PLATFORM_SUBTYPE_POLARIS)) {
 		enable_gpio.pin_id = 19;
@@ -650,6 +656,7 @@
 	int rc = 0;
 	uint32_t ldo_num = REG_LDO6 | REG_LDO17;
 	uint32_t pmic_type = target_get_pmic();
+	uint32_t hw_subtype = board_hardware_subtype();
 
 	if (platform_is_msm8956())
 		ldo_num |= REG_LDO1;
@@ -658,6 +665,10 @@
 	else
 		ldo_num |= REG_LDO2;
 
+	if (platform_is_sdm429() && hw_subtype
+		== HW_PLATFORM_SUBTYPE_429W_PM660)
+		ldo_num |= REG_LDO13 | REG_LDO15;
+
 	if (enable) {
 		regulator_enable(ldo_num);
 		mdelay(10);
@@ -683,6 +694,10 @@
 		 * Do not disable them.
 		 */
 		regulator_disable(REG_LDO17);
+
+		if (platform_is_sdm429() && hw_subtype
+			== HW_PLATFORM_SUBTYPE_429W_PM660)
+			regulator_disable(REG_LDO13 | REG_LDO15);
 	}
 
 	return NO_ERROR;