All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] backlight: gpio_backlight: Drop output GPIO direction check for initial power state
@ 2023-07-21  9:29 ` Ying Liu
  0 siblings, 0 replies; 10+ messages in thread
From: Ying Liu @ 2023-07-21  9:29 UTC (permalink / raw)
  To: dri-devel, linux-fbdev, linux-kernel
  Cc: lee, daniel.thompson, jingoohan1, deller, andy, linus.walleij, brgl

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(-)

diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index 6f78d928f054..38c46936fdcd 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -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;
-	else if (gpiod_get_direction(gbl->gpiod) == 0 &&
-		 gpiod_get_value_cansleep(gbl->gpiod) == 0)
+	else if (gpiod_get_value_cansleep(gbl->gpiod) == 0)
 		bl->props.power = FB_BLANK_POWERDOWN;
 	else
 		bl->props.power = FB_BLANK_UNBLANK;
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v4] backlight: gpio_backlight: Drop output GPIO direction check for initial power state
@ 2023-07-21  9:29 ` Ying Liu
  0 siblings, 0 replies; 10+ messages in thread
From: Ying Liu @ 2023-07-21  9:29 UTC (permalink / raw)
  To: dri-devel, linux-fbdev, linux-kernel
  Cc: andy, daniel.thompson, jingoohan1, deller, lee, brgl

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(-)

diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
index 6f78d928f054..38c46936fdcd 100644
--- a/drivers/video/backlight/gpio_backlight.c
+++ b/drivers/video/backlight/gpio_backlight.c
@@ -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;
-	else if (gpiod_get_direction(gbl->gpiod) == 0 &&
-		 gpiod_get_value_cansleep(gbl->gpiod) == 0)
+	else if (gpiod_get_value_cansleep(gbl->gpiod) == 0)
 		bl->props.power = FB_BLANK_POWERDOWN;
 	else
 		bl->props.power = FB_BLANK_UNBLANK;
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v4] backlight: gpio_backlight: Drop output GPIO direction check for initial power state
  2023-07-21  9:29 ` Ying Liu
@ 2023-07-21 10:38   ` andy
  -1 siblings, 0 replies; 10+ messages in thread
From: andy @ 2023-07-21 10:38 UTC (permalink / raw)
  To: Ying Liu
  Cc: dri-devel, linux-fbdev, linux-kernel, lee, daniel.thompson,
	jingoohan1, deller, linus.walleij, brgl

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4] backlight: gpio_backlight: Drop output GPIO direction check for initial power state
@ 2023-07-21 10:38   ` andy
  0 siblings, 0 replies; 10+ messages in thread
From: andy @ 2023-07-21 10:38 UTC (permalink / raw)
  To: Ying Liu
  Cc: daniel.thompson, jingoohan1, deller, lee, linux-fbdev, dri-devel,
	linux-kernel, brgl

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4] backlight: gpio_backlight: Drop output GPIO direction check for initial power state
  2023-07-21  9:29 ` Ying Liu
@ 2023-07-21 11:07   ` Bartosz Golaszewski
  -1 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2023-07-21 11:07 UTC (permalink / raw)
  To: Ying Liu
  Cc: andy, daniel.thompson, jingoohan1, deller, lee, linux-fbdev,
	dri-devel, linux-kernel

On Fri, Jul 21, 2023 at 11:29 AM Ying Liu <victor.liu@nxp.com> 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.
>
> 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(-)
>
> diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
> index 6f78d928f054..38c46936fdcd 100644
> --- a/drivers/video/backlight/gpio_backlight.c
> +++ b/drivers/video/backlight/gpio_backlight.c
> @@ -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;
> -       else if (gpiod_get_direction(gbl->gpiod) == 0 &&
> -                gpiod_get_value_cansleep(gbl->gpiod) == 0)
> +       else if (gpiod_get_value_cansleep(gbl->gpiod) == 0)
>                 bl->props.power = FB_BLANK_POWERDOWN;
>         else
>                 bl->props.power = FB_BLANK_UNBLANK;
> --
> 2.37.1
>

Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4] backlight: gpio_backlight: Drop output GPIO direction check for initial power state
@ 2023-07-21 11:07   ` Bartosz Golaszewski
  0 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2023-07-21 11:07 UTC (permalink / raw)
  To: Ying Liu
  Cc: dri-devel, linux-fbdev, linux-kernel, lee, daniel.thompson,
	jingoohan1, deller, andy, linus.walleij

