mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-25 06:46:00 +00:00
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:
parent
d82cbc596e
commit
335799b725
1 changed files with 6 additions and 8 deletions
|
@ -194,8 +194,8 @@ static int dwc_vbus_supply_init(struct udevice *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ret = regulator_set_enable(priv->vbus_supply, true);
|
||||
if (ret) {
|
||||
ret = regulator_set_enable_if_allowed(priv->vbus_supply, true);
|
||||
if (ret && ret != -ENOSYS) {
|
||||
dev_err(dev, "Error enabling vbus supply\n");
|
||||
return ret;
|
||||
}
|
||||
|
@ -208,12 +208,10 @@ static int dwc_vbus_supply_exit(struct udevice *dev)
|
|||
struct dwc2_priv *priv = dev_get_priv(dev);
|
||||
int ret;
|
||||
|
||||
if (priv->vbus_supply) {
|
||||
ret = regulator_set_enable(priv->vbus_supply, false);
|
||||
if (ret) {
|
||||
dev_err(dev, "Error disabling vbus supply\n");
|
||||
return ret;
|
||||
}
|
||||
ret = regulator_set_enable_if_allowed(priv->vbus_supply, false);
|
||||
if (ret && ret != -ENOSYS) {
|
||||
dev_err(dev, "Error disabling vbus supply\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue