Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e436cab6 authored by Devesh Jhunjhunwala's avatar Devesh Jhunjhunwala
Browse files

msm: qpnp-revid: Do not read STATUS1 register for PMD9655 subtype



Since the PMD9655 PMIC does not have the STATUS1 register,
update the probe function to check for pmic_subtype before
attempting to read this register value.

Change-Id: I76d6839eacd7a6ee5044f6f54f16cbaf34d55803
Signed-off-by: default avatarDevesh Jhunjhunwala <deveshj@codeaurora.org>
parent 62b3314e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ EXPORT_SYMBOL(get_revid_data);

#define PM8941_PERIPHERAL_SUBTYPE	0x01
#define PM8226_PERIPHERAL_SUBTYPE	0x04
#define PMD9655_PERIPHERAL_SUBTYPE	0x0F
static size_t build_pmic_string(char *buf, size_t n, int sid,
		u8 subtype, u8 rev1, u8 rev2, u8 rev3, u8 rev4)
{
@@ -164,7 +165,11 @@ static int qpnp_revid_probe(struct spmi_device *spmi)
	rev4 = qpnp_read_byte(spmi, resource->start + REVID_REVISION4);

	pmic_subtype = qpnp_read_byte(spmi, resource->start + REVID_SUBTYPE);
	pmic_status = qpnp_read_byte(spmi, resource->start + REVID_STATUS1);
	if (pmic_subtype != PMD9655_PERIPHERAL_SUBTYPE)
		pmic_status = qpnp_read_byte(spmi,
					     resource->start + REVID_STATUS1);
	else
		pmic_status = 0;

	revid_chip = devm_kzalloc(&spmi->dev, sizeof(struct revid_chip),
						GFP_KERNEL);