This is a note to let you know that I've just added the patch titled Revert "Revert "gpio: omap: Fix lost edge wake-up interrupts"" to the 5.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-revert-gpio-omap-fix-lost-edge-wake-up-interr.patch and it can be found in the queue-5.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 4ca11632b1d9bf86aef63aa1bf72ec6529d907e5 Author: Tony Lindgren <tony@xxxxxxxxxxx> Date: Wed Oct 28 08:05:56 2020 +0200 Revert "Revert "gpio: omap: Fix lost edge wake-up interrupts"" [ Upstream commit 7ffa08169849be898eed6f3694aab8c425497749 ] This reverts commit 579ced8fdb00b8e94304a83e3cc419f6f8eab08e. Turns out I was overly optimistic about cpu_pm blocking idle being a solution for handling edge interrupts. While it helps in preventing entering idle states that potentially lose context, we can still get an edge interrupt triggering while entering idle. So we need to also add back the workaround for seeing if there are any pending edge interrupts when waking up. Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx> Cc: Aaro Koskinen <aaro.koskinen@xxxxxx> Cc: Grygorii Strashko <grygorii.strashko@xxxxxx> Cc: Keerthy <j-keerthy@xxxxxx> Cc: Ladislav Michl <ladis@xxxxxxxxxxxxxx> Cc: Peter Ujfalusi <peter.ujfalusi@xxxxxx> Cc: Russell King <rmk+kernel@xxxxxxxxxxxxxxx> Cc: Tero Kristo <t-kristo@xxxxxx> Link: https://lore.kernel.org/r/20201028060556.56038-1-tony@xxxxxxxxxxx Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 0ea640fb636cf..3b87989e27640 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1114,13 +1114,23 @@ static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context) { struct device *dev = bank->chip.parent; void __iomem *base = bank->base; - u32 nowake; + u32 mask, nowake; bank->saved_datain = readl_relaxed(base + bank->regs->datain); if (!bank->enabled_non_wakeup_gpios) goto update_gpio_context_count; + /* Check for pending EDGE_FALLING, ignore EDGE_BOTH */ + mask = bank->enabled_non_wakeup_gpios & bank->context.fallingdetect; + mask &= ~bank->context.risingdetect; + bank->saved_datain |= mask; + + /* Check for pending EDGE_RISING, ignore EDGE_BOTH */ + mask = bank->enabled_non_wakeup_gpios & bank->context.risingdetect; + mask &= ~bank->context.fallingdetect; + bank->saved_datain &= ~mask; + if (!may_lose_context) goto update_gpio_context_count;