dev:pmi, target: check Usb connection for power off charging

The current driver only checks if the power on reason is PON1 and enters
the power off charging mode. This is not sufficient and one must also check
the charging path along with PON1 before enabling power off charging.

Change-Id: Ie7741d5fe3ca6d10f63d7e0d455fd0bae42e49e6
diff --git a/target/msm8996/init.c b/target/msm8996/init.c
index c6d7d79..5b3db4b 100644
--- a/target/msm8996/init.c
+++ b/target/msm8996/init.c
@@ -73,6 +73,8 @@
 #define VIBRATE_TIME 250
 #endif
 
+#include <pm_smbchg_usb_chgpth.h>
+
 #define CE_INSTANCE             1
 #define CE_EE                   0
 #define CE_FIFO_SIZE            64
@@ -563,17 +565,22 @@
 {
 	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);
+	pm_smbchg_usb_chgpth_pwr_pth_type charger_path = PM_SMBCHG_USB_CHGPTH_PWR_PATH__INVALID;
+	dprintf(INFO, "%s : pon_reason is %d cold_boot:%d charger path: %d\n", __func__,
+		pon_reason, is_cold_boot, charger_path);
 	/* 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
 	*/
+	pm_smbchg_get_charger_path(1, &charger_path);
 	if (is_cold_boot &&
 			(!(pon_reason & HARD_RST)) &&
 			(!(pon_reason & KPDPWR_N)) &&
-			((pon_reason & PON1)))
+			((pon_reason & PON1)) &&
+			((charger_path == PM_SMBCHG_USB_CHGPTH_PWR_PATH__DC_CHARGER) ||
+			(charger_path == PM_SMBCHG_USB_CHGPTH_PWR_PATH__USB_CHARGER)))
+
 		return 1;
 	else
 		return 0;