diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-07-11 10:27:15 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2024-08-04 18:10:40 -0700 |
commit | d086d6d8036a9551781bf3a3002cfad87a8fda40 (patch) | |
tree | c6fa077990491781ae5f203d95ad2589c2c2750d /drivers/input | |
parent | f56b591880ff88f2107d5fe05fa6e1b9c804fb26 (diff) | |
download | linux-stable-d086d6d8036a9551781bf3a3002cfad87a8fda40.tar.gz linux-stable-d086d6d8036a9551781bf3a3002cfad87a8fda40.tar.bz2 linux-stable-d086d6d8036a9551781bf3a3002cfad87a8fda40.zip |
Input: tsc2004/5 - do not use irq_set_irq_wake() directly
Instead of setting irq_set_irq_wake() directly in probe(), mark the device
as wakeup-capable, and use enable_irq_wake() and disable_irq_wake() in
suspend/resume path.
This also allows changing the wakeup setting dynamically at runtime using
/sys/devices/.../tsc2005/power/wakeup.
Reviewed-By: Sebastian Reichel <sre@kernel.org>
Link: https://lore.kernel.org/r/20240711172719.1248373-4-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/tsc200x-core.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c index 87e6839c60fa..cd60bba11c56 100644 --- a/drivers/input/touchscreen/tsc200x-core.c +++ b/drivers/input/touchscreen/tsc200x-core.c @@ -106,7 +106,9 @@ struct tsc200x { struct gpio_desc *reset_gpio; int (*tsc200x_cmd)(struct device *dev, u8 cmd); + int irq; + bool wake_irq_enabled; }; static void tsc200x_update_pen_state(struct tsc200x *ts, @@ -560,7 +562,8 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, return error; } - irq_set_irq_wake(irq, 1); + device_init_wakeup(dev, true); + return 0; } EXPORT_SYMBOL_GPL(tsc200x_probe); @@ -576,6 +579,9 @@ static int tsc200x_suspend(struct device *dev) ts->suspended = true; + if (device_may_wakeup(dev)) + ts->wake_irq_enabled = enable_irq_wake(ts->irq) == 0; + mutex_unlock(&ts->mutex); return 0; @@ -587,6 +593,11 @@ static int tsc200x_resume(struct device *dev) mutex_lock(&ts->mutex); + if (ts->wake_irq_enabled) { + disable_irq_wake(ts->irq); + ts->wake_irq_enabled = false; + } + if (ts->suspended && ts->opened) __tsc200x_enable(ts); |