All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ying Liu <victor.liu@nxp.com>
To: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "lee@kernel.org" <lee@kernel.org>,
	"daniel.thompson@linaro.org" <daniel.thompson@linaro.org>,
	"jingoohan1@gmail.com" <jingoohan1@gmail.com>,
	"deller@gmx.de" <deller@gmx.de>
Subject: [PATCH] backlight: gpio_backlight: Drop output gpio direction check for initial power state
Date: Thu, 20 Jul 2023 06:06:27 +0000	[thread overview]
Message-ID: <20230720061105.154821-1-victor.liu@nxp.com> (raw)

Bootloader may leave gpio direction as input and gpio value as logical low.
It hints that initial backlight power state should be FB_BLANK_POWERDOWN
since the gpio value is literally logical low.  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>
---
 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 d3bea42407f1..d28c30b2a35d 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


WARNING: multiple messages have this Message-ID (diff)
From: Ying Liu <victor.liu@nxp.com>
To: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "jingoohan1@gmail.com" <jingoohan1@gmail.com>,
	"daniel.thompson@linaro.org" <daniel.thompson@linaro.org>,
	"lee@kernel.org" <lee@kernel.org>,
	"deller@gmx.de" <deller@gmx.de>
Subject: [PATCH] backlight: gpio_backlight: Drop output gpio direction check for initial power state
Date: Thu, 20 Jul 2023 06:06:27 +0000	[thread overview]
Message-ID: <20230720061105.154821-1-victor.liu@nxp.com> (raw)

Bootloader may leave gpio direction as input and gpio value as logical low.
It hints that initial backlight power state should be FB_BLANK_POWERDOWN
since the gpio value is literally logical low.  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>
---
 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 d3bea42407f1..d28c30b2a35d 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


             reply	other threads:[~2023-07-20  6:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20  6:06 Ying Liu [this message]
2023-07-20  6:06 ` [PATCH] backlight: gpio_backlight: Drop output gpio direction check for initial power state Ying Liu
2023-07-20 11:27 ` Daniel Thompson
2023-07-20 11:27   ` Daniel Thompson
2023-07-20 12:56   ` Bartosz Golaszewski
2023-07-20 12:56     ` Bartosz Golaszewski
2023-07-20 13:10     ` Daniel Thompson
2023-07-20 13:10       ` Daniel Thompson
2023-07-20 13:18       ` Bartosz Golaszewski
2023-07-20 13:18         ` Bartosz Golaszewski
2023-07-20 16:28   ` Andy Shevchenko
2023-07-20 16:28     ` Andy Shevchenko
2023-07-21  5:16   ` Ying Liu
2023-07-21  5:16     ` Ying Liu
2023-07-21  6:32     ` Andy Shevchenko
2023-07-21  6:32       ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230720061105.154821-1-victor.liu@nxp.com \
    --to=victor.liu@nxp.com \
    --cc=daniel.thompson@linaro.org \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jingoohan1@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.