[PATCH v7 2/7] fixup! media: i2c: rdacm21: Fix GPIO handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux