[RFC,v6,12/13] media: i2c: max9286: [Workaround] Hard delay while waiting to enable the V3M cameras
diff mbox series

Message ID 20191216102930.5867-13-kieran.bingham+renesas@ideasonboard.com
State New
Delegated to: Kieran Bingham
Headers show
Series
  • GMSL Renesas Platform Support
Related show

Commit Message

Kieran Bingham Dec. 16, 2019, 10:29 a.m. UTC
From: Kieran Bingham <kieran.bingham@ideasonboard.com>

The camera's power regulator is connected to a GPIO on the max9286.
Unfortunately this causes us a circular dependency on the regulator
needing the gpio_chip before the max9286 has probed.

Until we can get the regulator framework to create the regulator device
on demand (at the time of regulator_get(), the gpio_chip is available)
we need to force the gpio line with a gpio-hog, and handle the delay
required with a manual sleep.

This is specific to the Eagle-V3M.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 drivers/media/i2c/max9286.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Patch
diff mbox series

diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index 057258a3c645..090b6c0f81e9 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -964,6 +964,20 @@  static int max9286_init(struct device *dev)
 		return ret;
 	}
 
+	/*
+	 * Regulator Workaround:
+	 *
+	 * We must sleep at least 8 seconds to let the cameras power and
+	 * complete their bootstrapping process. This should be handled by the
+	 * call to regulator_enable, but alas on V3M we end up in a circular
+	 * dependency due to the regulator being connected to our own gpio_chip
+	 *
+	 * This sleep is a temporary work-around and should be removed, which
+	 * ensures enough time has passed from the gpio_chip enabling a
+	 * gpio-hog before we enable any reverse channels within max9286_setup.
+	 */
+	usleep_range(8000000, 9000000);
+
 	priv->poc_enabled = true;
 
 	ret = max9286_setup(priv);