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

Commit 387bc198 authored by Xiaozhe Shi's avatar Xiaozhe Shi
Browse files

power: qpnp-fg: manually clear interrupts at probe time



The fuel gauge does not follow the reboot signal from the msm. This can
cause interrupts to fire in the boot sequence before the kernel can
react.

In particular, this can cause the latched status to be high before the
interrupt is registered with the pending bit low. The SPMI interrupts
driver will be confused and no further interrupts will be serviced from
the fuel gauge.

To avoid this issue, clear the fuel gauge memory interrupts before
registering the interrupts.

CRs-Fixed: 738872
Change-Id: Ic644565e35bfe52627b4905a21ab36f64bd14e71
Signed-off-by: default avatarXiaozhe Shi <xiaozhes@codeaurora.org>
parent 2e272c5b
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@

/* Interrupt offsets */
#define INT_RT_STS(base)			(base + 0x10)
#define INT_EN_CLR(base)			(base + 0x16)

/* SPMI Register offsets */
#define SOC_MONOTONIC_SOC	0x09
@@ -1922,7 +1923,7 @@ static int fg_probe(struct spmi_device *spmi)
	struct fg_chip *chip;
	struct spmi_resource *spmi_resource;
	struct resource *resource;
	u8 subtype;
	u8 subtype, reg;
	int rc = 0;

	if (!spmi) {
@@ -2010,6 +2011,13 @@ static int fg_probe(struct spmi_device *spmi)
		goto of_init_fail;
	}

	reg = 0xFF;
	rc = fg_write(chip, &reg, INT_EN_CLR(chip->mem_base), 1);
	if (rc) {
		pr_err("failed to clear interrupts %d\n", rc);
		goto of_init_fail;
	}

	chip->batt_type = default_batt_type;

	chip->bms_psy.name = "bms";