Merge "platform : msm_shared: updated Qusb sequence"
diff --git a/dev/pmic/pmi8994/pm_fg_adc_usr.c b/dev/pmic/pmi8994/pm_fg_adc_usr.c
index e7e01fc..e80faa0 100644
--- a/dev/pmic/pmi8994/pm_fg_adc_usr.c
+++ b/dev/pmic/pmi8994/pm_fg_adc_usr.c
@@ -1261,7 +1261,7 @@
 
   /* Applying gain calibration to the raw value*/
   // Twos_complement(VBAT_registerval) *39 * (1+ Twos_Complement(V_GAIN_registerval) * (.32/128))
-  *calibrated_vbat = (uint32)(((raw_vbat * (GAIN_LSB_DENOM + gain)))/GAIN_LSB_DENOM);
+  *calibrated_vbat = (uint32)((((raw_vbat + 2) * (GAIN_LSB_DENOM + gain)))/GAIN_LSB_DENOM);
 
   return errFlag;
 }
diff --git a/dev/qpnp_haptic/qpnp_haptic.c b/dev/qpnp_haptic/qpnp_haptic.c
index e1200a1..e472dff 100644
--- a/dev/qpnp_haptic/qpnp_haptic.c
+++ b/dev/qpnp_haptic/qpnp_haptic.c
@@ -32,7 +32,7 @@
 #include <target.h>
 #include <vibrator.h>
 
-#define HAPTIC_BASE (PMI_ADDR_BASE+ 0xC000)
+#define HAPTIC_BASE (PMI_SECOND_SLAVE_ADDR_BASE+ 0xC000)
 #define QPNP_HAP_EN_CTL_REG (HAPTIC_BASE + 0x46)
 #define QPNP_HAP_EN_CTL2_REG (HAPTIC_BASE + 0x48)
 #define QPNP_HAP_ACT_TYPE_REG (HAPTIC_BASE + 0x4C)
diff --git a/platform/msm8952/include/platform/iomap.h b/platform/msm8952/include/platform/iomap.h
index 2bf5d7e..c135f3f 100644
--- a/platform/msm8952/include/platform/iomap.h
+++ b/platform/msm8952/include/platform/iomap.h
@@ -70,8 +70,12 @@
 
 #define CLK_CTL_BASE                       0x1800000
 
-#define PMI_SLAVE_ID 3
-#define PMI_ADDR_BASE (PMI_SLAVE_ID << 16)
+#define PMI_SLAVE_BASE           2
+#define PMI_FIRST_SLAVE_OFFSET   0
+#define PMI_SECOND_SLAVE_OFFSET  1
+
+#define PMI_FIRST_SLAVE_ADDR_BASE   (( PMI_SLAVE_BASE + PMI_FIRST_SLAVE_OFFSET ) << 16)
+#define PMI_SECOND_SLAVE_ADDR_BASE  (( PMI_SLAVE_BASE + PMI_SECOND_SLAVE_OFFSET) << 16)
 
 #define SPMI_BASE                          0x02000000
 #define SPMI_GENI_BASE                     (SPMI_BASE + 0xA000)
diff --git a/platform/msm8996/include/platform/iomap.h b/platform/msm8996/include/platform/iomap.h
index de4616b..265d7c7 100644
--- a/platform/msm8996/include/platform/iomap.h
+++ b/platform/msm8996/include/platform/iomap.h
@@ -85,6 +85,13 @@
 /* Clocks */
 #define CLK_CTL_BASE                0x300000
 
+#define PMI_SLAVE_BASE           2
+#define PMI_FIRST_SLAVE_OFFSET   0
+#define PMI_SECOND_SLAVE_OFFSET  1
+
+#define PMI_FIRST_SLAVE_ADDR_BASE   (( PMI_SLAVE_BASE + PMI_FIRST_SLAVE_OFFSET ) << 16)
+#define PMI_SECOND_SLAVE_ADDR_BASE  (( PMI_SLAVE_BASE + PMI_SECOND_SLAVE_OFFSET) << 16)
+
 /* GPLL */
 #define GPLL0_MODE                  (CLK_CTL_BASE + 0x0000)
 #define GPLL4_MODE                  (CLK_CTL_BASE + 0x77000)
