[RFC,09/11] media: i2c: max9286: Expand reverse chanenl amplitude
diff mbox series

Message ID 20191216171620.372683-10-jacopo+renesas@jmondi.org
State New
Delegated to: Kieran Bingham
Headers show
Series
  • GMSL: Initial RDACM21 support
Related show

Commit Message

Jacopo Mondi Dec. 16, 2019, 5:16 p.m. UTC
Expand commen on the reverse channel amplitude compensation as its
handling differs between RDACM20 and RDACM21. Keep the current
register configuration as it works for both devices.

While at it, add a delay after reverse channel re-configuration as
suggested by the programming guide.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/i2c/max9286.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index f75c97ef87a8..e9d3da72a381 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -857,12 +857,28 @@  static int max9286_setup(struct max9286_priv *priv)
 	 *
 	 * - Enable custom reverse channel configuration (through register 0x3f)
 	 *   and set the first pulse length to 35 clock cycles.
-	 * - Increase the reverse channel amplitude to 170mV to accommodate the
-	 *   high threshold enabled by the serializer driver.
+	 * - FIXME: Set the reverse channel amplitude to 70mV ( + 100 for
+	 *   RDACM20)
+	 *
+	 *   The RDACM21 and RDACM20 camera modules this driver has been
+	 *   tested against would need to be handled differently here.
+	 *
+	 *   RDACM20 has an MCU which performs an initial programming, most
+	 *   probably enabling the reverse channel and high-threshold
+	 *   compensation during startup. It needs then to be interoperated
+	 *   with the deserializer reverse channel amplitude already compensated
+	 *   to 170mV (70mV + 100 mV).
+	 *
+	 *   RDACM21 does not need that and reverse channel could have been
+	 *   compensated after all serializers have probed.
+	 *
+	 *   Without this early compensation RDACM20 fails to probe, but RDACM21
+	 *   shows slightly less reliable communications.
 	 */
 	max9286_write(priv, 0x3f, MAX9286_EN_REV_CFG | MAX9286_REV_FLEN(35));
 	max9286_write(priv, 0x3b, MAX9286_REV_TRF(1) | MAX9286_REV_AMP(70) |
 		      MAX9286_REV_AMP_X);
+	usleep_range(2000, 2500);
 
 	/*
 	 * Enable GMSL links, mask unused ones and autodetect link