summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2014-12-11 13:14:22 -0200
committerRobin Gong <b38343@freescale.com>2014-12-17 18:07:07 +0800
commit5a7ab47e67d1045cb2f5d408c112617dff48dee2 (patch)
tree43f2491dd4b922e1eb9b7620bbd75ee033069e9c
parente5728046c62cc498db16b1527c0f519dd86a28e6 (diff)
MLK-9987: Input: imx_keypad: Fix suspend/resume while keypad is pressed
Since commit commit 560a64749d1dd0ff ("ENGR00318936-2 input: keyboard: imx: remove usless release interrupt enabled) the following problem happens: - Keep any keypad key pressed - Enter low power mode via "echo mem > /sys/power/state" - Then we are no longer able to wake-up the system via the keypad The reason for this behaviour is that the KRIE (Release Interrupt) is not enabled. In order to fix this problem, we should enable KRIE when a key is pressed (KPKD bit is set) or enable KDIE when no key is pressed (KPKR is set). This way we will always have a valid source of keypad interrupt no matter if the system entered low power mode while a keypad key was pressed or not. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
-rw-r--r--drivers/input/keyboard/imx_keypad.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c
index 12e49f17e740..519b48fa7a56 100644
--- a/drivers/input/keyboard/imx_keypad.c
+++ b/drivers/input/keyboard/imx_keypad.c
@@ -551,9 +551,10 @@ static int imx_kbd_suspend(struct device *dev)
mutex_unlock(&input_dev->mutex);
if (device_may_wakeup(&pdev->dev)) {
- /* make sure KDI interrupt enabled */
- reg_val |= KBD_STAT_KDIE;
- reg_val &= ~KBD_STAT_KRIE;
+ if (reg_val & KBD_STAT_KPKD)
+ reg_val |= KBD_STAT_KRIE;
+ if (reg_val & KBD_STAT_KPKR)
+ reg_val |= KBD_STAT_KDIE;
writew(reg_val, kbd->mmio_base + KPSR);
enable_irq_wake(kbd->irq);