summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Remmet <j.remmet@phytec.de>2026-02-06 09:34:31 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-02-06 11:23:50 +0100
commitb3f9d6e491fda73c319547881b78cdd2a222b293 (patch)
tree43ceb09adf45b9a49ff8247f8904fc8b1c4ffe8d
parente5b250214aa402e079de566e10f6e01223fd26bd (diff)
usb: typec: hd3ss3220: Check if regulator needs to be switched
Check regulator state as peripheral and detach can disable vbus. Without this check we will try to disable the regulator twice if we disconnect host and then connect as device. Fixes: 27fbc19e52b9 ("usb: typec: hd3ss3220: Enable VBUS based on role state") Signed-off-by: Jan Remmet <j.remmet@phytec.de> Reviewed-by: Heikki Krogerus <heikki.krogerus@linu.intel.com> Link: https://patch.msgid.link/20260206-wip-jremmet-hd3ss3220_vbus_split-v4-1-ee5b4e402187@phytec.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/typec/hd3ss3220.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c
index a7c54aa8635f..3e39b800e6b5 100644
--- a/drivers/usb/typec/hd3ss3220.c
+++ b/drivers/usb/typec/hd3ss3220.c
@@ -208,6 +208,9 @@ static void hd3ss3220_regulator_control(struct hd3ss3220 *hd3ss3220, bool on)
{
int ret;
+ if (regulator_is_enabled(hd3ss3220->vbus) == on)
+ return;
+
if (on)
ret = regulator_enable(hd3ss3220->vbus);
else