linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo+renesas@jmondi.org>
To: kieran.bingham+renesas@ideasonboard.com,
	laurent.pinchart+renesas@ideasonboard.com,
	niklas.soderlund+renesas@ragnatech.se, geert@linux-m68k.org
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org, Hyun Kwon <hyunk@xilinx.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	sergei.shtylyov@gmail.com
Subject: [PATCH v7 2/7] fixup! media: i2c: rdacm21: Fix GPIO handling
Date: Wed, 13 Jan 2021 19:55:00 +0100	[thread overview]
Message-ID: <20210113185506.119808-3-jacopo+renesas@jmondi.org> (raw)
In-Reply-To: <20210113185506.119808-1-jacopo+renesas@jmondi.org>

The MAX9271 GPIO line connected to the OV490 RESETB line is
GPIO1, not GPO. As the GPIO1 line is not enabled by default, first
enable it then control the OV490 reset during the MAX9271 configuration
procedure.

Before this change the embedded OV490 ISP was not actually reset.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/i2c/rdacm21.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/media/i2c/rdacm21.c b/drivers/media/i2c/rdacm21.c
index f3841369768c..0428e3209463 100644
--- a/drivers/media/i2c/rdacm21.c
+++ b/drivers/media/i2c/rdacm21.c
@@ -425,27 +425,23 @@ static int rdacm21_initialize(struct rdacm21_device *dev)
 	if (ret)
 		return ret;
 
-	ret = max9271_configure_gmsl_link(&dev->serializer);
+	/* Enable GPIO1 and hold OV490 in reset during max9271 configuration. */
+	ret = max9271_enable_gpios(&dev->serializer, MAX9271_GPIO1OUT);
 	if (ret)
 		return ret;
 
-	/* Set GPO high to hold OV490 in reset. */
-	ret = max9271_set_gpios(&dev->serializer, MAX9271_GPO);
+	ret = max9271_clear_gpios(&dev->serializer, MAX9271_GPIO1OUT);
 	if (ret)
 		return ret;
 
-	ret = max9271_set_address(&dev->serializer, dev->addrs[0]);
+	ret = max9271_configure_gmsl_link(&dev->serializer);
 	if (ret)
 		return ret;
-	dev->serializer.client->addr = dev->addrs[0];
 
-	/*
-	 * Release OV490 from reset and program address translation
-	 * before performing OV490 configuration.
-	 */
-	ret = max9271_clear_gpios(&dev->serializer, MAX9271_GPO);
+	ret = max9271_set_address(&dev->serializer, dev->addrs[0]);
 	if (ret)
 		return ret;
+	dev->serializer.client->addr = dev->addrs[0];
 
 	ret = max9271_set_translation(&dev->serializer, dev->addrs[1],
 				      OV490_I2C_ADDRESS);
@@ -453,6 +449,12 @@ static int rdacm21_initialize(struct rdacm21_device *dev)
 		return ret;
 	dev->isp->addr = dev->addrs[1];
 
+	/* Release OV490 from reset and initialize it. */
+	ret = max9271_set_gpios(&dev->serializer, MAX9271_GPIO1OUT);
+	if (ret)
+		return ret;
+	usleep_range(3000, 5000);
+
 	ret = ov490_initialize(dev);
 	if (ret)
 		return ret;
-- 
2.29.2


  parent reply	other threads:[~2021-01-13 18:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13 18:54 [PATCH v7 0/7] media: i2c: Add RDACM21 camera module Jacopo Mondi
2021-01-13 18:54 ` [PATCH v7 1/7] media: i2c: Add driver for " Jacopo Mondi
2021-01-13 23:05   ` Laurent Pinchart
2021-01-13 18:55 ` Jacopo Mondi [this message]
2021-01-13 23:09   ` [PATCH v7 2/7] fixup! media: i2c: rdacm21: Fix GPIO handling Laurent Pinchart
2021-01-13 18:55 ` [PATCH v7 3/7] fixup! media: i2c: rdacm21: Break-out ov10640 initialization Jacopo Mondi
2021-01-13 23:23   ` Laurent Pinchart
2021-01-14  7:52     ` Jacopo Mondi
2021-01-14  9:06       ` Laurent Pinchart
2021-01-13 18:55 ` [PATCH v7 4/7] dt-bindings: media: max9286: Document 'maxim,reverse-channel-microvolt' Jacopo Mondi
2021-01-14  8:20   ` Sergei Shtylyov
2021-01-13 18:55 ` [PATCH v7 5/7] media: i2c: max9286: Break-out reverse channel setup Jacopo Mondi
2021-01-13 18:55 ` [PATCH v7 6/7] media: i2c: max9286: Make channel amplitude programmable Jacopo Mondi
2021-01-13 18:55 ` [PATCH v7 7/7] media: i2c: max9286: Configure reverse channel amplitude Jacopo Mondi

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=20210113185506.119808-3-jacopo+renesas@jmondi.org \
    --to=jacopo+renesas@jmondi.org \
    --cc=geert@linux-m68k.org \
    --cc=hyunk@xilinx.com \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=sergei.shtylyov@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).