linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] intel-vbtn: match power button on press rather than release
@ 2017-08-04 17:00 Mario Limonciello
  2017-08-04 17:29 ` Darren Hart
  2017-09-16 13:45 ` Pali Rohár
  0 siblings, 2 replies; 10+ messages in thread
From: Mario Limonciello @ 2017-08-04 17:00 UTC (permalink / raw)
  To: AceLan Kao, dvhart, linux-pm, Rafael J . Wysocki
  Cc: LKML, platform-driver-x86, Len Brown, Srinivas Pandruvada,
	Mario Limonciello

This fixes a problem where the system gets stuck in a loop
unable to wakeup via power button in s2idle.

The problem happens because:
 - press power button:
   - system emits 0xc0 (power press), event ignored
   - system emits 0xc1 (power release), event processed,
     emited as KEY_POWER
   - set wakeup_mode to true
   - system goes to s2idle
 - press power button
   - system emits 0xc0 (power press), wakeup_mode is true,
     system wakes
   - system emits 0xc1 (power release), event processed,
     emited as KEY_POWER
   - system goes to s2idle again

To avoid this situation, process the presses (which matches what
intel-hid does too).

Verified on an Dell XPS 9365

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
---
 drivers/platform/x86/intel-vbtn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c
index 61f1063..4809267 100644
--- a/drivers/platform/x86/intel-vbtn.c
+++ b/drivers/platform/x86/intel-vbtn.c
@@ -36,8 +36,8 @@ static const struct acpi_device_id intel_vbtn_ids[] = {
 
 /* In theory, these are HID usages. */
 static const struct key_entry intel_vbtn_keymap[] = {
-	{ KE_IGNORE, 0xC0, { KEY_POWER } },	/* power key press */
-	{ KE_KEY, 0xC1, { KEY_POWER } },	/* power key release */
+	{ KE_KEY, 0xC0, { KEY_POWER } },	/* power key press */
+	{ KE_IGNORE, 0xC1, { KEY_POWER } },	/* power key release */
 	{ KE_KEY, 0xC4, { KEY_VOLUMEUP } },		/* volume-up key press */
 	{ KE_IGNORE, 0xC5, { KEY_VOLUMEUP } },		/* volume-up key release */
 	{ KE_KEY, 0xC6, { KEY_VOLUMEDOWN } },		/* volume-down key press */
-- 
2.7.4

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

end of thread, other threads:[~2017-09-16 13:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-04 17:00 [PATCH] intel-vbtn: match power button on press rather than release Mario Limonciello
2017-08-04 17:29 ` Darren Hart
2017-08-04 23:30   ` Rafael J. Wysocki
2017-08-05 20:57     ` Darren Hart
2017-08-05 22:20       ` Rafael J. Wysocki
2017-08-06 23:24         ` Darren Hart
2017-08-07  0:38           ` Rafael J. Wysocki
2017-08-07  0:59             ` AceLan Kao
2017-08-07  3:54               ` Darren Hart
2017-09-16 13:45 ` Pali Rohár

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