public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Vasily Khoruzhick <anarsoul@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 2/5] dm: video: bridge: don't fail to activate bridge if reset or sleep GPIO is missing
Date: Sun, 28 Oct 2018 14:18:58 -0700	[thread overview]
Message-ID: <20181028211901.1140-3-anarsoul@gmail.com> (raw)
In-Reply-To: <20181028211901.1140-1-anarsoul@gmail.com>

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 | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c
index cd4959cc71..5fecb4cfd5 100644
--- a/drivers/video/bridge/video-bridge-uclass.c
+++ b/drivers/video/bridge/video-bridge-uclass.c
@@ -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;
-- 
2.19.1

  parent reply	other threads:[~2018-10-28 21:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-28 21:18 [U-Boot] [PATCH v4 0/5] Add support for Pinebook Vasily Khoruzhick
2018-10-28 21:18 ` [U-Boot] [PATCH v4 1/5] mmc: sunxi: add support for automatic delay calibration Vasily Khoruzhick
2018-10-28 21:18 ` Vasily Khoruzhick [this message]
2018-10-28 21:18 ` [U-Boot] [PATCH v4 3/5] sunxi: DT: A64: update device tree files for Allwinner A64 SoC Vasily Khoruzhick
2018-10-28 21:19 ` [U-Boot] [PATCH v4 4/5] sun50i: A64: add support for R_I2C controller Vasily Khoruzhick
2018-10-28 21:19 ` [U-Boot] [PATCH v4 5/5] sunxi: DT: add support for Pinebook Vasily Khoruzhick
2018-10-29 15:29   ` Loic Devulder
2018-10-29 16:59     ` Andre Przywara
2018-10-30 21:36 ` [U-Boot] [PATCH v4 0/5] Add " Vagrant Cascadian
2018-11-03 18:55   ` Dennis Gilmore
2018-11-03 20:18     ` Vasily Khoruzhick
2018-11-03 20:19       ` Vasily Khoruzhick
2018-11-03 21:15         ` André Przywara
2018-11-04  0:12           ` Vasily Khoruzhick
2018-11-05 15:30             ` Dennis Gilmore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181028211901.1140-3-anarsoul@gmail.com \
    --to=anarsoul@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox