summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshay Jaiswal <ashayj@codeaurora.org>2017-04-13 15:29:18 +0530
committerAshay Jaiswal <ashayj@codeaurora.org>2017-04-14 10:21:07 +0530
commitd288491f1b5a3288fd2a11a23e7e654ce54c70a9 (patch)
tree1ae391cdc2583b0344df5d2ea7a4f88e53509f82
parent4901c7fce456a3ad5d80836000539674a885913e (diff)
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: Ashay Jaiswal <ashayj@codeaurora.org>
-rw-r--r--drivers/power/supply/qcom/qpnp-smb2.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/power/supply/qcom/qpnp-smb2.c b/drivers/power/supply/qcom/qpnp-smb2.c
index 81e656c06da0..289ccbedbc9f 100644
--- a/drivers/power/supply/qcom/qpnp-smb2.c
+++ b/drivers/power/supply/qcom/qpnp-smb2.c
@@ -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);