linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: gpio_keys - Report wakeup events if device may wakeup
@ 2012-07-26  6:11 Benson Leung
  2012-07-30  5:50 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Benson Leung @ 2012-07-26  6:11 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Benson Leung

If a button is configured to wake the system, report a pm wakeup event.

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

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

* Re: [PATCH] Input: gpio_keys - Report wakeup events if device may wakeup
  2012-07-26  6:11 [PATCH] Input: gpio_keys - Report wakeup events if device may wakeup Benson Leung
@ 2012-07-30  5:50 ` Dmitry Torokhov
  2012-07-30 19:28   ` Benson Leung
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2012-07-30  5:50 UTC (permalink / raw)
  To: Benson Leung; +Cc: linux-input, linux-kernel

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.

> 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

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

* Re: [PATCH] Input: gpio_keys - Report wakeup events if device may wakeup
  2012-07-30  5:50 ` Dmitry Torokhov
@ 2012-07-30 19:28   ` Benson Leung
  2012-07-30 19:50     ` Benson Leung
  0 siblings, 1 reply; 4+ messages in thread
From: Benson Leung @ 2012-07-30 19:28 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, neilb

Hi Dmitry,

Yes I see Neil's changes. Thank you for letting me know.

By the way, looking at Neil's changes, would it make sense to check
for device_may_wakeup(dev) like in my patch so that the wakeup
behavior can be turned off by setting power/wakeup to disabled?

Benson

On Sun, Jul 29, 2012 at 10:50 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> 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.
>
>> 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



-- 
Benson Leung
Software Engineer, Chrom* OS
bleung@chromium.org

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

* Re: [PATCH] Input: gpio_keys - Report wakeup events if device may wakeup
  2012-07-30 19:28   ` Benson Leung
@ 2012-07-30 19:50     ` Benson Leung
  0 siblings, 0 replies; 4+ messages in thread
From: Benson Leung @ 2012-07-30 19:50 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, neilb

Actually, I take it back. It doesn't look like it's necessary.

Benson

On Mon, Jul 30, 2012 at 12:28 PM, Benson Leung <bleung@chromium.org> wrote:
> Hi Dmitry,
>
> Yes I see Neil's changes. Thank you for letting me know.
>
> By the way, looking at Neil's changes, would it make sense to check
> for device_may_wakeup(dev) like in my patch so that the wakeup
> behavior can be turned off by setting power/wakeup to disabled?
>
> Benson
>
> On Sun, Jul 29, 2012 at 10:50 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
>> 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.
>>
>>> 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
>
>
>
> --
> Benson Leung
> Software Engineer, Chrom* OS
> bleung@chromium.org



-- 
Benson Leung
Software Engineer, Chrom* OS
bleung@chromium.org

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

end of thread, other threads:[~2012-07-30 19:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-26  6:11 [PATCH] Input: gpio_keys - Report wakeup events if device may wakeup Benson Leung
2012-07-30  5:50 ` Dmitry Torokhov
2012-07-30 19:28   ` Benson Leung
2012-07-30 19:50     ` Benson Leung

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).