Thread (4 messages) 4 messages, 2 authors, 2012-07-30

Re: [PATCH] Input: gpio_keys - Report wakeup events if device may wakeup

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2012-07-30 05:50:17
Also in: lkml

Hi Benson,

On Wed, Jul 25, 2012 at 11:11:53PM -0700, Benson Leung wrote:
If a button is configured to wake the system, report a pm wakeup event.
Thank you for your patch, however I applied more complete patch sent by
NeilBrown.
quoted hunk ↗ jump to hunk
Signed-off-by: Benson Leung <bleung@chromium.org>
---
 drivers/input/keyboard/gpio_keys.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index cbb1add..15a80e2 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -328,9 +328,13 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
 {
 	const struct gpio_keys_button *button = bdata->button;
 	struct input_dev *input = bdata->input;
+	struct device *dev = input->dev.parent;
 	unsigned int type = button->type ?: EV_KEY;
 	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;
 
+	if (button->wakeup && device_may_wakeup(dev))
+		pm_wakeup_event(dev, 0);
+
 	if (type == EV_ABS) {
 		if (state)
 			input_event(input, type, button->code, button->value);
-- 
1.7.7.3
-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help