[PATCH 32/133] [Jaunty SRU] ARM.imx51 Freescale:ENGR00111294 Not enter suspend state when the keypad is pressed

Brad Figg brad.figg at canonical.com
Thu Jul 9 16:48:22 UTC 2009


From: Lily Zhang <r58066 at freescale.com>

In the function mxc_kpp_suspend, the poll_timer is deleted and the
keypad registers are not cleaned up well. So when the keypad is pressed
and the system enters the suspend state, the keypad driver can not work
well after resume. One simplest solution is to check poll_timer. If it's
still pending, don't allow the system to enter suspend.

Signed-off-by: Lily Zhang <r58066 at freescale.com>
Signed-off-by: Brad Figg <brad.figg at canonical.com>
---
 drivers/input/keyboard/mxc_keyb.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/input/keyboard/mxc_keyb.c b/drivers/input/keyboard/mxc_keyb.c
index 799ab23..248b8e5 100644
--- a/drivers/input/keyboard/mxc_keyb.c
+++ b/drivers/input/keyboard/mxc_keyb.c
@@ -669,11 +669,13 @@ static void mxc_kpp_close(struct input_dev *dev)
  *                to suspend
  * @param   state the power state the device is entering
  *
- * @return  The function always returns 0.
+ * @return  return -1 when the keypad is pressed. Otherwise, return 0
  */
 static int mxc_kpp_suspend(struct platform_device *pdev, pm_message_t state)
 {
-	del_timer(&kpp_dev.poll_timer);
+	/* When the keypad is still pressed, clean up registers and timers */
+	if (timer_pending(&kpp_dev.poll_timer))
+		return -1;
 
 	if (device_may_wakeup(&pdev->dev)) {
 		enable_irq_wake(keypad->irq);
@@ -708,8 +710,6 @@ static int mxc_kpp_resume(struct platform_device *pdev)
 		enable_irq(keypad->irq);
 	}
 
-	init_timer(&kpp_dev.poll_timer);
-
 	return 0;
 }
 
-- 
1.6.0.4





More information about the kernel-team mailing list