target: msm8994: Enable charger mode check

Check the boot reason to determine whether need to boot
into charger mode.

Change-Id: I2f9d86f3626634eb01abb4bfb42d443c47785e72
diff --git a/target/msm8994/init.c b/target/msm8994/init.c
index 0780268..961b5a4 100644
--- a/target/msm8994/init.c
+++ b/target/msm8994/init.c
@@ -182,6 +182,26 @@
 {
 }
 
+unsigned target_pause_for_battery_charge(void)
+{
+	uint8_t pon_reason = pm8x41_get_pon_reason();
+	uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
+	dprintf(INFO, "%s : pon_reason is %d cold_boot:%d\n", __func__,
+		pon_reason, is_cold_boot);
+	/* In case of fastboot reboot,adb reboot or if we see the power key
+	* pressed we do not want go into charger mode.
+	* fastboot reboot is warm boot with PON hard reset bit not set
+	* adb reboot is a cold boot with PON hard reset bit set
+	*/
+	if (is_cold_boot &&
+			(!(pon_reason & HARD_RST)) &&
+			(!(pon_reason & KPDPWR_N)) &&
+			((pon_reason & USB_CHG) || (pon_reason & DC_CHG)))
+		return 1;
+	else
+		return 0;
+}
+
 static void set_sdc_power_ctrl(uint8_t slot)
 {
 	uint32_t reg = 0;