Some platform like Android needs to get the power key event to
reume the other devcies such as FB, TS. System resume failed when
the gpio power key was pressed shortly sometime, but can resume the
by long press the power key.
The root cause of this issue is that the GPIO IRQ is registered as device
IRQ, but device IRQs will just be enabled after early resume finished,
so when the power key press shortly, the gpio-irq may still disabled in that
time, and the ISR will be ignored and could not detect the key down event.
To fix this bug, add the IRQF_EARLY_RESUME flag to the irq if platform
has specified that the button can wake up the system , in this way, this
irq will be enabled during syscore resume, so that the power key press
can be handled and reported as early as possible.
Signed-off-by: Lin Fuzhen <fuzhen.lin@freescale.com>
*/
if (!button->can_disable)
irqflags |= IRQF_SHARED;
+ /*
+ * If platform has specified that the button can wake up the system,
+ * for example, the power key which usually use to wake up the system
+ * from suspend, we add the IRQF_EARLY_RESUME flag to this irq, so
+ * that the power key press can be handled and reported as early as
+ * possible. Some platform like Android need to get the power key
+ * event early to reume some devcies like framebuffer and etc.
+ */
+ if (button->wakeup)
+ irqflags |= IRQF_EARLY_RESUME;
error = request_any_context_irq(irq, gpio_keys_isr, irqflags, desc, bdata);
if (error < 0) {