diff --git a/platform/msm_shared/rules.mk b/platform/msm_shared/rules.mk
index bffa003..b6647d8 100644
--- a/platform/msm_shared/rules.mk
+++ b/platform/msm_shared/rules.mk
@@ -558,7 +558,8 @@
 			$(LOCAL_DIR)/mipi_dsi.o \
 			$(LOCAL_DIR)/mipi_dsc.o \
 			$(LOCAL_DIR)/mipi_dsi_phy.o \
-			$(LOCAL_DIR)/mipi_dsi_autopll_thulium.o
+			$(LOCAL_DIR)/mipi_dsi_autopll_thulium.o \
+			$(LOCAL_DIR)/shutdown_detect.o
 endif
 
 ifeq ($(ENABLE_UFS_SUPPORT), 1)
diff --git a/project/msm8996.mk b/project/msm8996.mk
index 586922a..368dc99 100644
--- a/project/msm8996.mk
+++ b/project/msm8996.mk
@@ -48,9 +48,18 @@
 #Enable below flag to compile cmnlib64
 #DEFINES += ENABLE_CMNLIB64_LOADING=1
 
+ENABLE_HAP_VIB_SUPPORT := true
+
+#Enable the feature of long press power on
+DEFINES += LONG_PRESS_POWER_ON=1
+
 #Disable thumb mode
 ENABLE_THUMB := false
 
+ifeq ($(ENABLE_HAP_VIB_SUPPORT),true)
+DEFINES += PON_VIB_SUPPORT=1
+endif
+
 ifeq ($(ENABLE_GLINK_SUPPORT),1)
 DEFINES += GLINK_SUPPORT=1
 endif
diff --git a/target/mdm9640/init.c b/target/mdm9640/init.c
index 62d48ab..0b8cb1e 100644
--- a/target/mdm9640/init.c
+++ b/target/mdm9640/init.c
@@ -279,7 +279,7 @@
 			ret = 0;
 		}
 		else {
-			buflen = strlen("EXT4_CMDLINE") + sizeof(int) +1;
+			buflen = strlen(EXT4_CMDLINE) + sizeof(int) +1;
 			*buf = (char *)malloc(buflen);
 			if(!(*buf)) {
 				dprintf(CRITICAL,"Unable to allocate memory for boot params\n");
diff --git a/target/msm8952/init.c b/target/msm8952/init.c
index 41ff356..bc6f813 100644
--- a/target/msm8952/init.c
+++ b/target/msm8952/init.c
@@ -384,7 +384,7 @@
 	else
 		reset_type = PON_PSHOLD_HARD_RESET;
 
-	pm8x41_reset_configure(reset_type);
+	pm8994_reset_configure(reset_type);
 
 	ret = scm_halt_pmic_arbiter();
 	if (ret)
diff --git a/target/msm8996/init.c b/target/msm8996/init.c
index a60a4dd..07295f1 100644
--- a/target/msm8996/init.c
+++ b/target/msm8996/init.c
@@ -66,6 +66,10 @@
 #include <shutdown_detect.h>
 #endif
 
+#if PON_VIB_SUPPORT
+#include <vibrator.h>
+#define VIBRATE_TIME 250
+#endif
 
 #define CE_INSTANCE             1
 #define CE_EE                   0
@@ -271,6 +275,7 @@
 	rpm_glink_init();
 
 	target_keystatus();
+
 #if defined(LONG_PRESS_POWER_ON) || defined(PON_VIB_SUPPORT)
 	switch(board_hardware_id())
 	{
@@ -278,6 +283,9 @@
 #if LONG_PRESS_POWER_ON
 			shutdown_detect();
 #endif
+#if PON_VIB_SUPPORT
+			vib_timed_turn_on(VIBRATE_TIME);
+#endif
 			break;
 	}
 #endif
diff --git a/target/msm8996/rules.mk b/target/msm8996/rules.mk
index 6f06109..e59bfc2 100644
--- a/target/msm8996/rules.mk
+++ b/target/msm8996/rules.mk
@@ -31,6 +31,8 @@
 MODULES += \
 	dev/keys \
 	dev/pmic/pm8x41 \
+	dev/qpnp_haptic \
+	dev/vib \
 	dev/qpnp_wled \
 	dev/qpnp_led \
 	dev/gcdb/display \