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

Commit d288491f authored by Ashay Jaiswal's avatar Ashay Jaiswal
Browse files

qcom: smb2: ensure QC adapter is at 5V at shutdown



In the shutdown hook, driver forces adapter to 5V but
there is a possibility that the source change IRQ triggers
and moves back the adapter to 9V.
To avoid this and any race between the irq's and shutdown path,
disable all irqs as the first step in shutdown path.

CRs-Fixed: 2032575
Change-Id: I0d8f59a73b6631e9bf6f5d64dd215c239e7772fe
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent 4901c7fc
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2022,6 +2022,16 @@ static int smb2_request_interrupts(struct smb2 *chip)
	return rc;
}

static void smb2_disable_interrupts(struct smb_charger *chg)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(smb2_irqs); i++) {
		if (smb2_irqs[i].irq > 0)
			disable_irq(smb2_irqs[i].irq);
	}
}

#if defined(CONFIG_DEBUG_FS)

static int force_batt_psy_update_write(void *data, u64 val)
@@ -2284,6 +2294,9 @@ static void smb2_shutdown(struct platform_device *pdev)
	struct smb2 *chip = platform_get_drvdata(pdev);
	struct smb_charger *chg = &chip->chg;

	/* disable all interrupts */
	smb2_disable_interrupts(chg);

	/* configure power role for UFP */
	smblib_masked_write(chg, TYPE_C_INTRPT_ENB_SOFTWARE_CTRL_REG,
				TYPEC_POWER_ROLE_CMD_MASK, UFP_EN_CMD_BIT);