All of lore.kernel.org
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] pinctrl: ingenic: Properly detect GPIO direction when" failed to apply to 5.4-stable tree
@ 2020-08-19 11:48 gregkh
  2020-08-19 13:49 ` [BACKPORT v5.4 PATCH] pinctrl: ingenic: Properly detect GPIO direction when configured for IRQ Paul Cercueil
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2020-08-19 11:48 UTC (permalink / raw)
  To: paul, johnnyonflame, linus.walleij; +Cc: stable


The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 84e7a946da71f678affacea301f6d5cb4d9784e8 Mon Sep 17 00:00:00 2001
From: Paul Cercueil <paul@crapouillou.net>
Date: Mon, 22 Jun 2020 23:45:48 +0200
Subject: [PATCH] pinctrl: ingenic: Properly detect GPIO direction when
 configured for IRQ
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The PAT1 register contains information about the IRQ type (edge/level)
for input GPIOs with IRQ enabled, and the direction for non-IRQ GPIOs.
So it makes sense to read it only if the GPIO has no interrupt
configured, otherwise input GPIOs configured for level IRQs are
misdetected as output GPIOs.

Fixes: ebd6651418b6 ("pinctrl: ingenic: Implement .get_direction for GPIO chips")
Reported-by: João Henrique <johnnyonflame@hotmail.com>
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200622214548.265417-2-paul@crapouillou.net
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index 241e563d5814..a8d1b53ec4c1 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -1958,7 +1958,8 @@ static int ingenic_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
 	unsigned int pin = gc->base + offset;
 
 	if (jzpc->info->version >= ID_JZ4760) {
-		if (ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PAT1))
+		if (ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_INT) ||
+		    ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PAT1))
 			return GPIO_LINE_DIRECTION_IN;
 		return GPIO_LINE_DIRECTION_OUT;
 	}


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

* [BACKPORT v5.4 PATCH] pinctrl: ingenic: Properly detect GPIO direction when configured for IRQ
  2020-08-19 11:48 FAILED: patch "[PATCH] pinctrl: ingenic: Properly detect GPIO direction when" failed to apply to 5.4-stable tree gregkh
@ 2020-08-19 13:49 ` Paul Cercueil
  2020-08-19 14:02   ` gregkh
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Cercueil @ 2020-08-19 13:49 UTC (permalink / raw)
  To: gregkh; +Cc: Paul Cercueil, João Henrique, stable, Linus Walleij

The PAT1 register contains information about the IRQ type (edge/level)
for input GPIOs with IRQ enabled, and the direction for non-IRQ GPIOs.
So it makes sense to read it only if the GPIO has no interrupt
configured, otherwise input GPIOs configured for level IRQs are
misdetected as output GPIOs.

Fixes: ebd6651418b6 ("pinctrl: ingenic: Implement .get_direction for GPIO chips")
Reported-by: João Henrique <johnnyonflame@hotmail.com>
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200622214548.265417-2-paul@crapouillou.net
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---

Notes:
    Original git commit ID: 84e7a946da71f678affacea301f6d5cb4d9784e8

 drivers/pinctrl/pinctrl-ingenic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-ingenic.c b/drivers/pinctrl/pinctrl-ingenic.c
index 6e2683016c1f..bfa0c5b7ad04 100644
--- a/drivers/pinctrl/pinctrl-ingenic.c
+++ b/drivers/pinctrl/pinctrl-ingenic.c
@@ -1644,7 +1644,8 @@ static int ingenic_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
 	unsigned int pin = gc->base + offset;
 
 	if (jzpc->version >= ID_JZ4760)
-		return ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PAT1);
+		return ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_INT) ||
+			ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PAT1);
 
 	if (ingenic_get_pin_config(jzpc, pin, JZ4740_GPIO_SELECT))
 		return true;
-- 
2.28.0


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

* Re: [BACKPORT v5.4 PATCH] pinctrl: ingenic: Properly detect GPIO direction when configured for IRQ
  2020-08-19 13:49 ` [BACKPORT v5.4 PATCH] pinctrl: ingenic: Properly detect GPIO direction when configured for IRQ Paul Cercueil
@ 2020-08-19 14:02   ` gregkh
  0 siblings, 0 replies; 3+ messages in thread
From: gregkh @ 2020-08-19 14:02 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: João Henrique, stable, Linus Walleij

On Wed, Aug 19, 2020 at 03:49:53PM +0200, Paul Cercueil wrote:
> The PAT1 register contains information about the IRQ type (edge/level)
> for input GPIOs with IRQ enabled, and the direction for non-IRQ GPIOs.
> So it makes sense to read it only if the GPIO has no interrupt
> configured, otherwise input GPIOs configured for level IRQs are
> misdetected as output GPIOs.
> 
> Fixes: ebd6651418b6 ("pinctrl: ingenic: Implement .get_direction for GPIO chips")
> Reported-by: João Henrique <johnnyonflame@hotmail.com>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> Cc: stable@vger.kernel.org
> Link: https://lore.kernel.org/r/20200622214548.265417-2-paul@crapouillou.net
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> 
> Notes:
>     Original git commit ID: 84e7a946da71f678affacea301f6d5cb4d9784e8

Now queued up, thanks!

greg k-h

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

end of thread, other threads:[~2020-08-19 14:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 11:48 FAILED: patch "[PATCH] pinctrl: ingenic: Properly detect GPIO direction when" failed to apply to 5.4-stable tree gregkh
2020-08-19 13:49 ` [BACKPORT v5.4 PATCH] pinctrl: ingenic: Properly detect GPIO direction when configured for IRQ Paul Cercueil
2020-08-19 14:02   ` gregkh

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.