lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150310000503.GC22993@dtor-ws>
Date:	Mon, 9 Mar 2015 17:05:03 -0700
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	"Rafael J. Wysocki" <rjw@...ysocki.net>
Cc:	Kristen Carlson Accardi <kristen@...ux.intel.com>,
	Linux PM list <linux-pm@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	linux-input@...r.kernel.org
Subject: Re: [PATCH] i8042 / PM: Allow PC keyboard to wake up from
 suspend-to-idle

On Tue, Mar 10, 2015 at 12:08:43AM +0100, Rafael J. Wysocki wrote:
> On Monday, March 09, 2015 11:41:12 PM Rafael J. Wysocki wrote:
> > 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@...el.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.
> 
> Yeah, that works too.  And you're right that there's no reason to do that for
> keyboard only.
> 
> Patch below.

Applied, thank you.

> 
> Rafael
> 
> 
> ---
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> Subject: i8042 / PM: Allow i8042 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@...el.com>
> ---
>  drivers/input/serio/i8042.c |   28 +++++++++++++++++++++++++---
>  1 file changed, 25 insertions(+), 3 deletions(-)
> 
> Index: linux-pm/drivers/input/serio/i8042.c
> ===================================================================
> --- linux-pm.orig/drivers/input/serio/i8042.c
> +++ linux-pm/drivers/input/serio/i8042.c
> @@ -1162,13 +1162,32 @@ static int i8042_controller_resume(bool
>  
>  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(
>  	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);
>  		}
>  	}
>  }
> 

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