From: Daniel Thompson <daniel.thompson@linaro.org>
To: Geert Uytterhoeven <geert+renesas@glider.be>,
Thierry Reding <thierry.reding@gmail.com>,
Lee Jones <lee.jones@linaro.org>,
Jingoo Han <jingoohan1@gmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org,
linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] backlight: pwm_bl: Fix GPIO out for unimplemented .get_direction()
Date: Fri, 24 Mar 2017 16:42:53 +0000 [thread overview]
Message-ID: <c00f689f-dae6-14d6-55d3-b1b44db19dc1@linaro.org> (raw)
In-Reply-To: <1490203285-28324-1-git-send-email-geert+renesas@glider.be>
On 22/03/17 17:21, Geert Uytterhoeven wrote:
> Commit 7613c922315e308a ("backlight: pwm_bl: Move the checks for initial
> power state to a separate function") not just moved some code, but made
> slight changes in semantics.
>
> If a gpiochip doesn't implement the optional .get_direction() callback,
> gpiod_get_direction always returns -EINVAL, which is never equal to
> GPIOF_DIR_IN, leading to the GPIO not being configured for output.
>
> To avoid this, invert the test and check for not GPIOF_DIR_OUT instead,
> like the original code did.
>
> This restores the display on r8a7740/armadillo.
>
> Fixes: 7613c922315e308a ("backlight: pwm_bl: Move the checks for initial power state to a separate function")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Daniel Thommpson <daniel.thompson@linaro.org>
> ---
> drivers/video/backlight/pwm_bl.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index d7efcb632f7d9dde..002f1ce22bd02032 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -297,14 +297,15 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> }
>
> /*
> - * If the GPIO is configured as input, change the direction to output
> - * and set the GPIO as active.
> + * If the GPIO is not known to be already configured as output, that
> + * is, if gpiod_get_direction returns either GPIOF_DIR_IN or -EINVAL,
> + * change the direction to output and set the GPIO as active.
> * Do not force the GPIO to active when it was already output as it
> * could cause backlight flickering or we would enable the backlight too
> * early. Leave the decision of the initial backlight state for later.
> */
> if (pb->enable_gpio &&
> - gpiod_get_direction(pb->enable_gpio) = GPIOF_DIR_IN)
> + gpiod_get_direction(pb->enable_gpio) != GPIOF_DIR_OUT)
> gpiod_direction_output(pb->enable_gpio, 1);
>
> pb->power_supply = devm_regulator_get(&pdev->dev, "power");
>
next prev parent reply other threads:[~2017-03-24 16:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 17:21 [PATCH] backlight: pwm_bl: Fix GPIO out for unimplemented .get_direction() Geert Uytterhoeven
2017-03-23 21:11 ` Peter Ujfalusi
2017-03-24 9:13 ` Philipp Zabel
2017-03-24 16:42 ` Daniel Thompson [this message]
2017-03-24 16:43 ` Daniel Thompson
2017-03-27 14:27 ` Lee Jones
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=c00f689f-dae6-14d6-55d3-b1b44db19dc1@linaro.org \
--to=daniel.thompson@linaro.org \
--cc=b.zolnierkie@samsung.com \
--cc=geert+renesas@glider.be \
--cc=jingoohan1@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=peter.ujfalusi@ti.com \
--cc=thierry.reding@gmail.com \
/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 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).