diff mbox series

[2/2] Staging: fbtft: Fix reset assertion when using gpio descriptor

Message ID 1562833913-10510-3-git-send-email-preid@electromag.com.au (mailing list archive)
State New, archived
Headers show
Series Staging: fbtft: Fix probing of gpio descriptor | expand

Commit Message

Phil Reid July 11, 2019, 8:31 a.m. UTC
Typically gpiod_set_value calls would assert the reset line and
then release it using the symantics of:
	gpiod_set_value(par->gpio.reset, 0);
	... delay
	gpiod_set_value(par->gpio.reset, 1);
And the gpio binding would specify the polarity.

Prior to conversion to gpiod calls the polarity in the DT
was ignored and assumed to be active low. Fix it so that
DT polarity is respected.

Signed-off-by: Phil Reid <preid@electromag.com.au>
---
 drivers/staging/fbtft/fbtft-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jan Sebastian Götte July 15, 2019, 2:40 p.m. UTC | #1
I have tested these changes on an ili9486-based display connected through SPI to a raspberry pi and can confirm they work in combination with another patch I'll send shortly. I only had to fix the reset pin polarity in the device tree overlay I used.

Regards, Jan

On July 11, 2019, 8:31 a.m., Phil Reid wrote:
> Typically gpiod_set_value calls would assert the reset line and
> then release it using the symantics of:
> 	gpiod_set_value(par->gpio.reset, 0);
> 	... delay
> 	gpiod_set_value(par->gpio.reset, 1);
> And the gpio binding would specify the polarity.
> 
> Prior to conversion to gpiod calls the polarity in the DT
> was ignored and assumed to be active low. Fix it so that
> DT polarity is respected.
> 
> Signed-off-by: Phil Reid <preid@electromag.com.au>
> ---
>  drivers/staging/fbtft/fbtft-core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Tested-by: Jan Sebastian Götte <linux@jaseg.net>
diff mbox series

Patch

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index 44b8074..bc75025 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -231,9 +231,9 @@  static void fbtft_reset(struct fbtft_par *par)
 	if (!par->gpio.reset)
 		return;
 	fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__);
-	gpiod_set_value_cansleep(par->gpio.reset, 0);
-	usleep_range(20, 40);
 	gpiod_set_value_cansleep(par->gpio.reset, 1);
+	usleep_range(20, 40);
+	gpiod_set_value_cansleep(par->gpio.reset, 0);
 	msleep(120);
 }