diff options
author | Raul E Rangel <rrangel@chromium.org> | 2022-11-22 22:44:11 +0100 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2022-11-22 22:58:46 +0100 |
commit | a6d4439af581be9483e9b5b19b6c8f6dfcd47762 (patch) | |
tree | 85ffbd99b4064cb159376bb181c95c132832ddf9 /drivers/input/mouse | |
parent | HID: i2c-hid: Use PM subsystem to manage wake irq (diff) | |
download | linux-a6d4439af581be9483e9b5b19b6c8f6dfcd47762.tar.xz linux-a6d4439af581be9483e9b5b19b6c8f6dfcd47762.zip |
Input: elan_i2c - use PM subsystem to manage wake irq
The Elan I2C touchpad 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 where the touchpad doesn't have _PRW
defined. I verified I can still wake the system and that the wake source
was the touchpad IRQ GPIO.
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Link: https://lore.kernel.org/r/20220929093200.v6.2.Id022caf53d01112188308520915798f08a33cd3e@changeid
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r-- | drivers/input/mouse/elan_i2c_core.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index d4eb59b55bf1..793b3e451705 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -33,6 +33,7 @@ #include <linux/jiffies.h> #include <linux/completion.h> #include <linux/of.h> +#include <linux/pm_wakeirq.h> #include <linux/property.h> #include <linux/regulator/consumer.h> #include <asm/unaligned.h> @@ -86,8 +87,6 @@ struct elan_tp_data { u16 fw_page_size; u32 fw_signature_address; - bool irq_wake; - u8 min_baseline; u8 max_baseline; bool baseline_ready; @@ -1334,6 +1333,15 @@ static int elan_probe(struct i2c_client *client, if (!dev->of_node) device_init_wakeup(dev, true); + /* + * The wake IRQ should be declared via device tree instead of assuming + * the IRQ can wake the system. This is here for legacy reasons and + * will be removed once the i2c-core supports querying ACPI for wake + * capabilities. + */ + if (!dev->power.wakeirq) + dev_pm_set_wake_irq(dev, client->irq); + return 0; } @@ -1356,8 +1364,6 @@ static int __maybe_unused elan_suspend(struct device *dev) if (device_may_wakeup(dev)) { ret = elan_sleep(data); - /* Enable wake from IRQ */ - data->irq_wake = (enable_irq_wake(client->irq) == 0); } else { ret = elan_set_power(data, false); if (ret) @@ -1388,9 +1394,6 @@ static int __maybe_unused elan_resume(struct device *dev) dev_err(dev, "error %d enabling regulator\n", error); goto err; } - } else if (data->irq_wake) { - disable_irq_wake(client->irq); - data->irq_wake = false; } error = elan_set_power(data, true); |