power: qpnp-bms: add peripheral subtype for BMS_IADC2
When the BMS_IADC peripheral was added to the BMS as a device,
the driver checked both peripheral type and subtype to distinguish
between the two.
For version 3 PMIC hardware, the IADC peripheral subtype changed as
IADC1 was updated to IADC2. Add the new subtype so BMS can probe
Change-Id: Iabcd97e110dd256d46e65a04541e30072b23a4f3
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
diff --git a/drivers/power/qpnp-bms.c b/drivers/power/qpnp-bms.c
index ec0b0e7..216c29e 100644
--- a/drivers/power/qpnp-bms.c
+++ b/drivers/power/qpnp-bms.c
@@ -2159,9 +2159,10 @@
#define REG_OFFSET_PERP_TYPE 0x04
#define REG_OFFSET_PERP_SUBTYPE 0x05
#define BMS_BMS_TYPE 0xD
-#define BMS_BMS_SUBTYPE 0x1
+#define BMS_BMS1_SUBTYPE 0x1
#define BMS_IADC_TYPE 0x8
-#define BMS_IADC_SUBTYPE 0x3
+#define BMS_IADC1_SUBTYPE 0x3
+#define BMS_IADC2_SUBTYPE 0x5
static int register_spmi(struct qpnp_bms_chip *chip, struct spmi_device *spmi)
{
@@ -2200,10 +2201,11 @@
return rc;
}
- if (type == BMS_BMS_TYPE && subtype == BMS_BMS_SUBTYPE) {
+ if (type == BMS_BMS_TYPE && subtype == BMS_BMS1_SUBTYPE) {
chip->base = resource->start;
} else if (type == BMS_IADC_TYPE
- && subtype == BMS_IADC_SUBTYPE) {
+ && (subtype == BMS_IADC1_SUBTYPE
+ || subtype == BMS_IADC2_SUBTYPE)) {
chip->iadc_base = resource->start;
} else {
pr_err("Invalid peripheral start=0x%x type=0x%x, subtype=0x%x\n",