On Fri, Jul 21, 2023 at 11:29 AM Ying Liu <victor.liu@nxp.com> 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.
>
> 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(-)
>
> diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c
> index 6f78d928f054..38c46936fdcd 100644
> --- a/drivers/video/backlight/gpio_backlight.c
> +++ b/drivers/video/backlight/gpio_backlight.c
> @@ -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;
> -       else if (gpiod_get_direction(gbl->gpiod) == 0 &&
> -                gpiod_get_value_cansleep(gbl->gpiod) == 0)
> +       else if (gpiod_get_value_cansleep(gbl->gpiod) == 0)
>                 bl->props.power = FB_BLANK_POWERDOWN;
>         else
>                 bl->props.power = FB_BLANK_UNBLANK;
> --
> 2.37.1
>

Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4] backlight: gpio_backlight: Drop output GPIO direction check for initial power state
  2023-07-21  9:29 ` Ying Liu
@ 2023-07-24 17:46   ` Linus Walleij
  -1 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2023-07-24 17:46 UTC (permalink / raw)
  To: Ying Liu
  Cc: andy, daniel.thompson, jingoohan1, deller, lee, linux-fbdev,
	dri-devel, linux-kernel, brgl

On Fri, Jul 21, 2023 at 11:29 AM Ying Liu <victor.liu@nxp.com> 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>

The solutions seems fine.
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4] backlight: gpio_backlight: Drop output GPIO direction check for initial power state
@ 2023-07-24 17:46   ` Linus Walleij
  0 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2023-07-24 17:46 UTC (permalink / raw)
  To: Ying Liu
  Cc: dri-devel, linux-fbdev, linux-kernel, lee, daniel.thompson,
	jingoohan1, deller, andy, brgl

On Fri, Jul 21, 2023 at 11:29 AM Ying Liu <victor.liu@nxp.com> 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>

The solutions seems fine.
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (subset) [PATCH v4] backlight: gpio_backlight: Drop output GPIO direction check for initial power state
  2023-07-21  9:29 ` Ying Liu
@ 2023-07-28 11:14   ` Lee Jones
  -1 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2023-07-28 11:14 UTC (permalink / raw)
  To: dri-devel, linux-fbdev, linux-kernel, Ying Liu
  Cc: lee, daniel.thompson, jingoohan1, deller, andy, linus.walleij, brgl

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 [李琼斯]


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: (subset) [PATCH v4] backlight: gpio_backlight: Drop output GPIO direction check for initial power state
@ 2023-07-28 11:14   ` Lee Jones
  0 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2023-07-28 11:14 UTC (permalink / raw)
  To: dri-devel, linux-fbdev, linux-kernel, Ying Liu
  Cc: andy, daniel.thompson, jingoohan1, deller, lee, brgl

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 [李琼斯]


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-07-28 11:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21  9:29 [PATCH v4] backlight: gpio_backlight: Drop output GPIO direction check for initial power state Ying Liu
2023-07-21  9:29 ` Ying Liu
2023-07-21 10:38 ` andy
2023-07-21 10:38   ` andy
2023-07-21 11:07 ` Bartosz Golaszewski
2023-07-21 11:07   ` Bartosz Golaszewski
2023-07-24 17:46 ` Linus Walleij
2023-07-24 17:46   ` Linus Walleij
2023-07-28 11:14 ` (subset) " Lee Jones
2023-07-28 11:14   ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.