platform: qpnp-power-on: choose correct s2 control registers
The PMICs which have PON_REVISION2 register value as 0x00
have a single register for both s2 reset type and
s2 reset enable. All the other PON revisions have separate
registers for s2 reset type and s2 reset enable. Add support
to choose correct s2 control registers based on PON_REVISION2
register value.
Change-Id: Iaf0fb5c10a6883092d6a49336c40df0db7940ad2
CRs-Fixed: 661934
Signed-off-by: Abinaya P <abinayap@codeaurora.org>
diff --git a/drivers/platform/msm/qpnp-power-on.c b/drivers/platform/msm/qpnp-power-on.c
index 154cab3..1d388f4 100644
--- a/drivers/platform/msm/qpnp-power-on.c
+++ b/drivers/platform/msm/qpnp-power-on.c
@@ -28,8 +28,9 @@
#define PMIC_VERSION_REG 0x0105
#define PMIC_VERSION_REV4_REG 0x0103
-#define PMIC8941_V1_REV4 0x01
-#define PMIC8941_V2_REV4 0x02
+#define PMIC8941_V1_REV4 0x01
+#define PMIC8941_V2_REV4 0x02
+#define PON_REV2_VALUE 0x00
/* Common PNP defines */
#define QPNP_PON_REVISION2(base) (base + 0x01)
@@ -111,7 +112,6 @@
#define QPNP_PON_MAX_DBC_US (USEC_PER_SEC * 2)
#define QPNP_KEY_STATUS_DELAY msecs_to_jiffies(250)
-#define QPNP_PON_REV_B 0x01
enum pon_type {
PON_KPDPWR,
@@ -234,7 +234,7 @@
return rc;
}
- if (reg == 0x00)
+ if (reg == PON_REV2_VALUE)
rst_en_reg = QPNP_PON_PS_HOLD_RST_CTL(pon->base);
else
rst_en_reg = QPNP_PON_PS_HOLD_RST_CTL2(pon->base);
@@ -843,14 +843,19 @@
}
}
- if (pon_ver == QPNP_PON_REV_B) {
+ /* If the value read from REVISION2 register is 0x00,
+ * then there is a single register to control s2 reset.
+ * Otherwise there are separate registers for s2 reset
+ * type and s2 reset enable
+ */
+ if (pon_ver == PON_REV2_VALUE) {
+ cfg->s2_cntl_addr = cfg->s2_cntl2_addr =
+ QPNP_PON_KPDPWR_S2_CNTL(pon->base);
+ } else {
cfg->s2_cntl_addr =
QPNP_PON_KPDPWR_S2_CNTL(pon->base);
cfg->s2_cntl2_addr =
QPNP_PON_KPDPWR_S2_CNTL2(pon->base);
- } else {
- cfg->s2_cntl_addr = cfg->s2_cntl2_addr =
- QPNP_PON_KPDPWR_S2_CNTL(pon->base);
}
break;
@@ -915,14 +920,14 @@
}
}
- if (pon_ver == QPNP_PON_REV_B) {
+ if (pon_ver == PON_REV2_VALUE) {
+ cfg->s2_cntl_addr = cfg->s2_cntl2_addr =
+ QPNP_PON_RESIN_S2_CNTL(pon->base);
+ } else {
cfg->s2_cntl_addr =
QPNP_PON_RESIN_S2_CNTL(pon->base);
cfg->s2_cntl2_addr =
QPNP_PON_RESIN_S2_CNTL2(pon->base);
- } else {
- cfg->s2_cntl_addr = cfg->s2_cntl2_addr =
- QPNP_PON_RESIN_S2_CNTL(pon->base);
}
break;
@@ -956,14 +961,14 @@
}
}
- if (pon_ver == QPNP_PON_REV_B) {
+ if (pon_ver == PON_REV2_VALUE) {
+ cfg->s2_cntl_addr = cfg->s2_cntl2_addr =
+ QPNP_PON_KPDPWR_RESIN_S2_CNTL(pon->base);
+ } else {
cfg->s2_cntl_addr =
QPNP_PON_KPDPWR_RESIN_S2_CNTL(pon->base);
cfg->s2_cntl2_addr =
QPNP_PON_KPDPWR_RESIN_S2_CNTL2(pon->base);
- } else {
- cfg->s2_cntl_addr = cfg->s2_cntl2_addr =
- QPNP_PON_KPDPWR_RESIN_S2_CNTL(pon->base);
}
break;