Message ID | 20240816102626.826-1-naoki@radxa.com |
---|---|
State | New |
Headers | show |
Series | leds: pwm-multicolor: fix multicolor PWM LED lights up without any setting | expand |
On Fri, 16 Aug 2024, FUKAUMI Naoki wrote: > from drivers/leds/leds-pwm.c:led_pwm_set(), > > /* > * Disabling a PWM doesn't guarantee that it emits the inactive level. > * So keep it on. Only for suspending the PWM should be disabled because > * otherwise it refuses to suspend. The possible downside is that the > * LED might stay (or even go) on. > */ > > do the same in led_pwm_mc_set(). > > this fixes LEDs light up without any setting (i.e. brightness is 0) on > Radxa E25. Please redraft the commit message into proper sentences, complete with correct grammar. All sentences should start with an uppercase char. Copying comment-blocks into commit messages to save authors from writing one isn't really the done thing. > Signed-off-by: FUKAUMI Naoki <naoki@radxa.com> > --- > drivers/leds/rgb/leds-pwm-multicolor.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/leds/rgb/leds-pwm-multicolor.c b/drivers/leds/rgb/leds-pwm-multicolor.c > index e1a81e0109e8..7155339c075e 100644 > --- a/drivers/leds/rgb/leds-pwm-multicolor.c > +++ b/drivers/leds/rgb/leds-pwm-multicolor.c > @@ -50,7 +50,7 @@ static int led_pwm_mc_set(struct led_classdev *cdev, > duty = priv->leds[i].state.period - duty; > > priv->leds[i].state.duty_cycle = duty; > - priv->leds[i].state.enabled = duty > 0; > + priv->leds[i].state.enabled = !(cdev->flags & LED_SUSPENDED); > ret = pwm_apply_might_sleep(priv->leds[i].pwm, > &priv->leds[i].state); > if (ret) > -- > 2.43.0 >
Hi, On 8/22/24 01:11, Lee Jones wrote: > On Fri, 16 Aug 2024, FUKAUMI Naoki wrote: > >> from drivers/leds/leds-pwm.c:led_pwm_set(), >> >> /* >> * Disabling a PWM doesn't guarantee that it emits the inactive level. >> * So keep it on. Only for suspending the PWM should be disabled because >> * otherwise it refuses to suspend. The possible downside is that the >> * LED might stay (or even go) on. >> */ >> >> do the same in led_pwm_mc_set(). >> >> this fixes LEDs light up without any setting (i.e. brightness is 0) on >> Radxa E25. > > Please redraft the commit message into proper sentences, complete with > correct grammar. All sentences should start with an uppercase char. Thank you for your review! I'll do it in next ver. > Copying comment-blocks into commit messages to save authors from writing > one isn't really the done thing. Sorry, I could not understand this part. What should I do for this? Best regards, -- FUKAUMI Naoki Radxa Computer (Shenzhen) Co., Ltd. >> Signed-off-by: FUKAUMI Naoki <naoki@radxa.com> >> --- >> drivers/leds/rgb/leds-pwm-multicolor.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/leds/rgb/leds-pwm-multicolor.c b/drivers/leds/rgb/leds-pwm-multicolor.c >> index e1a81e0109e8..7155339c075e 100644 >> --- a/drivers/leds/rgb/leds-pwm-multicolor.c >> +++ b/drivers/leds/rgb/leds-pwm-multicolor.c >> @@ -50,7 +50,7 @@ static int led_pwm_mc_set(struct led_classdev *cdev, >> duty = priv->leds[i].state.period - duty; >> >> priv->leds[i].state.duty_cycle = duty; >> - priv->leds[i].state.enabled = duty > 0; >> + priv->leds[i].state.enabled = !(cdev->flags & LED_SUSPENDED); >> ret = pwm_apply_might_sleep(priv->leds[i].pwm, >> &priv->leds[i].state); >> if (ret) >> -- >> 2.43.0 >> >
Hi, On 8/22/24 06:26, FUKAUMI Naoki wrote: > Hi, > > On 8/22/24 01:11, Lee Jones wrote: >> On Fri, 16 Aug 2024, FUKAUMI Naoki wrote: >> >>> from drivers/leds/leds-pwm.c:led_pwm_set(), >>> >>> /* >>> * Disabling a PWM doesn't guarantee that it emits the inactive level. >>> * So keep it on. Only for suspending the PWM should be disabled >>> because >>> * otherwise it refuses to suspend. The possible downside is that the >>> * LED might stay (or even go) on. >>> */ >>> >>> do the same in led_pwm_mc_set(). >>> >>> this fixes LEDs light up without any setting (i.e. brightness is 0) on >>> Radxa E25. >> >> Please redraft the commit message into proper sentences, complete with >> correct grammar. All sentences should start with an uppercase char. > > Thank you for your review! > > I'll do it in next ver. > >> Copying comment-blocks into commit messages to save authors from writing >> one isn't really the done thing. > > Sorry, I could not understand this part. What should I do for this? I (probably) understand what you said. I need to explain detail in my own words and use correct English. unfortunately my knowledge about electrical circuits and English is not sufficient for now. I need some time to learn some things for writing "why my fix is correct". then, I will not be able to send v2 so soon. if someone who understand well about this problem and the fix, feel free to reuse my patch (or make better patch). Best regards -- FUKAUMI Naoki Radxa Computer (Shenzhen) Co., Ltd. > Best regards, > > -- > FUKAUMI Naoki > Radxa Computer (Shenzhen) Co., Ltd. > >>> Signed-off-by: FUKAUMI Naoki <naoki@radxa.com> >>> --- >>> drivers/leds/rgb/leds-pwm-multicolor.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/leds/rgb/leds-pwm-multicolor.c >>> b/drivers/leds/rgb/leds-pwm-multicolor.c >>> index e1a81e0109e8..7155339c075e 100644 >>> --- a/drivers/leds/rgb/leds-pwm-multicolor.c >>> +++ b/drivers/leds/rgb/leds-pwm-multicolor.c >>> @@ -50,7 +50,7 @@ static int led_pwm_mc_set(struct led_classdev *cdev, >>> duty = priv->leds[i].state.period - duty; >>> priv->leds[i].state.duty_cycle = duty; >>> - priv->leds[i].state.enabled = duty > 0; >>> + priv->leds[i].state.enabled = !(cdev->flags & LED_SUSPENDED); >>> ret = pwm_apply_might_sleep(priv->leds[i].pwm, >>> &priv->leds[i].state); >>> if (ret) >>> -- >>> 2.43.0 >>> >>
On Thu, 22 Aug 2024, FUKAUMI Naoki wrote: > Hi, > > On 8/22/24 06:26, FUKAUMI Naoki wrote: > > Hi, > > > > On 8/22/24 01:11, Lee Jones wrote: > > > On Fri, 16 Aug 2024, FUKAUMI Naoki wrote: > > > > > > > from drivers/leds/leds-pwm.c:led_pwm_set(), > > > > > > > > /* > > > > * Disabling a PWM doesn't guarantee that it emits the inactive level. > > > > * So keep it on. Only for suspending the PWM should be > > > > disabled because > > > > * otherwise it refuses to suspend. The possible downside is that the > > > > * LED might stay (or even go) on. > > > > */ > > > > > > > > do the same in led_pwm_mc_set(). > > > > > > > > this fixes LEDs light up without any setting (i.e. brightness is 0) on > > > > Radxa E25. > > > > > > Please redraft the commit message into proper sentences, complete with > > > correct grammar. All sentences should start with an uppercase char. > > > > Thank you for your review! > > > > I'll do it in next ver. > > > > > Copying comment-blocks into commit messages to save authors from writing > > > one isn't really the done thing. > > > > Sorry, I could not understand this part. What should I do for this? > > I (probably) understand what you said. I need to explain detail in my own > words and use correct English. > > unfortunately my knowledge about electrical circuits and English is not > sufficient for now. > I need some time to learn some things for writing "why my fix is correct". > > then, I will not be able to send v2 so soon. if someone who understand well > about this problem and the fix, feel free to reuse my patch (or make better > patch). You understood enough to read the comment and realise that it was related. Simply reword the comment block that you copied and pasted to explain why this is also relevant to your device. This is the sort of thing that AI might be able to help you with.
diff --git a/drivers/leds/rgb/leds-pwm-multicolor.c b/drivers/leds/rgb/leds-pwm-multicolor.c index e1a81e0109e8..7155339c075e 100644 --- a/drivers/leds/rgb/leds-pwm-multicolor.c +++ b/drivers/leds/rgb/leds-pwm-multicolor.c @@ -50,7 +50,7 @@ static int led_pwm_mc_set(struct led_classdev *cdev, duty = priv->leds[i].state.period - duty; priv->leds[i].state.duty_cycle = duty; - priv->leds[i].state.enabled = duty > 0; + priv->leds[i].state.enabled = !(cdev->flags & LED_SUSPENDED); ret = pwm_apply_might_sleep(priv->leds[i].pwm, &priv->leds[i].state); if (ret)
from drivers/leds/leds-pwm.c:led_pwm_set(), /* * Disabling a PWM doesn't guarantee that it emits the inactive level. * So keep it on. Only for suspending the PWM should be disabled because * otherwise it refuses to suspend. The possible downside is that the * LED might stay (or even go) on. */ do the same in led_pwm_mc_set(). this fixes LEDs light up without any setting (i.e. brightness is 0) on Radxa E25. Signed-off-by: FUKAUMI Naoki <naoki@radxa.com> --- drivers/leds/rgb/leds-pwm-multicolor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)