Skip to content

Commit 198bb64

Browse files
Jacopo Mondimchehab
authored andcommitted
media: i2c: rdacm20: Re-work ov10635 reset
The OV10635 image sensor embedded in the camera module is currently reset after the MAX9271 initialization with two long delays that were most probably not correctly characterized. Re-work the image sensor reset procedure by holding the chip in reset during the MAX9271 configuration, removing the long sleep delays and only wait after the chip exits from reset for 350-500 microseconds interval, which is larger than the minimum (2048 * (1 / XVCLK)) timeout characterized in the chip manual. Signed-off-by: Jacopo Mondi <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 47f8b8a commit 198bb64

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

drivers/media/i2c/rdacm20.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,19 @@ static int rdacm20_initialize(struct rdacm20_device *dev)
473473
if (ret)
474474
return ret;
475475

476+
/*
477+
* Hold OV10635 in reset during max9271 configuration. The reset signal
478+
* has to be asserted for at least 200 microseconds.
479+
*/
480+
ret = max9271_enable_gpios(&dev->serializer, MAX9271_GPIO1OUT);
481+
if (ret)
482+
return ret;
483+
484+
ret = max9271_clear_gpios(&dev->serializer, MAX9271_GPIO1OUT);
485+
if (ret)
486+
return ret;
487+
usleep_range(200, 500);
488+
476489
ret = max9271_configure_gmsl_link(&dev->serializer);
477490
if (ret)
478491
return ret;
@@ -487,22 +500,14 @@ static int rdacm20_initialize(struct rdacm20_device *dev)
487500
dev->serializer.client->addr = dev->addrs[0];
488501

489502
/*
490-
* Reset the sensor by cycling the OV10635 reset signal connected to the
491-
* MAX9271 GPIO1 and verify communication with the OV10635.
503+
* Release ov10635 from reset and initialize it. The image sensor
504+
* requires at least 2048 XVCLK cycles (85 micro-seconds at 24MHz)
505+
* before being available. Stay safe and wait up to 500 micro-seconds.
492506
*/
493-
ret = max9271_enable_gpios(&dev->serializer, MAX9271_GPIO1OUT);
494-
if (ret)
495-
return ret;
496-
497-
ret = max9271_clear_gpios(&dev->serializer, MAX9271_GPIO1OUT);
498-
if (ret)
499-
return ret;
500-
usleep_range(10000, 15000);
501-
502507
ret = max9271_set_gpios(&dev->serializer, MAX9271_GPIO1OUT);
503508
if (ret)
504509
return ret;
505-
usleep_range(10000, 15000);
510+
usleep_range(100, 500);
506511

507512
again:
508513
ret = ov10635_read16(dev, OV10635_PID);

0 commit comments

Comments
 (0)