linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: vf610: always set GPIO to input mode when used as interrupt source
@ 2024-04-23  2:28 haibo.chen
  2024-04-23 10:56 ` Bartosz Golaszewski
  2024-04-23 11:40 ` Linus Walleij
  0 siblings, 2 replies; 11+ messages in thread
From: haibo.chen @ 2024-04-23  2:28 UTC (permalink / raw)
  To: linus.walleij, brgl; +Cc: linux-gpio, linux-kernel, imx, haibo.chen

From: Haibo Chen <haibo.chen@nxp.com>

Though the default pin configuration is INPUT, but if the prior stage does
configure the pins as OUTPUT, then Linux will not reconfigure the pin as
INPUT.

e.g. When use one pin as interrupt source, and set as low level trigger,
if prior stage already set this pin as OUTPUT low, then will meet interrupt
storm.

So always set GPIO to input mode when used as interrupt source to fix above
case.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/gpio/gpio-vf610.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index 07e5e6323e86..305b0bcdee6f 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -214,7 +214,7 @@ static int vf610_gpio_irq_set_type(struct irq_data *d, u32 type)
 	else
 		irq_set_handler_locked(d, handle_edge_irq);
 
-	return 0;
+	return port->gc.direction_input(&port->gc, d->hwirq);
 }
 
 static void vf610_gpio_irq_mask(struct irq_data *d)
-- 
2.34.1


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

end of thread, other threads:[~2024-07-19  3:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-23  2:28 [PATCH] gpio: vf610: always set GPIO to input mode when used as interrupt source haibo.chen
2024-04-23 10:56 ` Bartosz Golaszewski
2024-04-23 11:40 ` Linus Walleij
2024-04-23 12:20   ` Bough Chen
2024-04-24 11:01     ` Bough Chen
2024-04-25  8:49       ` Bough Chen
2024-04-25 13:06       ` Bartosz Golaszewski
2024-04-28  2:31         ` Bough Chen
2024-07-18 17:08   ` Stefan Wahren
2024-07-19  1:46     ` Bough Chen
2024-07-19  3:53       ` Stefan Wahren

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