summaryrefslogtreecommitdiff
path: root/drivers/input/serio/hyperv-keyboard.c
diff options
context:
space:
mode:
authorDexuan Cui <decui@microsoft.com>2014-08-06 13:33:54 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-08-06 14:10:06 -0700
commit62238f3aadc9bc56da70100e19ec61b9f8d72a5f (patch)
treebca445a27b9a4f75d53fbafc7f145278b3328e4c /drivers/input/serio/hyperv-keyboard.c
parente179d5fa8d6dd0df62bc7ba2a6ee777f7d1142b5 (diff)
Input: hyperv-keyboard - register as a wakeup source
With this patch, we can press a key to wake up the VM after the VM executes "echo freeze > /sys/power/state". Signed-off-by: Dexuan Cui <decui@microsoft.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/serio/hyperv-keyboard.c')
-rw-r--r--drivers/input/serio/hyperv-keyboard.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/input/serio/hyperv-keyboard.c b/drivers/input/serio/hyperv-keyboard.c
index 613261994621..e74e5d6e5f9f 100644
--- a/drivers/input/serio/hyperv-keyboard.c
+++ b/drivers/input/serio/hyperv-keyboard.c
@@ -170,6 +170,15 @@ static void hv_kbd_on_receive(struct hv_device *hv_dev,
serio_interrupt(kbd_dev->hv_serio, scan_code, 0);
}
spin_unlock_irqrestore(&kbd_dev->lock, flags);
+
+ /*
+ * Only trigger a wakeup on key down, otherwise
+ * "echo freeze > /sys/power/state" can't really enter the
+ * state because the Enter-UP can trigger a wakeup at once.
+ */
+ if (!(info & IS_BREAK))
+ pm_wakeup_event(&hv_dev->device, 0);
+
break;
default:
@@ -376,6 +385,9 @@ static int hv_kbd_probe(struct hv_device *hv_dev,
goto err_close_vmbus;
serio_register_port(kbd_dev->hv_serio);
+
+ device_init_wakeup(&hv_dev->device, true);
+
return 0;
err_close_vmbus:
@@ -390,6 +402,7 @@ static int hv_kbd_remove(struct hv_device *hv_dev)
{
struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev);
+ device_init_wakeup(&hv_dev->device, false);
serio_unregister_port(kbd_dev->hv_serio);
vmbus_close(hv_dev->channel);
kfree(kbd_dev);