linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] GPIO button wth wakeup attribute is supposed to wake the system up
@ 2014-06-19  0:51 Li, Aubrey
  2014-06-19 10:40 ` One Thousand Gnomes
  2014-07-08 20:52 ` Rafael J. Wysocki
  0 siblings, 2 replies; 21+ messages in thread
From: Li, Aubrey @ 2014-06-19  0:51 UTC (permalink / raw)
  To: dmitry.torokhov, Rafael J. Wysocki, linux-input, LKML

When the wakeup attribute is set, the GPIO button is capable of
waking up the system from sleep states, including the "freeze"
sleep state.  For that to work, its driver needs to pass the
IRQF_NO_SUSPEND flag to devm_request_any_context_irq(), or the
interrupt will be disabled by suspend_device_irqs() and the
system won't be woken up by it from the "freeze" sleep state.

The suspend_device_irqs() routine is a workaround for drivers
that mishandle interrupts triggered when the devices handled
by them are suspended, so it is safe to use IRQF_NO_SUSPEND in
all drivers that don't have that problem.

The affected/tested machines include Dell Venue 11 Pro and Asus T100TA.

Signed-off-by: Aubrey Li <aubrey.li@linux.intel.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/input/keyboard/gpio_keys.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 8c98e97..b046dc6 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -527,6 +527,14 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 	if (!button->can_disable)
 		irqflags |= IRQF_SHARED;
 
+	/*
+	 * If platform has specified the wakeup attribute of the button,
+	 * we add IRQF_NO_SUSPEND to desc->action->flag. So the wake up
+	 * interrupt will not be disabled in suspend_device_irqs
+	 */
+	if (button->wakeup)
+		irqflags |= IRQF_NO_SUSPEND;
+
 	error = devm_request_any_context_irq(&pdev->dev, bdata->irq,
 					     isr, irqflags, desc, bdata);
 	if (error < 0) {
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2014-07-16  0:45 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-19  0:51 [PATCH] GPIO button wth wakeup attribute is supposed to wake the system up Li, Aubrey
2014-06-19 10:40 ` One Thousand Gnomes
2014-06-23 23:35   ` Li, Aubrey
2014-07-08 20:52 ` Rafael J. Wysocki
2014-07-08 20:45   ` Dmitry Torokhov
2014-07-08 21:06     ` Rafael J. Wysocki
2014-07-08 21:12       ` Dmitry Torokhov
2014-07-08 21:47         ` Rafael J. Wysocki
2014-07-08 22:11           ` Dmitry Torokhov
2014-07-08 23:06             ` Rafael J. Wysocki
2014-07-09  0:15               ` Dmitry Torokhov
2014-07-09  0:59                 ` Rafael J. Wysocki
2014-07-09  0:54                   ` Dmitry Torokhov
2014-07-09 12:45                     ` Rafael J. Wysocki
2014-07-10  2:27                       ` Li, Aubrey
2014-07-10 11:27                         ` Rafael J. Wysocki
2014-07-10 21:37                           ` [PATCH] PM / sleep / irq: Do not suspend wakeup interrupts Rafael J. Wysocki
2014-07-15 12:22                             ` Alexander Stein
2014-07-15 12:50                               ` Rafael J. Wysocki
2014-07-15 12:36                                 ` Alexander Stein
2014-07-16  0:45                                   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).