Skip to content

Commit 203c38f

Browse files
khfengJiri Kosina
authored andcommitted
HID: i2c-hid: Enable wakeup capability from Suspend-to-Idle
Many laptops can be woken up from Suspend-to-Idle by touchpad. This is also the default behavior on other OSes. However, if touchpad and touchscreen contact to each other when lid is closed, wakeup events can be triggered inadventertly. So let's disable the wakeup by default, but enable the wakeup capability so users can enable it at their own discretion. Signed-off-by: Kai-Heng Feng <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent eafb220 commit 203c38f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/hid/i2c-hid/i2c-hid-core.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,14 @@ static void i2c_hid_acpi_fix_up_power(struct device *dev)
935935
acpi_device_fix_up_power(adev);
936936
}
937937

938+
static void i2c_hid_acpi_enable_wakeup(struct device *dev)
939+
{
940+
if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
941+
device_set_wakeup_capable(dev, true);
942+
device_set_wakeup_enable(dev, false);
943+
}
944+
}
945+
938946
static const struct acpi_device_id i2c_hid_acpi_match[] = {
939947
{"ACPI0C50", 0 },
940948
{"PNP0C50", 0 },
@@ -949,6 +957,8 @@ static inline int i2c_hid_acpi_pdata(struct i2c_client *client,
949957
}
950958

951959
static inline void i2c_hid_acpi_fix_up_power(struct device *dev) {}
960+
961+
static inline void i2c_hid_acpi_enable_wakeup(struct device *dev) {}
952962
#endif
953963

954964
#ifdef CONFIG_OF
@@ -1076,6 +1086,8 @@ static int i2c_hid_probe(struct i2c_client *client,
10761086

10771087
i2c_hid_acpi_fix_up_power(&client->dev);
10781088

1089+
i2c_hid_acpi_enable_wakeup(&client->dev);
1090+
10791091
device_enable_async_suspend(&client->dev);
10801092

10811093
/* Make sure there is something at this address */

0 commit comments

Comments
 (0)