HID: i2c-hid: Use PM subsystem to manage wake irq
authorRaul E Rangel <rrangel@chromium.org>
Tue, 22 Nov 2022 21:39:06 +0000 (13:39 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 22 Nov 2022 21:58:44 +0000 (13:58 -0800)
commitd08999cc593ea18a3dc5993faea5e413ae29ff96
treed12ad96bd741d939d09a9e4a638d5d8b82973691
parentb76f64caa42e9bb78e177ae94e1062d876a401b1
HID: i2c-hid: Use PM subsystem to manage wake irq

The I2C hid driver is currently manually managing the wake
IRQ. This change removes the explicit enable_irq_wake/disable_irq_wake
and instead relies on the PM subsystem. This is done by calling
dev_pm_set_wake_irq.

i2c_device_probe already calls dev_pm_set_wake_irq when using device
tree, and i2c_device_remove also already calls dev_pm_clear_wake_irq.
There could be some device tree systems that have incorrectly declared
`wake` capabilities, so this change will set the wake irq if one is
missing. This matches the previous behavior.

I tested this on an ACPI system that has a HID touchscreen and verified
the IRQ was armed for wake on suspend.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20220929093200.v6.1.Id4b4bdfe06e2caf2d5a3c9dd4a9b1080c38b539c@changeid
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/hid/i2c-hid/i2c-hid-core.c