dev : pmic : add helper function for pmi8950 pon reason

Check for USB In / DC In bits of the PON register for PMI8950.
8952 Based targets uses PMI8950, hence add an API to return
the appropriate PON reason.

Change-Id: I01b2df4909f7fef45ae5aa1ea2591ce893ea3f0d
diff --git a/dev/pmic/pm8x41/pm8x41.c b/dev/pmic/pm8x41/pm8x41.c
index e753f6c..583145a 100644
--- a/dev/pmic/pm8x41/pm8x41.c
+++ b/dev/pmic/pm8x41/pm8x41.c
@@ -9,7 +9,7 @@
  *     copyright notice, this list of conditions and the following
  *     disclaimer in the documentation and/or other materials provided
  *     with the distribution.
- *   * Neither the name of The Linux Foundation, Inc. nor the names of its
+ *   * Neither the name of The Linux Foundation, nor the names of its
  *     contributors may be used to endorse or promote products derived
  *     from this software without specific prior written permission.
  *
@@ -539,6 +539,18 @@
 	return REG_READ(PON_PON_REASON1);
 }
 
+uint8_t pm8950_get_pon_reason()
+{
+	uint8_t pon_reason = 0;
+
+	pon_reason = REG_READ(SMBCHGL_USB_ICL_STS_2);
+	/* check usbin/dcin status on pmi and set the corresponding bits for pon */
+	pon_reason = (pon_reason & (USBIN_ACTIVE_PWR_SRC|DCIN_ACTIVE_PWR_SRC)) << 3 ;
+	pon_reason |= REG_READ(PON_PON_REASON1);
+
+	return pon_reason;
+}
+
 uint8_t pm8x41_get_pon_poff_reason1()
 {
 	return REG_READ(PON_POFF_REASON1);