From: Ying Liu <victor.liu@nxp.com> Date: 2023-07-21 09:29:12
If GPIO pin is in input state but backlight is currently off due to
default pull downs, then initial power state is set to FB_BLANK_UNBLANK
in DT boot mode with phandle link and the backlight is effectively
turned on in gpio_backlight_probe(), which is undesirable according to
patch description of commit ec665b756e6f ("backlight: gpio-backlight:
Correct initial power state handling").
Quote:
---8<---
If in DT boot we have phandle link then leave the GPIO in a state which the
bootloader left it and let the user of the backlight to configure it further.
---8<---
So, let's drop output GPIO direction check and only check GPIO value to set
the initial power state.
Fixes: 706dc68102bc ("backlight: gpio: Explicitly set the direction of the GPIO")
Signed-off-by: Liu Ying <victor.liu@nxp.com>
---
v3->v4:
* Capitalize words 'gpio' in patch description. (Andy)
* Capitalize word 'gpio' in patch title.
* Quote appropriately in patch description. (Andy)
v2->v3:
* Add Fixes tag. (Daniel)
v1->v2:
* Improve patch description. (Daniel, Bartosz, Andy)
drivers/video/backlight/gpio_backlight.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -87,8 +87,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)/* Not booted with device tree or no phandle link to the node */bl->props.power=def_value?FB_BLANK_UNBLANK:FB_BLANK_POWERDOWN;-elseif(gpiod_get_direction(gbl->gpiod)==0&&-gpiod_get_value_cansleep(gbl->gpiod)==0)+elseif(gpiod_get_value_cansleep(gbl->gpiod)==0)bl->props.power=FB_BLANK_POWERDOWN;elsebl->props.power=FB_BLANK_UNBLANK;
On Fri, Jul 21, 2023 at 09:29:03AM +0000, Ying Liu wrote:
If GPIO pin is in input state but backlight is currently off due to
default pull downs, then initial power state is set to FB_BLANK_UNBLANK
in DT boot mode with phandle link and the backlight is effectively
turned on in gpio_backlight_probe(), which is undesirable according to
patch description of commit ec665b756e6f ("backlight: gpio-backlight:
Correct initial power state handling").
Quote:
---8<---
If in DT boot we have phandle link then leave the GPIO in a state which the
bootloader left it and let the user of the backlight to configure it further.
---8<---
So, let's drop output GPIO direction check and only check GPIO value to set
the initial power state.
LGTM,
Reviewed-by: Andy Shevchenko <andy@kernel.org>
--
With Best Regards,
Andy Shevchenko
On Fri, Jul 21, 2023 at 11:29 AM Ying Liu [off-list ref] wrote:
quoted hunk
If GPIO pin is in input state but backlight is currently off due to
default pull downs, then initial power state is set to FB_BLANK_UNBLANK
in DT boot mode with phandle link and the backlight is effectively
turned on in gpio_backlight_probe(), which is undesirable according to
patch description of commit ec665b756e6f ("backlight: gpio-backlight:
Correct initial power state handling").
Quote:
---8<---
If in DT boot we have phandle link then leave the GPIO in a state which the
bootloader left it and let the user of the backlight to configure it further.
---8<---
So, let's drop output GPIO direction check and only check GPIO value to set
the initial power state.
Fixes: 706dc68102bc ("backlight: gpio: Explicitly set the direction of the GPIO")
Signed-off-by: Liu Ying <victor.liu@nxp.com>
---
v3->v4:
* Capitalize words 'gpio' in patch description. (Andy)
* Capitalize word 'gpio' in patch title.
* Quote appropriately in patch description. (Andy)
v2->v3:
* Add Fixes tag. (Daniel)
v1->v2:
* Improve patch description. (Daniel, Bartosz, Andy)
drivers/video/backlight/gpio_backlight.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -87,8 +87,7 @@ static int gpio_backlight_probe(struct platform_device *pdev)/* Not booted with device tree or no phandle link to the node */bl->props.power=def_value?FB_BLANK_UNBLANK:FB_BLANK_POWERDOWN;-elseif(gpiod_get_direction(gbl->gpiod)==0&&-gpiod_get_value_cansleep(gbl->gpiod)==0)+elseif(gpiod_get_value_cansleep(gbl->gpiod)==0)bl->props.power=FB_BLANK_POWERDOWN;elsebl->props.power=FB_BLANK_UNBLANK;--
On Fri, Jul 21, 2023 at 11:29 AM Ying Liu [off-list ref] wrote:
If GPIO pin is in input state but backlight is currently off due to
default pull downs,
Oh what an interesting corner case!
then initial power state is set to FB_BLANK_UNBLANK
in DT boot mode with phandle link and the backlight is effectively
turned on in gpio_backlight_probe(), which is undesirable according to
patch description of commit ec665b756e6f ("backlight: gpio-backlight:
Correct initial power state handling").
Quote:
---8<---
If in DT boot we have phandle link then leave the GPIO in a state which the
bootloader left it and let the user of the backlight to configure it further.
---8<---
So, let's drop output GPIO direction check and only check GPIO value to set
the initial power state.
Fixes: 706dc68102bc ("backlight: gpio: Explicitly set the direction of the GPIO")
Signed-off-by: Liu Ying <victor.liu@nxp.com>
From: Lee Jones <lee@kernel.org> Date: 2023-07-28 11:14:57
On Fri, 21 Jul 2023 09:29:03 +0000, Ying Liu wrote:
So, let's drop output GPIO direction check and only check GPIO value to set
the initial power state.
Applied, thanks!
[1/1] backlight: gpio_backlight: Drop output GPIO direction check for initial power state
commit: fe1328b5b2a087221e31da77e617f4c2b70f3b7f
--
Lee Jones [李琼斯]