diff mbox series

[v3,11/19] media: i2c: rdacm21: Add dealy after OV490 reset

Message ID 20210319164148.199192-12-jacopo+renesas@jmondi.org (mailing list archive)
State New, archived
Headers show
Series media: gmsl: Reliability improvement | expand

Commit Message

Jacopo Mondi March 19, 2021, 4:41 p.m. UTC
Add a delay after the OV490 chip is put in reset state. The reset
signal shall be held for at least 250 useconds.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/i2c/rdacm21.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Kieran Bingham March 19, 2021, 4:49 p.m. UTC | #1
Hi Jacopo,

s/dealy/delay/ in $SUBJECT

On 19/03/2021 16:41, Jacopo Mondi wrote:
> Add a delay after the OV490 chip is put in reset state. The reset
> signal shall be held for at least 250 useconds.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
>  drivers/media/i2c/rdacm21.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/rdacm21.c b/drivers/media/i2c/rdacm21.c
> index babd14b21252..875bec9f7904 100644
> --- a/drivers/media/i2c/rdacm21.c
> +++ b/drivers/media/i2c/rdacm21.c
> @@ -448,7 +448,10 @@ static int rdacm21_init(struct v4l2_subdev *sd, unsigned int val)
>  	if (ret)
>  		return ret;
>  
> -	/* Enable GPIO1 and hold OV490 in reset during max9271 configuration. */
> +	/*
> +	 * Enable GPIO1 and hold OV490 in reset during max9271 configuration.
> +	 * The reset signal has to be asserted for at least 250 useconds.
> +	 */
>  	ret = max9271_enable_gpios(&dev->serializer, MAX9271_GPIO1OUT);
>  	if (ret)
>  		return ret;
> @@ -456,6 +459,7 @@ static int rdacm21_init(struct v4l2_subdev *sd, unsigned int val)
>  	ret = max9271_clear_gpios(&dev->serializer, MAX9271_GPIO1OUT);
>  	if (ret)
>  		return ret;
> +	usleep_range(250, 500);

Aha, for a second there I thought the comment meant it had to be
asserted for 250 uS before clearing it again. But it's 250 uS before
using the OV490.

Perhaps possible to update the comment a little, but nothing that matters.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>


>  	ret = max9271_configure_gmsl_link(&dev->serializer);
>  	if (ret)
>
Laurent Pinchart March 20, 2021, 3:52 p.m. UTC | #2
Hi Jacopo,

Thank you for the patch.

On Fri, Mar 19, 2021 at 04:49:44PM +0000, Kieran Bingham wrote:
> Hi Jacopo,
> 
> s/dealy/delay/ in $SUBJECT
> 
> On 19/03/2021 16:41, Jacopo Mondi wrote:
> > Add a delay after the OV490 chip is put in reset state. The reset
> > signal shall be held for at least 250 useconds.
> > 
> > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> > ---
> >  drivers/media/i2c/rdacm21.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/media/i2c/rdacm21.c b/drivers/media/i2c/rdacm21.c
> > index babd14b21252..875bec9f7904 100644
> > --- a/drivers/media/i2c/rdacm21.c
> > +++ b/drivers/media/i2c/rdacm21.c
> > @@ -448,7 +448,10 @@ static int rdacm21_init(struct v4l2_subdev *sd, unsigned int val)
> >  	if (ret)
> >  		return ret;
> >  
> > -	/* Enable GPIO1 and hold OV490 in reset during max9271 configuration. */
> > +	/*
> > +	 * Enable GPIO1 and hold OV490 in reset during max9271 configuration.
> > +	 * The reset signal has to be asserted for at least 250 useconds.
> > +	 */
> >  	ret = max9271_enable_gpios(&dev->serializer, MAX9271_GPIO1OUT);
> >  	if (ret)
> >  		return ret;
> > @@ -456,6 +459,7 @@ static int rdacm21_init(struct v4l2_subdev *sd, unsigned int val)
> >  	ret = max9271_clear_gpios(&dev->serializer, MAX9271_GPIO1OUT);
> >  	if (ret)
> >  		return ret;
> > +	usleep_range(250, 500);
> 
> Aha, for a second there I thought the comment meant it had to be
> asserted for 250 uS before clearing it again. But it's 250 uS before
> using the OV490.
> 
> Perhaps possible to update the comment a little, but nothing that matters.

