[PATCH] HID: i2c-hid: Enable touchpad wakeup from Suspend-to-Idle

From: Kai-Heng Feng
Date: Mon May 18 2020 - 05:35:31 EST


Many laptops have the ability to 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 use
Suspend-to-Idle.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@xxxxxxxxxxxxx>
---
drivers/hid/i2c-hid/i2c-hid-core.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index 294c84e136d7..cac82971a668 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -1072,6 +1072,11 @@ static int i2c_hid_probe(struct i2c_client *client,

i2c_hid_acpi_fix_up_power(&client->dev);

+ if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
+ device_set_wakeup_capable(&client->dev, true);
+ device_wakeup_enable(&client->dev);
+ }
+
device_enable_async_suspend(&client->dev);

/* Make sure there is something at this address */
--
2.17.1