LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] i8042: Increment wakeup_count for the respective port.
@ 2018-06-01 18:00 Ravi Chandra Sadineni
  2018-06-02  1:07 ` [PATCH V2] " Ravi Chandra Sadineni
  0 siblings, 1 reply; 7+ messages in thread
From: Ravi Chandra Sadineni @ 2018-06-01 18:00 UTC (permalink / raw)
  To: dmitry.torokhov, chenhong3, ravisadineni, ravisadineni, dtor
  Cc: tbroch, linux-kernel, linux-input, rajatja, bleung

Call pm_wakeup_event on every irq. This should help us in identifying if
i8042 port was a potential wake reason for the last resume.

Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
---
 drivers/input/serio/i8042.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 824f4c1c1f310..96e27766d553d 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -573,6 +573,9 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
 	port = &i8042_ports[port_no];
 	serio = port->exists ? port->serio : NULL;
 
+	if (serio && device_may_wakeup(&serio->dev))
+		pm_wakeup_event(&serio->dev, 0);
+
 	filter_dbg(port->driver_bound, data, "<- i8042 (interrupt, %d, %d%s%s)\n",
 		   port_no, irq,
 		   dfl & SERIO_PARITY ? ", bad parity" : "",
-- 
2.17.0.921.gf22659ad46-goog

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

* [PATCH V2] i8042: Increment wakeup_count for the respective port.
  2018-06-01 18:00 [PATCH] i8042: Increment wakeup_count for the respective port Ravi Chandra Sadineni
@ 2018-06-02  1:07 ` Ravi Chandra Sadineni
  2018-06-04 21:53   ` Dmitry Torokhov
  0 siblings, 1 reply; 7+ messages in thread
From: Ravi Chandra Sadineni @ 2018-06-02  1:07 UTC (permalink / raw)
  To: dmitry.torokhov, chenhong3, ravisadineni, ravisadineni, dtor
  Cc: tbroch, linux-kernel, linux-input, rajatja, bleung

Call pm_wakeup_event on every irq. This should help us in identifying if
keyboard was a potential wake reason for the last resume.

Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
---
V2: Increment the wakeup count only when there is a irq and not when the
method is called internally.

drivers/input/serio/i8042.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 824f4c1c1f310..2bd6f2633e29a 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -573,6 +573,9 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
 	port = &i8042_ports[port_no];
 	serio = port->exists ? port->serio : NULL;
 
+	if (irq && serio && device_may_wakeup(&serio->dev))
+		pm_wakeup_event(&serio->dev, 0);
+
 	filter_dbg(port->driver_bound, data, "<- i8042 (interrupt, %d, %d%s%s)\n",
 		   port_no, irq,
 		   dfl & SERIO_PARITY ? ", bad parity" : "",
-- 
2.17.1.1185.g55be947832-goog

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

* Re: [PATCH V2] i8042: Increment wakeup_count for the respective port.
  2018-06-02  1:07 ` [PATCH V2] " Ravi Chandra Sadineni
@ 2018-06-04 21:53   ` Dmitry Torokhov
  2018-06-05  9:14     ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2018-06-04 21:53 UTC (permalink / raw)
  To: Ravi Chandra Sadineni, Rafael J. Wysocki
  Cc: chenhong3, ravisadineni, dtor, tbroch, linux-kernel, linux-input,
	rajatja, bleung

On Fri, Jun 01, 2018 at 06:07:08PM -0700, Ravi Chandra Sadineni wrote:
> Call pm_wakeup_event on every irq. This should help us in identifying if
> keyboard was a potential wake reason for the last resume.
> 
> Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
> ---
> V2: Increment the wakeup count only when there is a irq and not when the
> method is called internally.
> 
> drivers/input/serio/i8042.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
> index 824f4c1c1f310..2bd6f2633e29a 100644
> --- a/drivers/input/serio/i8042.c
> +++ b/drivers/input/serio/i8042.c
> @@ -573,6 +573,9 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
>  	port = &i8042_ports[port_no];
>  	serio = port->exists ? port->serio : NULL;
>  
> +	if (irq && serio && device_may_wakeup(&serio->dev))
> +		pm_wakeup_event(&serio->dev, 0);

The constant checks for device_may_wakeup() before calling
pm_wakeup_event()needed to avoid warnings in wakeup_source_activate()
(?) are annoying. Rafael, can we move the check into
pm_wakeup_dev_event()?

I am also confused when pm_wakeup_event() vs pm_wakeup_hard_event() vs
pm_wakeup_dev_event() should be used, if any. Is there any guidance?

> +
>  	filter_dbg(port->driver_bound, data, "<- i8042 (interrupt, %d, %d%s%s)\n",
>  		   port_no, irq,
>  		   dfl & SERIO_PARITY ? ", bad parity" : "",
> -- 
> 2.17.1.1185.g55be947832-goog
> 

Thanks.

-- 
Dmitry

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

* Re: [PATCH V2] i8042: Increment wakeup_count for the respective port.
  2018-06-04 21:53   ` Dmitry Torokhov
