]> www.infradead.org Git - users/jedix/linux-maple.git/commit
gpio: pca953x: fix IRQ storm on system wake up
authorEmanuele Ghidoli <emanuele.ghidoli@toradex.com>
Mon, 12 May 2025 09:54:41 +0000 (11:54 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 13 May 2025 10:53:00 +0000 (12:53 +0200)
commit3e38f946062b4845961ab86b726651b4457b2af8
treed0edf0cb2968ee0543975de003a9c1c97cab6c78
parent579cb52ecd46ce0351fc3d40882ebdb60332a0bc
gpio: pca953x: fix IRQ storm on system wake up

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 disabling the IRQ line before entering suspend mode, and
re-enabling it after the driver context is restored in `pca953x_resume()`.

An IRQ can be disabled with disable_irq() and still wake the system as
long as the IRQ has wake enabled, so the wake-up functionality is
preserved.

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>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20250512095441.31645-1-francesco@dolcini.it
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-pca953x.c