]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00175884 System resume failed when the power key was pressed shortly
authorLin Fuzhen <fuzhen.lin@freescale.com>
Thu, 1 Mar 2012 10:52:09 +0000 (18:52 +0800)
committerOliver Wendt <ow@karo-electronics.de>
Mon, 30 Sep 2013 12:11:15 +0000 (14:11 +0200)
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>
drivers/input/keyboard/gpio_keys.c

index 6e6145b9a4c10b2d84bfd3cce75b1ea12a100b43..711b67d70e0ec1ae9f91439f8d6b8a4be678765c 100644 (file)
@@ -414,6 +414,16 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
         */
        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) {