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 v3 2/5] dm: video: bridge: don't fail to activate bridge if reset or sleep GPIO is missing
Date: Wed, 17 Oct 2018 22:56:48 -0700	[thread overview]
Message-ID: <20181018055651.10249-3-anarsoul@gmail.com> (raw)
In-Reply-To: <20181018055651.10249-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>
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.0

  parent reply	other threads:[~2018-10-18  5:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18  5:56 [U-Boot] [PATCH v3 0/5] Add support for Pinebook Vasily Khoruzhick
2018-10-18  5:56 ` [U-Boot] [PATCH v3 1/5] mmc: sunxi: add support for automatic delay calibration Vasily Khoruzhick
2018-10-18 14:18   ` Andre Przywara
2018-10-18  5:56 ` Vasily Khoruzhick [this message]
2018-10-18 14:18   ` [U-Boot] [PATCH v3 2/5] dm: video: bridge: don't fail to activate bridge if reset or sleep GPIO is missing Andre Przywara
2018-10-18  5:56 ` [U-Boot] [PATCH v3 3/5] sunxi: DT: A64: update device tree file for Allwinner A64 SoC Vasily Khoruzhick
2018-10-22 18:22   ` Jagan Teki
2018-10-18  5:56 ` [U-Boot] [PATCH v3 4/5] sun50i: A64: add support for R_I2C controller Vasily Khoruzhick
2018-10-18  5:56 ` [U-Boot] [PATCH v3 5/5] sunxi: DT: add support for Pinebook Vasily Khoruzhick
2018-10-18 16:32   ` Vagrant Cascadian

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=20181018055651.10249-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