All of lore.kernel.org
 help / color / mirror / Atom feed
From: haibo.chen@nxp.com
To: linus.walleij@linaro.org, brgl@bgdev.pl
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev, haibo.chen@nxp.com
Subject: [PATCH] gpio: vf610: always set GPIO to input mode when used as interrupt source
Date: Tue, 23 Apr 2024 10:28:14 +0800	[thread overview]
Message-ID: <20240423022814.3951048-1-haibo.chen@nxp.com> (raw)

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


             reply	other threads:[~2024-04-23  2:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23  2:28 haibo.chen [this message]
2024-04-23 10:56 ` [PATCH] gpio: vf610: always set GPIO to input mode when used as interrupt source 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

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=20240423022814.3951048-1-haibo.chen@nxp.com \
    --to=haibo.chen@nxp.com \
    --cc=brgl@bgdev.pl \
    --cc=imx@lists.linux.dev \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@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.