[PATCH 2/2][SRU][OEM-5.6] HID: i2c-hid: Enable wakeup capability from Suspend-to-Idle

Koba Ko koba.ko at canonical.com
Tue Jul 21 08:34:57 UTC 2020


Lose the line of cherry picked for the patches and will correct it in the v2.
On Tue, Jul 21, 2020 at 12:05 PM Koba Ko <koba.ko at canonical.com> wrote:
>
> From: Kai-Heng Feng <kai.heng.feng at canonical.com>
>
> BugLink: https://bugs.launchpad.net/bugs/1888331
>
> 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 <kai.heng.feng at canonical.com>
> Reviewed-by: Hans de Goede <hdegoede at redhat.com>
> Signed-off-by: Jiri Kosina <jkosina at suse.cz>
> Signed-off-by: Koba Ko <koba.ko at canonical.com>
> ---
>  drivers/hid/i2c-hid/i2c-hid-core.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
> index 294c84e136d7..c18ca6a6cb3d 100644
> --- a/drivers/hid/i2c-hid/i2c-hid-core.c
> +++ b/drivers/hid/i2c-hid/i2c-hid-core.c
> @@ -931,6 +931,14 @@ 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_set_wakeup_capable(dev, true);
> +               device_set_wakeup_enable(dev, false);
> +       }
> +}
> +
>  static const struct acpi_device_id i2c_hid_acpi_match[] = {
>         {"ACPI0C50", 0 },
>         {"PNP0C50", 0 },
> @@ -945,6 +953,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 +1082,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.25.1
>



More information about the kernel-team mailing list