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

Commit abc22dbb authored by Jack Pham's avatar Jack Pham
Browse files

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: default avatarJack Pham <jackp@codeaurora.org>
parent c6855ffd
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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)