linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: hyperv-keyboard: register as a wakeup source
@ 2014-08-01 14:28 Dexuan Cui
  2014-08-01 17:29 ` KY Srinivasan
  2014-08-06 20:33 ` Dmitry Torokhov
  0 siblings, 2 replies; 6+ messages in thread
From: Dexuan Cui @ 2014-08-01 14:28 UTC (permalink / raw)
  To: gregkh, dmitry.torokhov, linux-input, linux-kernel,
	driverdev-devel, olaf, apw, jasowang
  Cc: haiyangz

With this patch, we can press a key to wake up the VM after the VM executes
"echo freeze > /sys/power/state".

This addresses part of https://bugzilla.redhat.com/show_bug.cgi?id=1086100

Cc: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
 drivers/input/serio/hyperv-keyboard.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/input/serio/hyperv-keyboard.c b/drivers/input/serio/hyperv-keyboard.c
index 6132619..e74e5d6 100644
--- a/drivers/input/serio/hyperv-keyboard.c
+++ b/drivers/input/serio/hyperv-keyboard.c
@@ -170,6 +170,15 @@ static void hv_kbd_on_receive(struct hv_device *hv_dev,
 			serio_interrupt(kbd_dev->hv_serio, scan_code, 0);
 		}
 		spin_unlock_irqrestore(&kbd_dev->lock, flags);
+
+		/*
+		 * Only trigger a wakeup on key down, otherwise
+		 * "echo freeze > /sys/power/state" can't really enter the
+		 * state because the Enter-UP can trigger a wakeup at once.
+		 */
+		if (!(info & IS_BREAK))
+			pm_wakeup_event(&hv_dev->device, 0);
+
 		break;
 
 	default:
