Input: spear_keyboard - fix clock handling during suspend/resume
authorShiraz Hashim <shiraz.hashim@st.com>
Fri, 13 Jul 2012 07:11:10 +0000 (00:11 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 13 Jul 2012 07:13:29 +0000 (00:13 -0700)
SPEAr keyboard should normally disable clock during suspend and enable it
during resume.

For cases where it is expected to act as a wakeup source the clock can
remain in the same state i.e. kept enabled if it is being used.

Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/keyboard/spear-keyboard.c

index c499387..617a33d 100644 (file)
@@ -320,11 +320,12 @@ static int spear_kbd_suspend(struct device *dev)
 
        mutex_lock(&input_dev->mutex);
 
-       if (input_dev->users)
-               clk_enable(kbd->clk);
-
-       if (device_may_wakeup(&pdev->dev))
+       if (device_may_wakeup(&pdev->dev)) {
                enable_irq_wake(kbd->irq);
+       } else {
+               if (input_dev->users)
+                       clk_disable(kbd->clk);
+       }
 
        mutex_unlock(&input_dev->mutex);
 
@@ -339,11 +340,12 @@ static int spear_kbd_resume(struct device *dev)
 
        mutex_lock(&input_dev->mutex);
 
-       if (device_may_wakeup(&pdev->dev))
+       if (device_may_wakeup(&pdev->dev)) {
                disable_irq_wake(kbd->irq);
-
-       if (input_dev->users)
-               clk_enable(kbd->clk);
+       } else {
+               if (input_dev->users)
+                       clk_enable(kbd->clk);
+       }
 
        mutex_unlock(&input_dev->mutex);