Message ID | 2197217.yzvHkR7SyK@vostro.rjw.lan (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Rafael, On Mon, Mar 09, 2015 at 04:19:50PM +0100, Rafael J. Wysocki wrote: > 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. Why do we do that for KBD but not AUX port? Should we mark individual serio port be wakeup capable and not the whole i8042. Also, why exactly is this needed? My laptops seem to resume just fine from keyboard activity without this patch... Thanks. > > 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; > >
On Monday, March 09, 2015 11:00:04 AM Dmitry Torokhov wrote: > Hi Rafael, > > On Mon, Mar 09, 2015 at 04:19:50PM +0100, Rafael J. Wysocki wrote: > > 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. > > Why do we do that for KBD but not AUX port? Should we mark individual > serio port be wakeup capable and not the whole i8042. We can do that, but only after the port serio device has been registered. I guess I can add code for that to i8042_register_ports(). Let me try that. > Also, why exactly is this needed? My laptops seem to resume just fine > from keyboard activity without this patch... Mine don't. At least not from suspend-to-idle ("echo freeze > /sys/power/state"). Whether or not the PC keyboard wakes them up from suspend-to-RAM depends on the BIOS. That only works for one of my laptops, but this patch doesn't help here. Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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;