Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+12 -1
+12 -1
drivers/input/touchscreen/tsc200x-core.c
··· 106 106 107 107 struct gpio_desc *reset_gpio; 108 108 int (*tsc200x_cmd)(struct device *dev, u8 cmd); 109 + 109 110 int irq; 111 + bool wake_irq_enabled; 110 112 }; 111 113 112 114 static void tsc200x_update_pen_state(struct tsc200x *ts, ··· 562 560 return error; 563 561 } 564 562 565 - irq_set_irq_wake(irq, 1); 563 + device_init_wakeup(dev, true); 564 + 566 565 return 0; 567 566 } 568 567 EXPORT_SYMBOL_GPL(tsc200x_probe); ··· 579 576 580 577 ts->suspended = true; 581 578 579 + if (device_may_wakeup(dev)) 580 + ts->wake_irq_enabled = enable_irq_wake(ts->irq) == 0; 581 + 582 582 mutex_unlock(&ts->mutex); 583 583 584 584 return 0; ··· 592 586 struct tsc200x *ts = dev_get_drvdata(dev); 593 587 594 588 mutex_lock(&ts->mutex); 589 + 590 + if (ts->wake_irq_enabled) { 591 + disable_irq_wake(ts->irq); 592 + ts->wake_irq_enabled = false; 593 + } 595 594 596 595 if (ts->suspended && ts->opened) 597 596 __tsc200x_enable(ts);