dev : pmic : read usbin from pmi8950 with correct slave id
Slave id for pmi 8950 would be 2 when it is connected as secondary.
Add slave id and correct the reading of the register from pmi8950.
Change-Id: Ica461bc78f286e122b3e728b8cd05303859b94bc
diff --git a/dev/pmic/pm8x41/include/pm8x41_hw.h b/dev/pmic/pm8x41/include/pm8x41_hw.h
index 0a8e2e8..2bae818 100644
--- a/dev/pmic/pm8x41/include/pm8x41_hw.h
+++ b/dev/pmic/pm8x41/include/pm8x41_hw.h
@@ -94,6 +94,9 @@
/* USB Peripheral registers */
#define SMBCHGL_USB_ICL_STS_2 0x1309
+/* PMI8950 slave id */
+#define PMI8950_SLAVE_ID 0x20000
+
/* USB Peripheral register bits */
#define USBIN_ACTIVE_PWR_SRC BIT(0)
#define DCIN_ACTIVE_PWR_SRC BIT(1)
diff --git a/dev/pmic/pm8x41/pm8x41.c b/dev/pmic/pm8x41/pm8x41.c
index 6733656..0a43bff 100644
--- a/dev/pmic/pm8x41/pm8x41.c
+++ b/dev/pmic/pm8x41/pm8x41.c
@@ -545,7 +545,7 @@
{
uint8_t pon_reason = 0;
- pon_reason = REG_READ(SMBCHGL_USB_ICL_STS_2);
+ pon_reason = REG_READ(SMBCHGL_USB_ICL_STS_2|PMI8950_SLAVE_ID);
/* 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);