[PATCH] media: i2c: max9271: Ignore read error in s_stream

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

 



In order to start streaming, the serializer's SEREN bit has to
be asserted and the video link enabled. In order for the video
link to be enabled correctly a valid pixel clock has to be
detected between the serializer and the connected image sensor.

The pixel clock detection is performed by reading register 0x15 but the
first attempt to read the register value sporadically fails resulting in
a error in the stream start procedure.

As the error is not fatal, and the pixel detection procedure will abort
anyway after 10 msec if no valid pixel clock is detected, continue
instead of failing immediately if the register read fails.

Signed-off-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>

---
When running 4 cameras at a time, the first register read on the first started
camera fails pretty often. I here decided to ignore the error and go for another
read attempt, but issuing a simple "i2c_smbus_read_reg()" (as we do in the wakup
function) before the actual register read resolves the issue in the same way.

I've not been able to find in the datasheet any mention of a "ping to wakeup"
requirement before enabling the video channel, but this change make capturing
from 4 RDACM20 camera pretty reliable.
---

 drivers/media/i2c/max9271.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/max9271.c b/drivers/media/i2c/max9271.c
index ff86c8c4ea61..e339dff3986d 100644
--- a/drivers/media/i2c/max9271.c
+++ b/drivers/media/i2c/max9271.c
@@ -66,8 +66,10 @@ static int max9271_pclk_detect(struct max9271_device *dev)

 	for (i = 0; i < 100; i++) {
 		ret = max9271_read(dev, 0x15);
-		if (ret < 0)
-			return ret;
+		if (ret < 0) {
+			usleep_range(50, 100);
+			continue;
+		}

 		if (ret & MAX9271_PCLKDET)
 			return 0;
--
2.44.0





[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