media: i2c: rdacm20: Configure I2C and GMSL link before identifying device
Ensure that we make a full attempt at configuring both the GMSL link and
the I2C link before we try to read from the device.
This is vital in ensuring link stability and correct configuration to be
able to read the device ID correctly, and program the new device
address.
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
diff --git a/drivers/media/i2c/rdacm20.c b/drivers/media/i2c/rdacm20.c
index 7c15914..8a5a91d 100644
--- a/drivers/media/i2c/rdacm20.c
+++ b/drivers/media/i2c/rdacm20.c
@@ -407,17 +407,20 @@ static int rdacm20_initialize(struct rdacm20_device *dev)
/* Verify communication with the MAX9271. */
i2c_smbus_read_byte(dev->client); /* ping to wake-up */
- ret = max9271_configure_address(dev, addrs[0]);
- if (ret)
- return ret;
-
+ /*
+ * Ensure that we have a good link configuration before attempting to
+ * identify the device.
+ */
+ max9271_configure_i2c(dev);
max9271_configure_gmsl_link(dev);
ret = max9271_verify_id(dev);
if (ret < 0)
return ret;
- max9271_configure_i2c(dev);
+ ret = max9271_configure_address(dev, addrs[0]);
+ if (ret < 0)
+ return ret;
/* Reset and verify communication with the OV10635. */
#ifdef RDACM20_SENSOR_HARD_RESET