* [PATCH] leds: lm3601x: reset led controller during init
@ 2024-07-29 20:40 Jack Chen
2024-08-01 13:15 ` Lee Jones
0 siblings, 1 reply; 3+ messages in thread
From: Jack Chen @ 2024-07-29 20:40 UTC (permalink / raw)
To: Pavel Machek, Lee Jones
Cc: Mark Brown, Vadim Pasternak, Randy Dunlap, Jack Chen,
linux-kernel, linux-leds
LED controller should be reset during initialization to avoid abnormal
behaviors. For example, when power to SoC is recycled but power to LED
controller is not, LED controller should not presume to be in original
state.
Signed-off-by: Jack Chen <zenghuchen@google.com>
---
drivers/leds/flash/leds-lm3601x.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/leds/flash/leds-lm3601x.c b/drivers/leds/flash/leds-lm3601x.c
index 7e93c447fec5..978256310540 100644
--- a/drivers/leds/flash/leds-lm3601x.c
+++ b/drivers/leds/flash/leds-lm3601x.c
@@ -434,6 +434,10 @@ static int lm3601x_probe(struct i2c_client *client)
return ret;
}
+ ret = regmap_write(led->regmap, LM3601X_DEV_ID_REG, LM3601X_SW_RESET);
+ if (ret)
+ dev_warn(&client->dev, "led controller is failed to reset\n");
+
mutex_init(&led->lock);
return lm3601x_register_leds(led, fwnode);
--
2.46.0.rc1.232.g9752f9e123-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] leds: lm3601x: reset led controller during init
2024-07-29 20:40 [PATCH] leds: lm3601x: reset led controller during init Jack Chen
@ 2024-08-01 13:15 ` Lee Jones
2024-08-01 15:27 ` Jack Chen
0 siblings, 1 reply; 3+ messages in thread
From: Lee Jones @ 2024-08-01 13:15 UTC (permalink / raw)
To: Jack Chen
Cc: Pavel Machek, Mark Brown, Vadim Pasternak, Randy Dunlap,
linux-kernel, linux-leds
Nit: Subject line descriptions start with an uppercase char in LED.
> LED controller should be reset during initialization to avoid abnormal
> behaviors. For example, when power to SoC is recycled but power to LED
> controller is not, LED controller should not presume to be in original
> state.
>
> Signed-off-by: Jack Chen <zenghuchen@google.com>
> ---
> drivers/leds/flash/leds-lm3601x.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/leds/flash/leds-lm3601x.c b/drivers/leds/flash/leds-lm3601x.c
> index 7e93c447fec5..978256310540 100644
> --- a/drivers/leds/flash/leds-lm3601x.c
> +++ b/drivers/leds/flash/leds-lm3601x.c
> @@ -434,6 +434,10 @@ static int lm3601x_probe(struct i2c_client *client)
> return ret;
> }
>
> + ret = regmap_write(led->regmap, LM3601X_DEV_ID_REG, LM3601X_SW_RESET);
So this controller is reset via the ID register?
> + if (ret)
> + dev_warn(&client->dev, "led controller is failed to reset\n");
"LED controller failed to reset"
Or
"Failed to reset the LED controller"
> mutex_init(&led->lock);
>
> return lm3601x_register_leds(led, fwnode);
> --
> 2.46.0.rc1.232.g9752f9e123-goog
>
>
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] leds: lm3601x: reset led controller during init
2024-08-01 13:15 ` Lee Jones
@ 2024-08-01 15:27 ` Jack Chen
0 siblings, 0 replies; 3+ messages in thread
From: Jack Chen @ 2024-08-01 15:27 UTC (permalink / raw)
To: Lee Jones
Cc: Pavel Machek, Mark Brown, Vadim Pasternak, Randy Dunlap,
linux-kernel, linux-leds
On Thu, Aug 1, 2024 at 9:15 AM Lee Jones <lee@kernel.org> wrote:
>
> Nit: Subject line descriptions start with an uppercase char in LED.
>
> > LED controller should be reset during initialization to avoid abnormal
> > behaviors. For example, when power to SoC is recycled but power to LED
> > controller is not, LED controller should not presume to be in original
> > state.
> >
> > Signed-off-by: Jack Chen <zenghuchen@google.com>
> > ---
> > drivers/leds/flash/leds-lm3601x.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/leds/flash/leds-lm3601x.c b/drivers/leds/flash/leds-lm3601x.c
> > index 7e93c447fec5..978256310540 100644
> > --- a/drivers/leds/flash/leds-lm3601x.c
> > +++ b/drivers/leds/flash/leds-lm3601x.c
> > @@ -434,6 +434,10 @@ static int lm3601x_probe(struct i2c_client *client)
> > return ret;
> > }
> >
> > + ret = regmap_write(led->regmap, LM3601X_DEV_ID_REG, LM3601X_SW_RESET);
>
> So this controller is reset via the ID register?
Yes, that is correct. The MSB of LM3601X_DEV_ID_REG.
>
> > + if (ret)
> > + dev_warn(&client->dev, "led controller is failed to reset\n");
>
> "LED controller failed to reset"
>
> Or
>
> "Failed to reset the LED controller"
>
> > mutex_init(&led->lock);
> >
> > return lm3601x_register_leds(led, fwnode);
> > --
> > 2.46.0.rc1.232.g9752f9e123-goog
> >
> >
>
> --
> Lee Jones [李琼斯]
Thanks so much for feedback. I will send a V2 patch with changes.
Best regards
Jack Chen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-01 15:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-29 20:40 [PATCH] leds: lm3601x: reset led controller during init Jack Chen
2024-08-01 13:15 ` Lee Jones
2024-08-01 15:27 ` Jack Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox