Skip to contentSkip to conversation

Input: hyperv-keyboard: register as a wakeup source

PATCH In review Dexuan Cui 3 participants 6 messages Aug 1, 2014 – Aug 7, 2014

Subsystems (3)
lore
Share & tools
lore

Dexuan Cui

author maintainer
#0 lore raw

PATCH 1/1 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 <[email protected]>
---
 drivers/input/serio/hyperv-keyboard.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/input/serio/hyperv-keyboard.c +13 -0
index 6132619..e74e5d6 100644
@@ -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);
Signature · 1 line
1.9.1
#1 lore raw
Quoted 12 lines

-----Original Message-----
From: Dexuan Cui [mailto:[email protected]]
Sent: Friday, August 1, 2014 7:28 AM
To: [email protected]; [email protected]; linux- [email protected]; [email protected]; driverdev- [email protected]; [email protected]; [email protected]; [email protected]
Cc: KY Srinivasan; Haiyang Zhang
Subject: [PATCH] Input: hyperv-keyboard: register as a wakeup source

Quoted 6 lines

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 <[email protected]>

Thanks Dexuan.

Quoted 47 lines
---
 drivers/input/serio/hyperv-keyboard.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/input/serio/hyperv-keyboard.c +9 -0
index 6132619..e74e5d6 100644
@@ -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;
 
drivers/input/serio/hyperv-keyboard.c +4 -1
 	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

maintainer
#2 lore raw
In reply to Dexuan Cui
Quoted 4 lines · Dexuan Cui

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.

Quoted 48 lines
Cc K. Y. Srinivasan <[email protected]>
---
 drivers/input/serio/hyperv-keyboard.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/input/serio/hyperv-keyboard.c +13 -0
index 6132619..e74e5d6 100644
@@ -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);
Signature · 1 line
1.9.1
Signature · 1 line
Dmitry
author maintainer
#3 lore raw
Quoted 6 lines

-----Original Message-----
From: Dmitry Torokhov [mailto:[email protected]]
Sent: Thursday, August 7, 2014 4:34 AM
To: Dexuan Cui

Quoted 1 line · Dexuan Cui

With this patch, we can press a key to wake up the VM after the VM

Quoted 8 lines

executes

Quoted 3 lines

"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

maintainer
#4 lore raw
Quoted 11 lines · Dexuan Cui
Quoted 11 lines

-----Original Message-----
From: Dmitry Torokhov [mailto:[email protected]]
Sent: Thursday, August 7, 2014 4:34 AM
To: Dexuan Cui

Quoted 1 line · Dexuan Cui

With this patch, we can press a key to wake up the VM after the VM

executes

Quoted 3 lines

"echo freeze > /sys/power/state".

This addresses part of

Quoted 9 lines
Quoted 4 lines

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.

Signature · 1 line
Dmitry
author maintainer
#5 lore raw
Quoted 11 lines

-----Original Message-----
From: [email protected] [mailto:linux-kernel- [email protected]] On Behalf Of Dmitry Torokhov

Quoted 5 lines

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