]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
video: simple_panel: use regulator_set_enable_if_allowed
authorSvyatoslav Ryhel <clamor95@gmail.com>
Tue, 3 Oct 2023 06:25:33 +0000 (09:25 +0300)
committerAnatolij Gustschin <agust@denx.de>
Sun, 22 Oct 2023 17:25:10 +0000 (19:25 +0200)
With the commit 4fcba5d556b4 ("regulator: implement basic reference
counter") the return value of regulator_set_enable may be EALREADY or
EBUSY for fixed/gpio regulators and may be further expanded on all
regulators.

Change to use the more relaxed regulator_set_enable_if_allowed to
continue if regulator already was enabled or disabled.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
drivers/video/simple_panel.c

index 6a6473eb0e54a1e9fe21a15da0b5640bee3fc2c7..efb122b534acee377628241658681d4aa26ecdff 100644 (file)
@@ -114,11 +114,11 @@ static int simple_panel_probe(struct udevice *dev)
        const u32 dsi_data = dev_get_driver_data(dev);
        int ret;
 
-       if (CONFIG_IS_ENABLED(DM_REGULATOR) && priv->reg) {
-               debug("%s: Enable regulator '%s'\n", __func__, priv->reg->name);
-               ret = regulator_set_enable(priv->reg, true);
-               if (ret)
-                       return ret;
+       ret = regulator_set_enable_if_allowed(priv->reg, true);
+       if (ret && ret != -ENOSYS) {
+               debug("%s: failed to enable regulator '%s' %d\n",
+                     __func__, priv->reg->name, ret);
+               return ret;
        }
 
        switch (dsi_data) {