@ 2018-06-05  9:14     ` Rafael J. Wysocki
  2018-06-05 19:01       ` [PATCH V3] " Ravi Chandra Sadineni
  2018-06-05 19:06       ` [PATCH V2] " Ravi Chandra Sadineni
  0 siblings, 2 replies; 7+ messages in thread
From: Rafael J. Wysocki @ 2018-06-05  9:14 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Ravi Chandra Sadineni, Rafael J. Wysocki, chenhong3,
	Ravi Chandra Sadineni, Dmitry Torokhov, Todd Broch,
	Linux Kernel Mailing List, linux-input, Rajat Jain, Benson Leung

On Mon, Jun 4, 2018 at 11:53 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Fri, Jun 01, 2018 at 06:07:08PM -0700, Ravi Chandra Sadineni wrote:
>> Call pm_wakeup_event on every irq. This should help us in identifying if
>> keyboard was a potential wake reason for the last resume.
>>
>> Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
>> ---
>> V2: Increment the wakeup count only when there is a irq and not when the
>> method is called internally.
>>
>> drivers/input/serio/i8042.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
>> index 824f4c1c1f310..2bd6f2633e29a 100644
>> --- a/drivers/input/serio/i8042.c
>> +++ b/drivers/input/serio/i8042.c
>> @@ -573,6 +573,9 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
>>       port = &i8042_ports[port_no];
>>       serio = port->exists ? port->serio : NULL;
>>
>> +     if (irq && serio && device_may_wakeup(&serio->dev))
>> +             pm_wakeup_event(&serio->dev, 0);
>
> The constant checks for device_may_wakeup() before calling
> pm_wakeup_event()needed to avoid warnings in wakeup_source_activate()
> (?) are annoying.

I'm not following you here.

pm_wakeup_event() ->
    pm_wakeup_dev_event() ->
        pm_wakeup_ws_event(dev->power.wakeup, ...)
            Checks if the first arg is NULL and returns quietly if so.

I don't see why you need the device_may_wakeup() check.

> Rafael, can we move the check into pm_wakeup_dev_event()?

That would be redundant, wouldn't it?

> I am also confused when pm_wakeup_event() vs pm_wakeup_hard_event() vs
> pm_wakeup_dev_event() should be used, if any. Is there any guidance?

First off, the "hard" variant is for when you want to abort suspends
in progress or wake up from suspend to idle regardless of whether or
not wakeup source tracking is enabled.

Second, use pm_wakeup_dev_event() if the decision on "hard" vs "soft"
needs to be made at run time.

Thanks,
Rafael

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

* [PATCH V3] i8042: Increment wakeup_count for the respective port.
  2018-06-05  9:14     ` Rafael J. Wysocki
@ 2018-06-05 19:01       ` Ravi Chandra Sadineni
  2018-06-12 23:33         ` Dmitry Torokhov
  2018-06-05 19:06       ` [PATCH V2] " Ravi Chandra Sadineni
  1 sibling, 1 reply; 7+ messages in thread
From: Ravi Chandra Sadineni @ 2018-06-05 19:01 UTC (permalink / raw)
  To: dmitry.torokhov, rafael, chenhong3, ravisadineni
  Cc: linux-kernel, linux-input, rajatja, bleung, furquan,
	Ravi Chandra Sadineni

Call pm_wakeup_event on every irq. This should help us in identifying if
keyboard was a potential wake reason for the last resume.

Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
---
V3: Remove the unnecessary device_may_wakeup check.
V2: Increment the wakeup count only when there is a irq and not when the
method is called internally.

 drivers/input/serio/i8042.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 824f4c1c1f310..b8bc71569349d 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -573,6 +573,9 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
 	port = &i8042_ports[port_no];
 	serio = port->exists ? port->serio : NULL;
 
+	if (irq && serio)
+		pm_wakeup_event(&serio->dev, 0);
+
 	filter_dbg(port->driver_bound, data, "<- i8042 (interrupt, %d, %d%s%s)\n",
 		   port_no, irq,
 		   dfl & SERIO_PARITY ? ", bad parity" : "",
-- 
2.17.1.1185.g55be947832-goog

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

* Re: [PATCH V2] i8042: Increment wakeup_count for the respective port.
  2018-06-05  9:14     ` Rafael J. Wysocki
  2018-06-05 19:01       ` [PATCH V3] " Ravi Chandra Sadineni
@ 2018-06-05 19:06       ` Ravi Chandra Sadineni
  1 sibling, 0 replies; 7+ messages in thread
