* [PATCH v1] backlight: lm3630a: turn off both led strings when display is blank
@ 2023-05-05 18:57 Maximilian Weigand
2023-05-09 13:27 ` Daniel Thompson
2023-05-09 16:52 ` Sam Ravnborg
0 siblings, 2 replies; 5+ messages in thread
From: Maximilian Weigand @ 2023-05-05 18:57 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Helge Deller,
Thierry Reding, Uwe Kleine-König, dri-devel, linux-fbdev,
linux-kernel, linux-pwm
Cc: Maximilian Weigand
From: Maximilian Weigand <mweigand@mweigand.net>
Use display_is_blank() to determine if the led strings should be turned
off in the update_status() functions of both strings.
Signed-off-by: Maximilian Weigand <mweigand@mweigand.net>
---
drivers/video/backlight/lm3630a_bl.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c
index d8c42acecb5d..5498b57329f9 100644
--- a/drivers/video/backlight/lm3630a_bl.c
+++ b/drivers/video/backlight/lm3630a_bl.c
@@ -202,7 +202,9 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)
usleep_range(1000, 2000);
/* minimum brightness is 0x04 */
ret = lm3630a_write(pchip, REG_BRT_A, bl->props.brightness);
- if (bl->props.brightness < 0x4)
+
+ if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))
+ /* turn the string off */
ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDA_ENABLE, 0);
else
ret |= lm3630a_update(pchip, REG_CTRL,
@@ -277,7 +279,9 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)
usleep_range(1000, 2000);
/* minimum brightness is 0x04 */
ret = lm3630a_write(pchip, REG_BRT_B, bl->props.brightness);
- if (bl->props.brightness < 0x4)
+
+ if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))
+ /* turn the string off */
ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDB_ENABLE, 0);
else
ret |= lm3630a_update(pchip, REG_CTRL,
base-commit: 457391b0380335d5e9a5babdec90ac53928b23b4
--
2.39.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1] backlight: lm3630a: turn off both led strings when display is blank
2023-05-05 18:57 [PATCH v1] backlight: lm3630a: turn off both led strings when display is blank Maximilian Weigand
@ 2023-05-09 13:27 ` Daniel Thompson
2023-05-10 8:51 ` Maximilian Weigand
2023-05-09 16:52 ` Sam Ravnborg
1 sibling, 1 reply; 5+ messages in thread
From: Daniel Thompson @ 2023-05-09 13:27 UTC (permalink / raw)
To: Maximilian Weigand
Cc: Lee Jones, Jingoo Han, Helge Deller, Thierry Reding,
Uwe Kleine-König, dri-devel, linux-fbdev, linux-kernel,
linux-pwm, Maximilian Weigand
On Fri, May 05, 2023 at 08:57:52PM +0200, Maximilian Weigand wrote:
> From: Maximilian Weigand <mweigand@mweigand.net>
>
> Use display_is_blank() to determine if the led strings should be turned
Shouldn't this be backlight_is_blank()?
> off in the update_status() functions of both strings.
Once the description is fixed this is:
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Daniel.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] backlight: lm3630a: turn off both led strings when display is blank
2023-05-05 18:57 [PATCH v1] backlight: lm3630a: turn off both led strings when display is blank Maximilian Weigand
2023-05-09 13:27 ` Daniel Thompson
@ 2023-05-09 16:52 ` Sam Ravnborg
2023-05-10 8:52 ` Maximilian Weigand
1 sibling, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2023-05-09 16:52 UTC (permalink / raw)
To: Maximilian Weigand
Cc: Lee Jones, Daniel Thompson, Jingoo Han, Helge Deller,
Thierry Reding, Uwe Kleine-König, dri-devel, linux-fbdev,
linux-kernel, linux-pwm, Maximilian Weigand
On Fri, May 05, 2023 at 08:57:52PM +0200, Maximilian Weigand wrote:
> From: Maximilian Weigand <mweigand@mweigand.net>
>
> Use display_is_blank() to determine if the led strings should be turned
> off in the update_status() functions of both strings.
>
> Signed-off-by: Maximilian Weigand <mweigand@mweigand.net>
> ---
> drivers/video/backlight/lm3630a_bl.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c
> index d8c42acecb5d..5498b57329f9 100644
> --- a/drivers/video/backlight/lm3630a_bl.c
> +++ b/drivers/video/backlight/lm3630a_bl.c
> @@ -202,7 +202,9 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)
> usleep_range(1000, 2000);
> /* minimum brightness is 0x04 */
> ret = lm3630a_write(pchip, REG_BRT_A, bl->props.brightness);
> - if (bl->props.brightness < 0x4)
> +
> + if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))
You could replace bl->props.brightness with backlight_get_brightness(bl)
to avoid direct access to the properties.
> + /* turn the string off */
> ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDA_ENABLE, 0);
> else
> ret |= lm3630a_update(pchip, REG_CTRL,
> @@ -277,7 +279,9 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)
> usleep_range(1000, 2000);
> /* minimum brightness is 0x04 */
> ret = lm3630a_write(pchip, REG_BRT_B, bl->props.brightness);
> - if (bl->props.brightness < 0x4)
> +
> + if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))
Same here
Sam
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] backlight: lm3630a: turn off both led strings when display is blank
2023-05-09 13:27 ` Daniel Thompson
@ 2023-05-10 8:51 ` Maximilian Weigand
0 siblings, 0 replies; 5+ messages in thread
From: Maximilian Weigand @ 2023-05-10 8:51 UTC (permalink / raw)
To: Daniel Thompson, Maximilian Weigand
Cc: Lee Jones, Jingoo Han, Helge Deller, Thierry Reding,
Uwe Kleine-König, dri-devel, linux-fbdev, linux-kernel,
linux-pwm
>> Use display_is_blank() to determine if the led strings should be turned
>
> Shouldn't this be backlight_is_blank()?
Yes, indeed. Thanks for pointing this out. Fixed in v2.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] backlight: lm3630a: turn off both led strings when display is blank
2023-05-09 16:52 ` Sam Ravnborg
@ 2023-05-10 8:52 ` Maximilian Weigand
0 siblings, 0 replies; 5+ messages in thread
From: Maximilian Weigand @ 2023-05-10 8:52 UTC (permalink / raw)
To: Sam Ravnborg, Maximilian Weigand
Cc: Lee Jones, Daniel Thompson, Jingoo Han, Helge Deller,
Thierry Reding, Uwe Kleine-König, dri-devel, linux-fbdev,
linux-kernel, linux-pwm
>> + if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))
> You could replace bl->props.brightness with backlight_get_brightness(bl)
> to avoid direct access to the properties.
Thanks. Changed in v2.
>> + /* turn the string off */
>> ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDA_ENABLE, 0);
>> else
>> ret |= lm3630a_update(pchip, REG_CTRL,
>> @@ -277,7 +279,9 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)
>> usleep_range(1000, 2000);
>> /* minimum brightness is 0x04 */
>> ret = lm3630a_write(pchip, REG_BRT_B, bl->props.brightness);
>> - if (bl->props.brightness < 0x4)
>> +
>> + if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))
Thanks. Changed in v2.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-10 8:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05 18:57 [PATCH v1] backlight: lm3630a: turn off both led strings when display is blank Maximilian Weigand
2023-05-09 13:27 ` Daniel Thompson
2023-05-10 8:51 ` Maximilian Weigand
2023-05-09 16:52 ` Sam Ravnborg
2023-05-10 8:52 ` Maximilian Weigand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).