The commit message and comment should match the code, especially given
that I'm not sure here which of the two is actually incorrect. I suspect
the sleep is actually in the wrong location.

> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> 
> 
> >  	ret = max9271_configure_gmsl_link(&dev->serializer);
> >  	if (ret)
> >
Jacopo Mondi March 26, 2021, 11:22 a.m. UTC | #3
Hi Laurent, Kieran,

On Sat, Mar 20, 2021 at 05:52:18PM +0200, Laurent Pinchart wrote:
> Hi Jacopo,
>
> Thank you for the patch.
>
> On Fri, Mar 19, 2021 at 04:49:44PM +0000, Kieran Bingham wrote:
> > Hi Jacopo,
> >
> > s/dealy/delay/ in $SUBJECT
> >
> > On 19/03/2021 16:41, Jacopo Mondi wrote:
> > > Add a delay after the OV490 chip is put in reset state. The reset
> > > signal shall be held for at least 250 useconds.
> > >
> > > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> > > ---
> > >  drivers/media/i2c/rdacm21.c | 6 +++++-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/media/i2c/rdacm21.c b/drivers/media/i2c/rdacm21.c
> > > index babd14b21252..875bec9f7904 100644
> > > --- a/drivers/media/i2c/rdacm21.c
> > > +++ b/drivers/media/i2c/rdacm21.c
> > > @@ -448,7 +448,10 @@ static int rdacm21_init(struct v4l2_subdev *sd, unsigned int val)
> > >  	if (ret)
> > >  		return ret;
> > >
> > > -	/* Enable GPIO1 and hold OV490 in reset during max9271 configuration. */
> > > +	/*
> > > +	 * Enable GPIO1 and hold OV490 in reset during max9271 configuration.
> > > +	 * The reset signal has to be asserted for at least 250 useconds.
> > > +	 */
> > >  	ret = max9271_enable_gpios(&dev->serializer, MAX9271_GPIO1OUT);
> > >  	if (ret)
> > >  		return ret;
> > > @@ -456,6 +459,7 @@ static int rdacm21_init(struct v4l2_subdev *sd, unsigned int val)
> > >  	ret = max9271_clear_gpios(&dev->serializer, MAX9271_GPIO1OUT);
> > >  	if (ret)
> > >  		return ret;
> > > +	usleep_range(250, 500);
> >
> > Aha, for a second there I thought the comment meant it had to be
> > asserted for 250 uS before clearing it again. But it's 250 uS before
> > using the OV490.

No, it's 250usecond before releasing it. After the OV490 is released
from reset there's a 3-5 milliseconds sleep below.

> >
> > Perhaps possible to update the comment a little, but nothing that matters.
>
> The commit message and comment should match the code, especially given

They do if I'm not mistaken.

> that I'm not sure here which of the two is actually incorrect. I suspect
> the sleep is actually in the wrong location.
>
> > Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> >
> >
> > >  	ret = max9271_configure_gmsl_link(&dev->serializer);
> > >  	if (ret)
> > >
>
> --
> Regards,
>
> Laurent Pinchart
diff mbox series

Patch

diff --git a/drivers/media/i2c/rdacm21.c b/drivers/media/i2c/rdacm21.c
index babd14b21252..875bec9f7904 100644
--- a/drivers/media/i2c/rdacm21.c
+++ b/drivers/media/i2c/rdacm21.c
@@ -448,7 +448,10 @@  static int rdacm21_init(struct v4l2_subdev *sd, unsigned int val)
 	if (ret)
 		return ret;
 
-	/* Enable GPIO1 and hold OV490 in reset during max9271 configuration. */
+	/*
+	 * Enable GPIO1 and hold OV490 in reset during max9271 configuration.
+	 * The reset signal has to be asserted for at least 250 useconds.
+	 */
 	ret = max9271_enable_gpios(&dev->serializer, MAX9271_GPIO1OUT);
 	if (ret)
 		return ret;
@@ -456,6 +459,7 @@  static int rdacm21_init(struct v4l2_subdev *sd, unsigned int val)
 	ret = max9271_clear_gpios(&dev->serializer, MAX9271_GPIO1OUT);
 	if (ret)
 		return ret;
+	usleep_range(250, 500);
 
 	ret = max9271_configure_gmsl_link(&dev->serializer);
 	if (ret)