usb: dwc2: Use regulator_set_enable_if_allowed
With the commit 4fcba5d556
("regulator: implement basic reference
counter") the return value of regulator_set_enable may be EALREADY or
EBUSY for fixed/gpio regulators.
Change to use the more relaxed regulator_set_enable_if_allowed to
continue if regulator already was enabled or disabled.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # rockpro64-rk3399
Reviewed-by: Marek Vasut <marex@denx.de>
This commit is contained in:
@@ -194,8 +194,8 @@ static int dwc_vbus_supply_init(struct udevice *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = regulator_set_enable(priv->vbus_supply, true);
|
ret = regulator_set_enable_if_allowed(priv->vbus_supply, true);
|
||||||
if (ret) {
|
if (ret && ret != -ENOSYS) {
|
||||||
dev_err(dev, "Error enabling vbus supply\n");
|
dev_err(dev, "Error enabling vbus supply\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -208,12 +208,10 @@ static int dwc_vbus_supply_exit(struct udevice *dev)
|
|||||||
struct dwc2_priv *priv = dev_get_priv(dev);
|
struct dwc2_priv *priv = dev_get_priv(dev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (priv->vbus_supply) {
|
ret = regulator_set_enable_if_allowed(priv->vbus_supply, false);
|
||||||
ret = regulator_set_enable(priv->vbus_supply, false);
|
if (ret && ret != -ENOSYS) {
|
||||||
if (ret) {
|
dev_err(dev, "Error disabling vbus supply\n");
|
||||||
dev_err(dev, "Error disabling vbus supply\n");
|
return ret;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user