]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: video: bridge: don't fail to activate bridge if reset or sleep GPIO is missing
authorVasily Khoruzhick <anarsoul@gmail.com>
Tue, 6 Nov 2018 04:24:29 +0000 (20:24 -0800)
committerJagan Teki <jagan@amarulasolutions.com>
Tue, 13 Nov 2018 16:38:23 +0000 (22:08 +0530)
Both GPIOs are optional, so we shouldn't fail if any is missing.
Without this fix reset is not deasserted if sleep GPIO is missing.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Cc: Vagrant Cascadian <vagrant@debian.org>
drivers/video/bridge/video-bridge-uclass.c

index cd4959cc71dfac5c2e270d8aa82cda4b779f2203..5fecb4cfd565b439265bceb206f0606cd11eb158 100644 (file)
@@ -106,13 +106,19 @@ static int video_bridge_pre_probe(struct udevice *dev)
 int video_bridge_set_active(struct udevice *dev, bool active)
 {
        struct video_bridge_priv *uc_priv = dev_get_uclass_priv(dev);
-       int ret;
+       int ret = 0;
 
        debug("%s: %d\n", __func__, active);
-       ret = dm_gpio_set_value(&uc_priv->sleep, !active);
-       if (ret)
-               return ret;
-       if (active) {
+       if (uc_priv->sleep.dev) {
+               ret = dm_gpio_set_value(&uc_priv->sleep, !active);
+               if (ret)
+                       return ret;
+       }
+
+       if (!active)
+               return 0;
+
+       if (uc_priv->reset.dev) {
                ret = dm_gpio_set_value(&uc_priv->reset, true);
                if (ret)
                        return ret;