Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions drivers/usb/typec/hd3ss3220.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct hd3ss3220 {
int id_irq;

struct regulator *vbus;
bool vbus_enabled;
};

static int hd3ss3220_set_power_opmode(struct hd3ss3220 *hd3ss3220, int power_opmode)
Expand Down Expand Up @@ -208,17 +209,21 @@ static void hd3ss3220_regulator_control(struct hd3ss3220 *hd3ss3220, bool on)
{
int ret;

if (regulator_is_enabled(hd3ss3220->vbus) == on)
if (hd3ss3220->vbus_enabled == on)
return;

if (on)
ret = regulator_enable(hd3ss3220->vbus);
else
ret = regulator_disable(hd3ss3220->vbus);

if (ret)
if (ret) {
dev_err(hd3ss3220->dev,
"vbus regulator %s failed: %d\n", on ? "disable" : "enable", ret);
"vbus regulator %s failed: %d\n", on ? "enable" : "disable", ret);
return;
}

hd3ss3220->vbus_enabled = on;
}

static void hd3ss3220_set_role(struct hd3ss3220 *hd3ss3220)
Expand Down