Commit 203c38fb authored by Kai-Heng Feng's avatar Kai-Heng Feng Committed by Jiri Kosina

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: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent eafb2203
...@@ -935,6 +935,14 @@ static void i2c_hid_acpi_fix_up_power(struct device *dev) ...@@ -935,6 +935,14 @@ static void i2c_hid_acpi_fix_up_power(struct device *dev)
acpi_device_fix_up_power(adev); 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_set_wakeup_capable(dev, true);
device_set_wakeup_enable(dev, false);
}
}
static const struct acpi_device_id i2c_hid_acpi_match[] = { static const struct acpi_device_id i2c_hid_acpi_match[] = {
{"ACPI0C50", 0 }, {"ACPI0C50", 0 },
{"PNP0C50", 0 }, {"PNP0C50", 0 },
...@@ -949,6 +957,8 @@ static inline int i2c_hid_acpi_pdata(struct i2c_client *client, ...@@ -949,6 +957,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_fix_up_power(struct device *dev) {}
static inline void i2c_hid_acpi_enable_wakeup(struct device *dev) {}
#endif #endif
#ifdef CONFIG_OF #ifdef CONFIG_OF
...@@ -1076,6 +1086,8 @@ static int i2c_hid_probe(struct i2c_client *client, ...@@ -1076,6 +1086,8 @@ static int i2c_hid_probe(struct i2c_client *client,
i2c_hid_acpi_fix_up_power(&client->dev); i2c_hid_acpi_fix_up_power(&client->dev);
i2c_hid_acpi_enable_wakeup(&client->dev);
device_enable_async_suspend(&client->dev); device_enable_async_suspend(&client->dev);
/* Make sure there is something at this address */ /* Make sure there is something at this address */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment