public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] gpio: pca953x: fix IRQ storm on system wake up
@ 2025-03-26 17:38 Francesco Dolcini
  2025-04-03 12:07 ` Bartosz Golaszewski
  0 siblings, 1 reply; 7+ messages in thread
From: Francesco Dolcini @ 2025-03-26 17:38 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: Emanuele Ghidoli, linux-gpio, linux-kernel, Marek Vasut, stable,
	Francesco Dolcini

From: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

If an input changes state during wake-up and is used as an interrupt
source, the IRQ handler reads the volatile input register to clear the
interrupt mask and deassert the IRQ line. However, the IRQ handler is
triggered before access to the register is granted, causing the read
operation to fail.

As a result, the IRQ handler enters a loop, repeatedly printing the
"failed reading register" message, until `pca953x_resume` is eventually
called, which restores the driver context and enables access to
registers.

Fix by using DEFINE_NOIRQ_DEV_PM_OPS which ensures that `pca953x_resume`
is called before the IRQ handler is called.

Fixes: b76574300504 ("gpio: pca953x: Restore registers after suspend/resume cycle")
Cc: stable@vger.kernel.org
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
---
 drivers/gpio/gpio-pca953x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index d63c1030e6ac..d39bdc125cfc 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -1252,7 +1252,7 @@ static int pca953x_resume(struct device *dev)
 	return ret;
 }
 
-static DEFINE_SIMPLE_DEV_PM_OPS(pca953x_pm_ops, pca953x_suspend, pca953x_resume);
+static DEFINE_NOIRQ_DEV_PM_OPS(pca953x_pm_ops, pca953x_suspend, pca953x_resume);
 
 /* convenience to stop overlong match-table lines */
 #define OF_653X(__nrgpio, __int) ((void *)(__nrgpio | PCAL653X_TYPE | __int))
-- 
2.39.5


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

end of thread, other threads:[~2025-04-13 13:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-26 17:38 [PATCH v1] gpio: pca953x: fix IRQ storm on system wake up Francesco Dolcini
2025-04-03 12:07 ` Bartosz Golaszewski
2025-04-03 13:54   ` Andy Shevchenko
2025-04-03 13:56     ` Bartosz Golaszewski
2025-04-07 15:11       ` Emanuele Ghidoli
2025-04-07 15:40         ` Andy Shevchenko
2025-04-13 13:33           ` Emanuele Ghidoli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox