diff mbox series

[v6,4/8] media: i2c: rdacm20: Re-program chip address earlier

Message ID 20210722091239.26451-5-jacopo+renesas@jmondi.org (mailing list archive)
State Superseded
Delegated to: Kieran Bingham
Headers show
Series arm64: dts: renesas: Enable GMSL on Eagle and Condor | expand

Commit Message

Jacopo Mondi July 22, 2021, 9:12 a.m. UTC
The current implementation of the camera module initialization
re-programs the chip address during the post-registration phase, once
the reverse channel amplitude has been compensated. While this guarantees
more reliable communications, reprogramming the chip address at probe()
time guarantees that the embedded MCU cannot over-write the settings
programmed by the driver.

Re-program the chip address at probe() time, to avoid conflicts on the
i2c bus due to messages sent by the embedded MCU to the default chip
address which render capture operations unstable.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/i2c/rdacm20.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c
index ba956733aa89..eb0e3dc22cc3 100644
--- a/drivers/media/i2c/rdacm20.c
+++ b/drivers/media/i2c/rdacm20.c
@@ -462,11 +462,6 @@  static int rdacm20_post_register(struct v4l2_subdev *sd)
 	if (ret < 0)
 		return ret;
 
-	ret = max9271_set_address(&dev->serializer, dev->addrs[0]);
-	if (ret < 0)
-		return ret;
-	dev->serializer.client->addr = dev->addrs[0];
-
 	/*
 	 * Release ov10635 from reset and initialize it. The image sensor
 	 * requires at least 2048 XVCLK cycles (85 micro-seconds at 24MHz)
@@ -562,6 +557,11 @@  static int rdacm20_initialize(struct rdacm20_device *dev)
 	if (ret)
 		return ret;
 
+	ret = max9271_set_address(&dev->serializer, dev->addrs[0]);
+	if (ret < 0)
+		return ret;
+	dev->serializer.client->addr = dev->addrs[0];
+
 	/*
 	 * Set reverse channel high threshold to increase noise immunity.
 	 *