Merge tag 'driver-core-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / gpio / gpio-omap.c
index 6d59e3a..f7ceb2b 100644 (file)
@@ -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;