@@ -376,6 +385,9 @@ static int hv_kbd_probe(struct hv_device *hv_dev,
 		goto err_close_vmbus;
 
 	serio_register_port(kbd_dev->hv_serio);
+
+	device_init_wakeup(&hv_dev->device, true);
+
 	return 0;
 
 err_close_vmbus:
@@ -390,6 +402,7 @@ static int hv_kbd_remove(struct hv_device *hv_dev)
 {
 	struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev);
 
+	device_init_wakeup(&hv_dev->device, false);
 	serio_unregister_port(kbd_dev->hv_serio);
 	vmbus_close(hv_dev->channel);
 	kfree(kbd_dev);
-- 
1.9.1

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

* RE: [PATCH] Input: hyperv-keyboard: register as a wakeup source
  2014-08-01 14:28 [PATCH] Input: hyperv-keyboard: register as a wakeup source Dexuan Cui
@ 2014-08-01 17:29 ` KY Srinivasan
  2014-08-06 20:33 ` Dmitry Torokhov
  1 sibling, 0 replies; 6+ messages in thread
From: KY Srinivasan @ 2014-08-01 17:29 UTC (permalink / raw)
  To: Dexuan Cui, gregkh@linuxfoundation.org, dmitry.torokhov@gmail.com,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	driverdev-devel@linuxdriverproject.org, olaf@aepfle.de,
	apw@canonical.com, jasowang@redhat.com
  Cc: Haiyang Zhang



> -----Original Message-----
> From: Dexuan Cui [mailto:decui@microsoft.com]
> Sent: Friday, August 1, 2014 7:28 AM
> To: gregkh@linuxfoundation.org; dmitry.torokhov@gmail.com; linux-
> input@vger.kernel.org; linux-kernel@vger.kernel.org; driverdev-
> devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com;
> jasowang@redhat.com
> Cc: KY Srinivasan; Haiyang Zhang
> Subject: [PATCH] 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".
> 
> This addresses part of https://bugzilla.redhat.com/show_bug.cgi?id=1086100
> 
> Cc: K. Y. Srinivasan <kys@microsoft.com>
Thanks Dexuan.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>

> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> ---
>  drivers/input/serio/hyperv-keyboard.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/input/serio/hyperv-keyboard.c
> b/drivers/input/serio/hyperv-keyboard.c
> index 6132619..e74e5d6 100644
> --- a/drivers/input/serio/hyperv-keyboard.c
> +++ b/drivers/input/serio/hyperv-keyboard.c
> @@ -170,6 +170,15 @@ static void hv_kbd_on_receive(struct hv_device
> *hv_dev,
>  			serio_interrupt(kbd_dev->hv_serio, scan_code, 0);
>  		}
>  		spin_unlock_irqrestore(&kbd_dev->lock, flags);
> +
> +		/*
> +		 * Only trigger a wakeup on key down, otherwise
> +		 * "echo freeze > /sys/power/state" can't really enter the
> +		 * state because the Enter-UP can trigger a wakeup at once.
> +		 */
> +		if (!(info & IS_BREAK))
> +			pm_wakeup_event(&hv_dev->device, 0);
> +
>  		break;
> 
>  	default:
> @@ -376,6 +385,9 @@ static int hv_kbd_probe(struct hv_device *hv_dev,
>  		goto err_close_vmbus;
> 
>  	serio_register_port(kbd_dev->hv_serio);
> +
> +	device_init_wakeup(&hv_dev->device, true);
> +
>  	return 0;
> 
>  err_close_vmbus:
> @@ -390,6 +402,7 @@ static int hv_kbd_remove(struct hv_device *hv_dev)
> {
>  	struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev);
> 
> +	device_init_wakeup(&hv_dev->device, false);
>  	serio_unregister_port(kbd_dev->hv_serio);
>  	vmbus_close(hv_dev->channel);
>  	kfree(kbd_dev);
> --
> 1.9.1


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

* Re: [PATCH] Input: hyperv-keyboard: register as a wakeup source
  2014-08-01 14:28 [PATCH] Input: hyperv-keyboard: register as a wakeup source Dexuan Cui
  2014-08-01 17:29 ` KY Srinivasan
@ 2014-08-06 20:33 ` Dmitry Torokhov
  2014-08-07  0:19   ` Dexuan Cui
  1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2014-08-06 20:33 UTC (permalink / raw)
  To: Dexuan Cui
  Cc: gregkh, linux-input, linux-kernel, driverdev-devel, olaf, apw,
	jasowang, kys, haiyangz

On Fri, Aug 01, 2014 at 07:28:24AM -0700, Dexuan Cui wrote:
> With this patch, we can press a key to wake up the VM after the VM executes
> "echo freeze > /sys/power/state".
> 
> This addresses part of https://bugzilla.redhat.com/show_bug.cgi?id=1086100

I am sorry but this bug is not open to the public. Please avoid
mentioning such bugs in changelogs. Otherwise I'll apply it.

> 
> Cc: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> ---
>  drivers/input/serio/hyperv-keyboard.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/input/serio/hyperv-keyboard.c b/drivers/input/serio/hyperv-keyboard.c
> index 6132619..e74e5d6 100644
> --- a/drivers/input/serio/hyperv-keyboard.c
> +++ b/drivers/input/serio/hyperv-keyboard.c
> @@ -170,6 +170,15 @@ static void hv_kbd_on_receive(struct hv_device *hv_dev,
>  			serio_interrupt(kbd_dev->hv_serio, scan_code, 0);
>  		}
>  		spin_unlock_irqrestore(&kbd_dev->lock, flags);
> +
> +		/*
> +		 * Only trigger a wakeup on key down, otherwise
> +		 * "echo freeze > /sys/power/state" can't really enter the
> +		 * state because the Enter-UP can trigger a wakeup at once.
> +		 */
> +		if (!(info & IS_BREAK))
> +			pm_wakeup_event(&hv_dev->device, 0);
> +
>  		break;
>  
>  	default:
> @@ -376,6 +385,9 @@ static int hv_kbd_probe(struct hv_device *hv_dev,
>  		goto err_close_vmbus;
>  
>  	serio_register_port(kbd_dev->hv_serio);
> +
> +	device_init_wakeup(&hv_dev->device, true);
> +
>  	return 0;
>  
>  err_close_vmbus:
> @@ -390,6 +402,7 @@ static int hv_kbd_remove(struct hv_device *hv_dev)
>  {
>  	struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev);
>  
> +	device_init_wakeup(&hv_dev->device, false);
>  	serio_unregister_port(kbd_dev->hv_serio);
>  	vmbus_close(hv_dev->channel);
>  	kfree(kbd_dev);
> -- 
> 1.9.1
> 

-- 
Dmitry

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

* RE: [PATCH] Input: hyperv-keyboard: register as a wakeup source
  2014-08-06 20:33 ` Dmitry Torokhov
@ 2014-08-07  0:19   ` Dexuan Cui
  2014-08-07  0:23     ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Dexuan Cui @ 2014-08-07  0:19 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: gregkh@linuxfoundation.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	driverdev-devel@linuxdriverproject.org, olaf@aepfle.de,
	apw@canonical.com, jasowang@redhat.com, KY Srinivasan,
	Haiyang Zhang

> -----Original Message-----
> From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
> Sent: Thursday, August 7, 2014 4:34 AM
> To: Dexuan Cui
> On Fri, Aug 01, 2014 at 07:28:24AM -0700, Dexuan Cui wrote:
> > With this patch, we can press a key to wake up the VM after the VM
> executes
> > "echo freeze > /sys/power/state".
> >
> > This addresses part of
> https://bugzilla.redhat.com/show_bug.cgi?id=1086100
> 
> I am sorry but this bug is not open to the public. Please avoid
> mentioning such bugs in changelogs. Otherwise I'll apply it.
Hi Dmitry,
Sorry, I didn't realize it's not public... :-)

I'll remove the line and re-send the patch.

Thanks,
-- Dexuan

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

* Re: [PATCH] Input: hyperv-keyboard: register as a wakeup source
  2014-08-07  0:19   ` Dexuan Cui
@ 2014-08-07  0:23     ` Dmitry Torokhov
  2014-08-07  0:32       ` Dexuan Cui
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2014-08-07  0:23 UTC (permalink / raw)
  To: Dexuan Cui
  Cc: olaf@aepfle.de, gregkh@linuxfoundation.org, jasowang@redhat.com,
	driverdev-devel@linuxdriverproject.org,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	apw@canonical.com, Haiyang Zhang

On Wed, Aug 6, 2014 at 5:19 PM, Dexuan Cui <decui@microsoft.com> wrote:
>
> > -----Original Message-----
> > From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
> > Sent: Thursday, August 7, 2014 4:34 AM
> > To: Dexuan Cui
> > On Fri, Aug 01, 2014 at 07:28:24AM -0700, Dexuan Cui wrote:
> > > With this patch, we can press a key to wake up the VM after the VM
> > executes
> > > "echo freeze > /sys/power/state".
> > >
> > > This addresses part of
> > https://bugzilla.redhat.com/show_bug.cgi?id=1086100
> >
> > I am sorry but this bug is not open to the public. Please avoid
> > mentioning such bugs in changelogs. Otherwise I'll apply it.
> Hi Dmitry,
> Sorry, I didn't realize it's not public... :-)
>
> I'll remove the line and re-send the patch.
>

No need to resend, I already applied it.

Thanks.

-- 
Dmitry

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

* RE: [PATCH] Input: hyperv-keyboard: register as a wakeup source
  2014-08-07  0:23     ` Dmitry Torokhov
@ 2014-08-07  0:32       ` Dexuan Cui
  0 siblings, 0 replies; 6+ messages in thread
From: Dexuan Cui @ 2014-08-07  0:32 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: olaf@aepfle.de, gregkh@linuxfoundation.org, jasowang@redhat.com,
	driverdev-devel@linuxdriverproject.org,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	apw@canonical.com, Haiyang Zhang

> -----Original Message-----
> From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel-
> owner@vger.kernel.org] On Behalf Of Dmitry Torokhov
> > Hi Dmitry,
> > Sorry, I didn't realize it's not public... :-)
> >
> > I'll remove the line and re-send the patch.
> >
> 
> No need to resend, I already applied it.
> 
Dmitry,
That's great!  :-)

Thanks a lot!

-- Dexuan

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

end of thread, other threads:[~2014-08-07  0:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-01 14:28 [PATCH] Input: hyperv-keyboard: register as a wakeup source Dexuan Cui
2014-08-01 17:29 ` KY Srinivasan
2014-08-06 20:33 ` Dmitry Torokhov
2014-08-07  0:19   ` Dexuan Cui
2014-08-07  0:23     ` Dmitry Torokhov
2014-08-07  0:32       ` Dexuan Cui

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).