From: Ravi Chandra Sadineni @ 2018-06-05 19:06 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Dmitry Torokhov, Ravi Chandra Sadineni, chenhong3,
	Dmitry Torokhov, Todd Broch, Linux Kernel Mailing List,
	linux-input, Rajat Jain, Benson Leung

On Tue, Jun 5, 2018 at 2:14 AM, Rafael J. Wysocki <rafael@kernel.org> wrote:
> On Mon, Jun 4, 2018 at 11:53 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
>> On Fri, Jun 01, 2018 at 06:07:08PM -0700, Ravi Chandra Sadineni wrote:
>>> Call pm_wakeup_event on every irq. This should help us in identifying if
>>> keyboard was a potential wake reason for the last resume.
>>>
>>> Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>
>>> ---
>>> V2: Increment the wakeup count only when there is a irq and not when the
>>> method is called internally.
>>>
>>> drivers/input/serio/i8042.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
>>> index 824f4c1c1f310..2bd6f2633e29a 100644
>>> --- a/drivers/input/serio/i8042.c
>>> +++ b/drivers/input/serio/i8042.c
>>> @@ -573,6 +573,9 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
>>>       port = &i8042_ports[port_no];
>>>       serio = port->exists ? port->serio : NULL;
>>>
>>> +     if (irq && serio && device_may_wakeup(&serio->dev))
>>> +             pm_wakeup_event(&serio->dev, 0);
>>
>> The constant checks for device_may_wakeup() before calling
>> pm_wakeup_event()needed to avoid warnings in wakeup_source_activate()
>> (?) are annoying.
>
> I'm not following you here.
>
> pm_wakeup_event() ->
>     pm_wakeup_dev_event() ->
>         pm_wakeup_ws_event(dev->power.wakeup, ...)
>             Checks if the first arg is NULL and returns quietly if so.
>
> I don't see why you need the device_may_wakeup() check.
Just realized that device_may_wakeup check is not needed. Removed the
check in V3. Thanks.
>
>> Rafael, can we move the check into pm_wakeup_dev_event()?
>
> That would be redundant, wouldn't it?
>
>> I am also confused when pm_wakeup_event() vs pm_wakeup_hard_event() vs
>> pm_wakeup_dev_event() should be used, if any. Is there any guidance?
>
> First off, the "hard" variant is for when you want to abort suspends
> in progress or wake up from suspend to idle regardless of whether or
> not wakeup source tracking is enabled.
>
> Second, use pm_wakeup_dev_event() if the decision on "hard" vs "soft"
> needs to be made at run time.
>
> Thanks,
> Rafael

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

* Re: [PATCH V3] i8042: Increment wakeup_count for the respective port.
  2018-06-05 19:01       ` [PATCH V3] " Ravi Chandra Sadineni
@ 2018-06-12 23:33         ` Dmitry Torokhov
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2018-06-12 23:33 UTC (permalink / raw)
  To: Ravi Chandra Sadineni
  Cc: rafael, chenhong3, ravisadineni, linux-kernel, linux-input,
	rajatja, bleung, furquan

On Tue, Jun 05, 2018 at 12:01:24PM -0700, Ravi Chandra Sadineni wrote:
> Call pm_wakeup_event on every irq. This should help us in identifying if
> keyboard was a potential wake reason for the last resume.
> 
> Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org>

Applied, thank you.

> ---
> V3: Remove the unnecessary device_may_wakeup check.
> V2: Increment the wakeup count only when there is a irq and not when the
> method is called internally.
> 
>  drivers/input/serio/i8042.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
> index 824f4c1c1f310..b8bc71569349d 100644
> --- a/drivers/input/serio/i8042.c
> +++ b/drivers/input/serio/i8042.c
> @@ -573,6 +573,9 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id)
>  	port = &i8042_ports[port_no];
>  	serio = port->exists ? port->serio : NULL;
>  
> +	if (irq && serio)
> +		pm_wakeup_event(&serio->dev, 0);
> +
>  	filter_dbg(port->driver_bound, data, "<- i8042 (interrupt, %d, %d%s%s)\n",
>  		   port_no, irq,
>  		   dfl & SERIO_PARITY ? ", bad parity" : "",
> -- 
> 2.17.1.1185.g55be947832-goog
> 

-- 
Dmitry

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

end of thread, other threads:[~2018-06-12 23:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-01 18:00 [PATCH] i8042: Increment wakeup_count for the respective port Ravi Chandra Sadineni
2018-06-02  1:07 ` [PATCH V2] " Ravi Chandra Sadineni
2018-06-04 21:53   ` Dmitry Torokhov
2018-06-05  9:14     ` Rafael J. Wysocki
2018-06-05 19:01       ` [PATCH V3] " Ravi Chandra Sadineni
2018-06-12 23:33         ` Dmitry Torokhov
2018-06-05 19:06       ` [PATCH V2] " Ravi Chandra Sadineni

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