dev: pmic: pm8x41: Add PMI632 PON register read support

Change to read correct USB Input status and PON register
for PMI632.

Change-Id: I170d9f2817ee283dc5496d2b1c9acd65c1cc0a4f
Signed-off-by: Umang Agrawal <uagrawal@codeaurora.org>
diff --git a/dev/pmic/pm8x41/include/pm8x41.h b/dev/pmic/pm8x41/include/pm8x41.h
index 0fc517b..e289623 100644
--- a/dev/pmic/pm8x41/include/pm8x41.h
+++ b/dev/pmic/pm8x41/include/pm8x41.h
@@ -232,6 +232,7 @@
 uint8_t pm8x41_get_pon_reason();
 uint8_t pm660_get_pon_reason();
 uint8_t pm8950_get_pon_reason();
+uint8_t pmi632_get_pon_reason();
 uint8_t pm8x41_get_pon_poff_reason1();
 uint8_t pm8x41_get_pon_poff_reason2();
 uint32_t pm8x41_get_pwrkey_is_pressed();
diff --git a/dev/pmic/pm8x41/include/pm8x41_hw.h b/dev/pmic/pm8x41/include/pm8x41_hw.h
index d213582..d719243 100644
--- a/dev/pmic/pm8x41/include/pm8x41_hw.h
+++ b/dev/pmic/pm8x41/include/pm8x41_hw.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, 2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, 2017-2018, 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
@@ -109,6 +109,10 @@
 #define USBIN_ACTIVE_PWR_SRC                  BIT(0)
 #define DCIN_ACTIVE_PWR_SRC                   BIT(1)
 
+/* USB Status registers */
+#define SCHG_USB_INT_RT_STS		      0x1310
+#define USBIN_PLUGIN_RT_STS		      BIT(4)
+
 /* MPP registers */
 #define MPP_DIG_VIN_CTL                       0x41
 #define MPP_MODE_CTL                          0x40
diff --git a/dev/pmic/pm8x41/pm8x41.c b/dev/pmic/pm8x41/pm8x41.c
index 442bc35..ba723b4 100644
--- a/dev/pmic/pm8x41/pm8x41.c
+++ b/dev/pmic/pm8x41/pm8x41.c
@@ -637,6 +637,18 @@
 	return pon_reason;
 }
 
+uint8_t pmi632_get_pon_reason()
+{
+	uint8_t pon_reason = 0;
+
+	pon_reason = REG_READ(SCHG_USB_INT_RT_STS|PMI8950_SLAVE_ID);
+	/* Check USBIN status on PMI and set the corresponding bits for pon */
+	pon_reason = (pon_reason & USBIN_PLUGIN_RT_STS);
+	pon_reason |= REG_READ(PON_PON_REASON1);
+
+	return pon_reason;
+}
+
 uint8_t pm8x41_get_pon_poff_reason1()
 {
 	return REG_READ(PON_POFF_REASON1);