[v4,06/11] leds: aw200xx: add delay after software reset

Message ID 20231121202835.28152-7-ddrokosov@salutedevices.com
State New
Headers
Series leds: aw200xx: several driver updates |

Commit Message

Dmitry Rokosov Nov. 21, 2023, 8:28 p.m. UTC
  From: George Stark <gnstark@salutedevices.com>

According to datasheets of aw200xx devices software reset takes at
least 1ms so add delay after reset before issuing commands to device.

Signed-off-by: George Stark <gnstark@salutedevices.com>
Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/leds/leds-aw200xx.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Lee Jones Nov. 23, 2023, 4:38 p.m. UTC | #1
On Tue, 21 Nov 2023, Dmitry Rokosov wrote:

> From: George Stark <gnstark@salutedevices.com>
> 
> According to datasheets of aw200xx devices software reset takes at
> least 1ms so add delay after reset before issuing commands to device.

Are you able to use an auto-correct tool to sharpen the grammar a little?

> Signed-off-by: George Stark <gnstark@salutedevices.com>
> Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
>  drivers/leds/leds-aw200xx.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/leds/leds-aw200xx.c b/drivers/leds/leds-aw200xx.c
> index 4bce5e7381c0..bb17e48b3e2a 100644
> --- a/drivers/leds/leds-aw200xx.c
> +++ b/drivers/leds/leds-aw200xx.c
> @@ -321,6 +321,9 @@ static int aw200xx_chip_reset(const struct aw200xx *const chip)
>  	if (ret)
>  		return ret;
>  
> +	/* according to datasheet software reset takes at least 1ms */

Please start sentences with an uppercase char.

"According to the datasheet, software resets take at least 1ms"
              ^                            ^     ^

> +	fsleep(1000);
> +
>  	regcache_mark_dirty(chip->regmap);
>  	return regmap_write(chip->regmap, AW200XX_REG_FCD, AW200XX_FCD_CLEAR);
>  }
> -- 
> 2.36.0
>
  
Dmitry Rokosov Nov. 24, 2023, 9:37 a.m. UTC | #2
Hello Lee,

Thank you for the detailed review!

Please find my answer below.

On Thu, Nov 23, 2023 at 04:38:16PM +0000, Lee Jones wrote:
> On Tue, 21 Nov 2023, Dmitry Rokosov wrote:
> 
> > From: George Stark <gnstark@salutedevices.com>
> > 
> > According to datasheets of aw200xx devices software reset takes at
> > least 1ms so add delay after reset before issuing commands to device.
> 
> Are you able to use an auto-correct tool to sharpen the grammar a little?
> 
> > Signed-off-by: George Stark <gnstark@salutedevices.com>
> > Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> > ---
> >  drivers/leds/leds-aw200xx.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/leds/leds-aw200xx.c b/drivers/leds/leds-aw200xx.c
> > index 4bce5e7381c0..bb17e48b3e2a 100644
> > --- a/drivers/leds/leds-aw200xx.c
> > +++ b/drivers/leds/leds-aw200xx.c
> > @@ -321,6 +321,9 @@ static int aw200xx_chip_reset(const struct aw200xx *const chip)
> >  	if (ret)
> >  		return ret;
> >  
> > +	/* according to datasheet software reset takes at least 1ms */
> 
> Please start sentences with an uppercase char.
> 
> "According to the datasheet, software resets take at least 1ms"
>               ^                            ^     ^
> 

Here it's only one 'software reset' mentioned.

> > +	fsleep(1000);
> > +
> >  	regcache_mark_dirty(chip->regmap);
> >  	return regmap_write(chip->regmap, AW200XX_REG_FCD, AW200XX_FCD_CLEAR);
> >  }
> > -- 
> > 2.36.0
> > 
> 
> -- 
> Lee Jones [李琼斯]
  
Lee Jones Nov. 27, 2023, 9:14 a.m. UTC | #3
On Fri, 24 Nov 2023, Dmitry Rokosov wrote:

> Hello Lee,
> 
> Thank you for the detailed review!
> 
> Please find my answer below.
> 
> On Thu, Nov 23, 2023 at 04:38:16PM +0000, Lee Jones wrote:
> > On Tue, 21 Nov 2023, Dmitry Rokosov wrote:
> > 
> > > From: George Stark <gnstark@salutedevices.com>
> > > 
> > > According to datasheets of aw200xx devices software reset takes at
> > > least 1ms so add delay after reset before issuing commands to device.
> > 
> > Are you able to use an auto-correct tool to sharpen the grammar a little?
> > 
> > > Signed-off-by: George Stark <gnstark@salutedevices.com>
> > > Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
> > > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> > > ---
> > >  drivers/leds/leds-aw200xx.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/drivers/leds/leds-aw200xx.c b/drivers/leds/leds-aw200xx.c
> > > index 4bce5e7381c0..bb17e48b3e2a 100644
> > > --- a/drivers/leds/leds-aw200xx.c
> > > +++ b/drivers/leds/leds-aw200xx.c
> > > @@ -321,6 +321,9 @@ static int aw200xx_chip_reset(const struct aw200xx *const chip)
> > >  	if (ret)
> > >  		return ret;
> > >  
> > > +	/* according to datasheet software reset takes at least 1ms */
> > 
> > Please start sentences with an uppercase char.
> > 
> > "According to the datasheet, software resets take at least 1ms"
> >               ^                            ^     ^
> > 
> 
> Here it's only one 'software reset' mentioned.

That's okay.  The English is still 100% valid, since this describes them
happening more than once; say per week, per year, per lifetime of the
H/W or some such.  If you *really* want to describe one reset happening
once, ever, then you can say "a software reset takes".

> > > +	fsleep(1000);
> > > +
> > >  	regcache_mark_dirty(chip->regmap);
> > >  	return regmap_write(chip->regmap, AW200XX_REG_FCD, AW200XX_FCD_CLEAR);
> > >  }
  

Patch

diff --git a/drivers/leds/leds-aw200xx.c b/drivers/leds/leds-aw200xx.c
index 4bce5e7381c0..bb17e48b3e2a 100644
--- a/drivers/leds/leds-aw200xx.c
+++ b/drivers/leds/leds-aw200xx.c
@@ -321,6 +321,9 @@  static int aw200xx_chip_reset(const struct aw200xx *const chip)
 	if (ret)
 		return ret;
 
+	/* according to datasheet software reset takes at least 1ms */
+	fsleep(1000);
+
 	regcache_mark_dirty(chip->regmap);
 	return regmap_write(chip->regmap, AW200XX_REG_FCD, AW200XX_FCD_CLEAR);
 }