summaryrefslogtreecommitdiff
path: root/drivers/input/serio
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@rjwysocki.net>2015-03-10 03:03:07 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-03-10 03:05:31 +0300
commitf13b2065de8147a1652b830ea5db961cf80c09df (patch)
treeb54de849a839be23fee08b11515786a14f50ce42 /drivers/input/serio
parent91c68a7c1d92b48287f2f3111a9b09b26a263d3f (diff)
downloadlinux-f13b2065de8147a1652b830ea5db961cf80c09df.tar.xz
Input: i8042 - allow KBD and AUX ports to wake up from suspend-to-idle
While registering serio device for i8042, mark them as wakeup-capable and check their user space wakeup settings in i8042_pm_suspend() and i8042_pm_resume() to enable or disable, respectively, their interrupts to wake up the system. This makes it possible to use the PC keyboard to wake up the system from suspend-to-idle, among other things, after writing "enabled" to the keyboard serio device's power/wakeup sysfs attribute. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/serio')
-rw-r--r--drivers/input/serio/i8042.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 986a71c614b0..cb5ece77fd7d 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1162,13 +1162,32 @@ static int i8042_controller_resume(bool force_reset)
static int i8042_pm_suspend(struct device *dev)
{
+ int i;
+
i8042_controller_reset(true);
+ /* Set up serio interrupts for system wakeup. */
+ for (i = 0; i < I8042_NUM_PORTS; i++) {
+ struct serio *serio = i8042_ports[i].serio;
+
+ if (serio && device_may_wakeup(&serio->dev))
+ enable_irq_wake(i8042_ports[i].irq);
+ }
+
return 0;
}
static int i8042_pm_resume(struct device *dev)
{
+ int i;
+
+ for (i = 0; i < I8042_NUM_PORTS; i++) {
+ struct serio *serio = i8042_ports[i].serio;
+
+ if (serio && device_may_wakeup(&serio->dev))
+ disable_irq_wake(i8042_ports[i].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
@@ -1300,13 +1319,16 @@ static void __init i8042_register_ports(void)
int i;
for (i = 0; i < I8042_NUM_PORTS; i++) {
- if (i8042_ports[i].serio) {
+ struct serio *serio = i8042_ports[i].serio;
+
+ if (serio) {
printk(KERN_INFO "serio: %s at %#lx,%#lx irq %d\n",
- i8042_ports[i].serio->name,
+ serio->name,
(unsigned long) I8042_DATA_REG,
(unsigned long) I8042_COMMAND_REG,
i8042_ports[i].irq);
- serio_register_port(i8042_ports[i].serio);
+ serio_register_port(serio);
+ device_set_wakeup_capable(&serio->dev, true);
}
}
}