usb: dwc3-meson-g12a: Use regulator_set_enable_if_allowed
authorJaehoon Chung <jh80.chung@samsung.com>
Wed, 1 Nov 2023 10:55:05 +0000 (19:55 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 28 Oct 2024 11:28:42 +0000 (20:28 +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 41d15996e5b2afdee2460c940f5650e8424da412..63b745821d9395cc65d66c9ba946c4bb7331932c 100644 (file)
@@ -290,7 +290,7 @@ static 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;
@@ -417,7 +417,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;
        }