ENGR00318936-1 input: keyboard: imx: add pm_stay_awake and pm_relax
authorRobin Gong <b38343@freescale.com>
Tue, 10 Jun 2014 03:56:49 +0000 (11:56 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:57:59 +0000 (14:57 -0500)
There is a small window after system suspend but timer scan function
didn't finish timely, in this case,  system enter suspend without kpp
interrupt enabled and failed to resume back if key depressed.We add
pm_stay_awake and pm_relax to make sure system suspend flow abort in
this case.

Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit 3868f06af8f39673f270643ada63dd88e2f5699e)
(cherry picked from commit 529dee44f7da0ad6d57a3e8ccd942af944f6723b)

drivers/input/keyboard/imx_keypad.c

index 2165f3d..6ed0801 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Driver for the IMX keypad port.
  * Copyright (C) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
+ * Copyright (C) 2014 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -267,6 +268,7 @@ static void imx_keypad_check_for_events(unsigned long data)
                reg_val |= KBD_STAT_KDIE;
                reg_val &= ~KBD_STAT_KRIE;
                writew(reg_val, keypad->mmio_base + KPSR);
+               pm_relax(keypad->input_dev->dev.parent);
        } else {
                /*
                 * Some keys are still pressed. Schedule a rescan in
@@ -302,6 +304,7 @@ static irqreturn_t imx_keypad_irq_handler(int irq, void *dev_id)
        writew(reg_val, keypad->mmio_base + KPSR);
 
        if (keypad->enabled) {
+               pm_stay_awake(keypad->input_dev->dev.parent);
                /* The matrix is supposed to be changed */
                keypad->stable_count = 0;