Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dexuan Cui and committed by
Dmitry Torokhov
62238f3a e179d5fa

+13
+13
drivers/input/serio/hyperv-keyboard.c
··· 170 170 serio_interrupt(kbd_dev->hv_serio, scan_code, 0); 171 171 } 172 172 spin_unlock_irqrestore(&kbd_dev->lock, flags); 173 + 174 + /* 175 + * Only trigger a wakeup on key down, otherwise 176 + * "echo freeze > /sys/power/state" can't really enter the 177 + * state because the Enter-UP can trigger a wakeup at once. 178 + */ 179 + if (!(info & IS_BREAK)) 180 + pm_wakeup_event(&hv_dev->device, 0); 181 + 173 182 break; 174 183 175 184 default: ··· 385 376 goto err_close_vmbus; 386 377 387 378 serio_register_port(kbd_dev->hv_serio); 379 + 380 + device_init_wakeup(&hv_dev->device, true); 381 + 388 382 return 0; 389 383 390 384 err_close_vmbus: ··· 402 390 { 403 391 struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev); 404 392 393 + device_init_wakeup(&hv_dev->device, false); 405 394 serio_unregister_port(kbd_dev->hv_serio); 406 395 vmbus_close(hv_dev->channel); 407 396 kfree(kbd_dev);