usb: dwc3-meson-g12a: Use regulator_set_enable_if_allowed 39/300739/2
authorJaehoon Chung <jh80.chung@samsung.com>
Wed, 1 Nov 2023 10:55:05 +0000 (19:55 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 6 Nov 2023 01:27:26 +0000 (10:27 +0900)
Some meson targets are using a fixed regulator about usb.
It's always returning to EALREADY, so driver doesn't init fine.
To prevent this problem, use the regulator_set_enable_if_allowed
instead of regulator_set_enable.

Fixes: 4fcba5d556b ("regulator: implement basic reference counter")
Change-Id: I39dea7b3a36dc2ba5c9c2d3487142e7e2fbe0f16
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
drivers/usb/dwc3/dwc3-meson-g12a.c

index c62e42de73f73201ec9668281fdb003343a8fad5..dae20ef2320bce5b50653aadd85bd64383f00a21 100644 (file)
@@ -276,7 +276,7 @@ int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode)
 
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
        if (priv->vbus_supply) {
-               int ret = regulator_set_enable(priv->vbus_supply,
+               int ret = regulator_set_enable_if_allowed(priv->vbus_supply,
                                        (mode == USB_DR_MODE_PERIPHERAL));
                if (ret)
                        return ret;
@@ -386,7 +386,7 @@ static int dwc3_meson_g12a_probe(struct udevice *dev)
        }
 
        if (priv->vbus_supply) {
-               ret = regulator_set_enable(priv->vbus_supply, true);
+               ret = regulator_set_enable_if_allowed(priv->vbus_supply, true);
                if (ret)
                        return ret;
        }