linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i8042 / PM: Allow PC keyboard to wake up from suspend-to-idle
@ 2015-03-09 15:19 Rafael J. Wysocki
  2015-03-09 18:00 ` Dmitry Torokhov
  0 siblings, 1 reply; 9+ messages in thread
From: Rafael J. Wysocki @ 2015-03-09 15:19 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Kristen Carlson Accardi, Linux PM list, Linux Kernel Mailing List,
	linux-input

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

If they keyboard interrupt is registered, mark the i8042 platform
device as wakeup-capable and check the user space wakeup setting in
i8042_pm_suspend() and i8042_pm_resume() to enable or disable,
respectively, the keyboard interrupt to wake up the system.

This makes it possible to use the PC keyboard to wake up the system
from suspend-to-idle after writing "enabled" to the i8042 device's
power/wakeup sysfs attribute.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/input/serio/i8042.c |    6 ++++++
 1 file changed, 6 insertions(+)

Index: linux-pm/drivers/input/serio/i8042.c
===================================================================
--- linux-pm.orig/drivers/input/serio/i8042.c
+++ linux-pm/drivers/input/serio/i8042.c
@@ -1163,12 +1163,17 @@ static int i8042_controller_resume(bool
 static int i8042_pm_suspend(struct device *dev)
 {
 	i8042_controller_reset(true);
+	if (device_may_wakeup(&i8042_platform_device->dev))
+		enable_irq_wake(I8042_KBD_IRQ);
 
 	return 0;
 }
 
 static int i8042_pm_resume(struct device *dev)
 {
+	if (device_may_wakeup(&i8042_platform_device->dev))
+		disable_irq_wake(I8042_KBD_IRQ);
+
 	/*
 	 * On resume from S2R we always try to reset the controller
 	 * to bring it in a sane state. (In case of S2D we expect
@@ -1406,6 +1411,7 @@ static int __init i8042_setup_kbd(void)
 	if (error)
 		goto err_free_irq;
 
+	device_set_wakeup_capable(&i8042_platform_device->dev, true);
 	i8042_kbd_irq_registered = true;
 	return 0;
 


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-03-17 14:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-09 15:19 [PATCH] i8042 / PM: Allow PC keyboard to wake up from suspend-to-idle Rafael J. Wysocki
2015-03-09 18:00 ` Dmitry Torokhov
2015-03-09 22:41   ` Rafael J. Wysocki
2015-03-09 23:08     ` Rafael J. Wysocki
2015-03-10  0:05       ` Dmitry Torokhov
2015-03-16 21:11       ` Pavel Machek
2015-03-16 23:20         ` Rafael J. Wysocki
2015-03-17  8:50           ` Pavel Machek
2015-03-17 14:39             ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).