linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] backlight: gpio_backlight: Drop output gpio direction check for initial power state
@ 2023-07-21  7:31 Ying Liu
  2023-07-21  8:42 ` Daniel Thompson
  0 siblings, 1 reply; 2+ messages in thread
From: Ying Liu @ 2023-07-21  7:31 UTC (permalink / raw)
  To: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
  Cc: lee@kernel.org, daniel.thompson@linaro.org, jingoohan1@gmail.com,
	deller@gmx.de, andy@kernel.org, linus.walleij@linaro.org,
	brgl@bgdev.pl

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:
---
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.
---

So, let's drop output gpio direction check and only check gpio value to set
the initial power state.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
---
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] 2+ messages in thread

* Re: [PATCH v2] backlight: gpio_backlight: Drop output gpio direction check for initial power state
  2023-07-21  7:31 [PATCH v2] backlight: gpio_backlight: Drop output gpio direction check for initial power state Ying Liu
@ 2023-07-21  8:42 ` Daniel Thompson
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Thompson @ 2023-07-21  8:42 UTC (permalink / raw)
  To: Ying Liu
  Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, lee@kernel.org,
	jingoohan1@gmail.com, deller@gmx.de, andy@kernel.org,
	linus.walleij@linaro.org, brgl@bgdev.pl

On Fri, Jul 21, 2023 at 07:31:37AM +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:
> ---
> 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.
> ---
>
> So, let's drop output gpio direction check and only check gpio value to set
> the initial power state.
>
> Signed-off-by: Liu Ying <victor.liu@nxp.com>

Based on the discussion for v1 about 706dc68102bc ("backlight: gpio:
Explicitly set the direction of the GPIO"), I think there should
be a Fixes: tag here.


Daniel.

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

end of thread, other threads:[~2023-07-21  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-21  7:31 [PATCH v2] backlight: gpio_backlight: Drop output gpio direction check for initial power state Ying Liu
2023-07-21  8:42 ` Daniel Thompson

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