linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] HID: i2c-hid: Enable touchpad wakeup from Suspend-to-Idle
@ 2020-06-18 14:55 Kai-Heng Feng
  2020-06-18 15:28 ` Hans de Goede
  0 siblings, 1 reply; 7+ messages in thread
From: Kai-Heng Feng @ 2020-06-18 14:55 UTC (permalink / raw)
  To: jikos, benjamin.tissoires
  Cc: Kai-Heng Feng, Hans de Goede, You-Sheng Yang,
	Daniel Playfair Cal, HungNien Chen, Pavel Balan,
	open list:HID CORE LAYER, open list

Many laptops can be woken up from Suspend-to-Idle by touchpad. This is
also the default behavior on other OSes.

So let's enable the wakeup support if the system defaults to
Suspend-to-Idle.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
v3:
 - Use device_init_wakeup().
 - Wording change.

v2:
 - Fix compile error when ACPI is not enabled.
 drivers/hid/i2c-hid/i2c-hid-core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index 294c84e136d7..dae1d072daf6 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -931,6 +931,12 @@ static void i2c_hid_acpi_fix_up_power(struct device *dev)
 		acpi_device_fix_up_power(adev);
 }
 
+static void i2c_hid_acpi_enable_wakeup(struct device *dev)
+{
+	if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
+		device_init_wakeup(dev, true);
+}
+
 static const struct acpi_device_id i2c_hid_acpi_match[] = {
 	{"ACPI0C50", 0 },
 	{"PNP0C50", 0 },
@@ -945,6 +951,8 @@ static inline int i2c_hid_acpi_pdata(struct i2c_client *client,
 }
 
 static inline void i2c_hid_acpi_fix_up_power(struct device *dev) {}
+
+static inline void i2c_hid_acpi_enable_wakeup(struct device *dev) {}
 #endif
 
 #ifdef CONFIG_OF
@@ -1072,6 +1080,8 @@ static int i2c_hid_probe(struct i2c_client *client,
 
 	i2c_hid_acpi_fix_up_power(&client->dev);
 
+	i2c_hid_acpi_enable_wakeup(&client->dev);
+
 	device_enable_async_suspend(&client->dev);
 
 	/* Make sure there is something at this address */
-- 
2.17.1


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

end of thread, other threads:[~2020-07-09  5:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18 14:55 [PATCH v3] HID: i2c-hid: Enable touchpad wakeup from Suspend-to-Idle Kai-Heng Feng
2020-06-18 15:28 ` Hans de Goede
2020-06-19  4:16   ` Kai-Heng Feng
2020-06-19  9:56     ` Hans de Goede
2020-07-01  6:46       ` Kai-Heng Feng
2020-07-03 12:27         ` Hans de Goede
2020-07-09  5:45           ` Kai-Heng Feng

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