# \[PATCH\] video: backlight: Drop maximum brightness override for brightness zero

- Subsystems: FRAMEBUFFER LAYER, BACKLIGHT CLASS/SUBSYSTEM, THE REST
- Maintainers: Helge Deller, Lee Jones, Daniel Thompson, Jingoo Han, Linus Torvalds
- List: linux-fbdev
- 3 messages, 3 authors
- Page: https://ratatoskr.run/linux-fbdev/2021/07/9202993/t

## \[PATCH\] video: backlight: Drop maximum brightness override for brightness zero

- From: Marek Vasut \<marex@denx.de\>
- Date: 2021-07-09 13:26:26 
- Message: https://ratatoskr.run/linux-fbdev/2021/07/9202993.md

```text
The note in c2adda27d202f ("video: backlight: Add of_find_backlight helper
in backlight.c") says that gpio-backlight uses brightness as power state.
This has been fixed since in ec665b756e6f7 ("backlight: gpio-backlight:
Correct initial power state handling") and other backlight drivers do not
require this workaround. Drop the workaround.

This fixes the case where e.g. pwm-backlight can perfectly well be set to
brightness 0 on boot in DT, which without this patch leads to the display
brightness to be max instead of off.

Fixes: c2adda27d202f ("video: backlight: Add of_find_backlight helper in backlight.c")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Daniel Thompson <redacted>
Cc: Meghana Madhyastha <redacted>
Cc: Noralf Trønnes <redacted>
Cc: Sean Paul <redacted>
Cc: Thierry Reding <redacted>
---
 drivers/video/backlight/backlight.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 537fe1b376ad7..fc990e576340b 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -688,12 +688,6 @@ static struct backlight_device *of_find_backlight(struct device *dev)
 			of_node_put(np);
 			if (!bd)
 				return ERR_PTR(-EPROBE_DEFER);
-			/*
-			 * Note: gpio_backlight uses brightness as
-			 * power state during probe
-			 */
-			if (!bd->props.brightness)
-				bd->props.brightness = bd->props.max_brightness;
 		}
 	}
 
-- 
2.30.2

```

## Re: \[PATCH\] video: backlight: Drop maximum brightness override for brightness zero

- From: Noralf Trønnes \<hidden\>
- Date: 2021-07-09 13:53:22 
- Message: https://ratatoskr.run/linux-fbdev/2021/07/9202994.md

```text


Den 09.07.2021 15.26, skrev Marek Vasut:
> The note in c2adda27d202f ("video: backlight: Add of_find_backlight helper
> in backlight.c") says that gpio-backlight uses brightness as power state.
> This has been fixed since in ec665b756e6f7 ("backlight: gpio-backlight:
> Correct initial power state handling") and other backlight drivers do not
> require this workaround. Drop the workaround.
> 
> This fixes the case where e.g. pwm-backlight can perfectly well be set to
> brightness 0 on boot in DT, which without this patch leads to the display
> brightness to be max instead of off.
> 
> Fixes: c2adda27d202f ("video: backlight: Add of_find_backlight helper in backlight.c")

I not sure about the rules, but if this is automatically picked up for
stable, maybe this is needed to avoid changing behaviour on 4.19:

Cc: <redacted> # 5.4+

of_find_backlight() was added in 4.17 and the gpio fix in 5.4.

Or perhaps there are other ways to signal this dependency.

> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Daniel Thompson <redacted>
> Cc: Meghana Madhyastha <redacted>
> Cc: Noralf Trønnes <redacted>
> Cc: Sean Paul <redacted>
> Cc: Thierry Reding <redacted>
> ---

Acked-by: Noralf Trønnes <redacted>
```

## Re: \[PATCH\] video: backlight: Drop maximum brightness override for brightness zero

- From: Daniel Thompson \<hidden\>
- Date: 2021-07-12 10:25:59 
- Message: https://ratatoskr.run/linux-fbdev/2021/07/9203115.md

```text
On Fri, Jul 09, 2021 at 03:53:16PM +0200, Noralf Trønnes wrote:
> 
> 
> Den 09.07.2021 15.26, skrev Marek Vasut:
> > The note in c2adda27d202f ("video: backlight: Add of_find_backlight helper
> > in backlight.c") says that gpio-backlight uses brightness as power state.
> > This has been fixed since in ec665b756e6f7 ("backlight: gpio-backlight:
> > Correct initial power state handling") and other backlight drivers do not
> > require this workaround. Drop the workaround.
> > 
> > This fixes the case where e.g. pwm-backlight can perfectly well be set to
> > brightness 0 on boot in DT, which without this patch leads to the display
> > brightness to be max instead of off.
> > 
> > Fixes: c2adda27d202f ("video: backlight: Add of_find_backlight helper in backlight.c")
> 
> I not sure about the rules, but if this is automatically picked up for
> stable, maybe this is needed to avoid changing behaviour on 4.19:
> 
> 
> of_find_backlight() was added in 4.17 and the gpio fix in 5.4.
> 
> Or perhaps there are other ways to signal this dependency.

Agree we need to make sure the Fixes: tag doesn't provoke regressions
in v4.19.

Is this the syntax appropriate?

Cc: <redacted> # 5.4+
Cc: <redacted> # 4.19.x: ec665b756e6f7: backlight: gpio-backlight: Correct initial power state handling


> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Daniel Thompson <redacted>
> > Cc: Meghana Madhyastha <redacted>
> > Cc: Noralf Trønnes <redacted>
> > Cc: Sean Paul <redacted>
> > Cc: Thierry Reding <redacted>
> > ---
> 
> Acked-by: Noralf Trønnes <redacted>

With the above (or something similar to avoid problems with v4.19):
Reviewed-by: Daniel Thompson <redacted>


Daniel.
```
