diff options
author | Jack Pham <jackp@codeaurora.org> | 2016-08-12 16:18:13 -0700 |
---|---|---|
committer | Jack Pham <jackp@codeaurora.org> | 2016-09-09 15:40:54 -0700 |
commit | abc22dbb3577fdb1e7f13b8c9f4887b500db6ca8 (patch) | |
tree | b7165138effb822198e717282fe6474bdc5a6f64 /drivers/usb | |
parent | c6855ffd7f2bab457b4be5c383110868e662cedf (diff) |
usb: pd: Fix unbalanced vconn regulator disable
Make sure to only call regulator_disable() on VCONN only if
it was previously enabled, else it could result in an
unbalanced disable state. Subsequent enables would then be
no-ops and the regulator would not actually turn on.
Change-Id: I67a6ad6d2bc036a63714403e2eed8c0577ef0246
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/pd/policy_engine.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/pd/policy_engine.c b/drivers/usb/pd/policy_engine.c index b011efe189e7..1bb7082be8e6 100644 --- a/drivers/usb/pd/policy_engine.c +++ b/drivers/usb/pd/policy_engine.c @@ -1257,8 +1257,11 @@ static void usbpd_sm(struct work_struct *w) POWER_SUPPLY_PROP_PD_ACTIVE, &val); if (pd->current_pr == PR_SRC) { - regulator_disable(pd->vconn); regulator_disable(pd->vbus); + if (pd->vconn_enabled) { + regulator_disable(pd->vconn); + pd->vconn_enabled = false; + } } if (pd->current_dr == DR_UFP) |