l30013671 / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
f2c60e
From d561f0543506bc12e7b3355efddb0bfd7ca83c74 Mon Sep 17 00:00:00 2001
f2c60e
From: Hans de Goede <hdegoede@redhat.com>
f2c60e
Date: Sat, 22 Jul 2017 13:17:36 +0200
f2c60e
Subject: [PATCH 2/2] Input: soc_button_array - Suppress power button presses
f2c60e
 during suspend
f2c60e
f2c60e
If the power-button is pressed to wakeup the laptop/tablet from suspend
f2c60e
and we report a KEY_POWER event to userspace when woken up this will cause
f2c60e
userspace to immediately suspend the system again which is undesirable.
f2c60e
f2c60e
This commit sets the new no_wakeup_events flag in the gpio_keys_button
f2c60e
struct for the power-button suppressing the undesirable KEY_POWER input
f2c60e
events on wake-up.
f2c60e
f2c60e
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
f2c60e
---
f2c60e
Changes in v2:
f2c60e
-New patch in v2 of this patch-set
f2c60e
---
f2c60e
 drivers/input/misc/soc_button_array.c | 5 ++++-
f2c60e
 1 file changed, 4 insertions(+), 1 deletion(-)
f2c60e
f2c60e
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
f2c60e
index f600f3a7a3c6..27b99831cb97 100644
f2c60e
--- a/drivers/input/misc/soc_button_array.c
f2c60e
+++ b/drivers/input/misc/soc_button_array.c
f2c60e
@@ -27,6 +27,7 @@ struct soc_button_info {
f2c60e
 	unsigned int event_code;
f2c60e
 	bool autorepeat;
f2c60e
 	bool wakeup;
f2c60e
+	bool no_wakeup_events;
f2c60e
 };
f2c60e
 
f2c60e
 /*
f2c60e
@@ -100,6 +101,7 @@ soc_button_device_create(struct platform_device *pdev,
f2c60e
 		gpio_keys[n_buttons].active_low = 1;
f2c60e
 		gpio_keys[n_buttons].desc = info->name;
f2c60e
 		gpio_keys[n_buttons].wakeup = info->wakeup;
f2c60e
+		gpio_keys[n_buttons].no_wakeup_events = info->no_wakeup_events;
f2c60e
 		/* These devices often use cheap buttons, use 50 ms debounce */
f2c60e
 		gpio_keys[n_buttons].debounce_interval = 50;
f2c60e
 		n_buttons++;
f2c60e
@@ -185,6 +187,7 @@ static int soc_button_parse_btn_desc(struct device *dev,
f2c60e
 		info->name = "power";
f2c60e
 		info->event_code = KEY_POWER;
f2c60e
 		info->wakeup = true;
f2c60e
+		info->no_wakeup_events = true;
f2c60e
 	} else if (upage == 0x07 && usage == 0xe3) {
f2c60e
 		info->name = "home";
f2c60e
 		info->event_code = KEY_LEFTMETA;
f2c60e
@@ -369,7 +372,7 @@ static int soc_button_probe(struct platform_device *pdev)
f2c60e
  * Platforms"
f2c60e
  */
f2c60e
 static struct soc_button_info soc_button_PNP0C40[] = {
f2c60e
-	{ "power", 0, EV_KEY, KEY_POWER, false, true },
f2c60e
+	{ "power", 0, EV_KEY, KEY_POWER, false, true, true },
f2c60e
 	{ "home", 1, EV_KEY, KEY_LEFTMETA, false, true },
f2c60e
 	{ "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false },
f2c60e
 	{ "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false },
f2c60e
-- 
f2c60e
2.13.4
f2c60e