OMAP4_GPIO_IRQWAKEN0);
                        }
                } else {
-                       if (trigger != 0)
+                       /*
+                        * GPIO wakeup request can only be generated on edge
+                        * transitions
+                        */
+                       if (trigger & IRQ_TYPE_EDGE_BOTH)
                                __raw_writel(1 << gpio, bank->base
                                        + OMAP24XX_GPIO_SETWKUENA);
                        else
        }
        /* This part needs to be executed always for OMAP34xx */
        if (cpu_is_omap34xx() || (bank->non_wakeup_gpios & gpio_bit)) {
-               if (trigger != 0)
+               /*
+                * Log the edge gpio and manually trigger the IRQ
+                * after resume if the input level changes
+                * to avoid irq lost during PER RET/OFF mode
+                * Applies for omap2 non-wakeup gpio and all omap3 gpios
+                */
+               if (trigger & IRQ_TYPE_EDGE_BOTH)
                        bank->enabled_non_wakeup_gpios |= gpio_bit;
                else
                        bank->enabled_non_wakeup_gpios &= ~gpio_bit;