linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: i8042 - signal wakeup from atkbd/psmouse
@ 2019-03-27  0:28 Dmitry Torokhov
  2019-03-28 10:26 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Torokhov @ 2019-03-27  0:28 UTC (permalink / raw)
  To: linux-input
  Cc: Ravi Chandra Sadineni, Rafael J. Wysocki, Shaunak Saha, linux-kernel

Instead of signalling wakeup directly from i8042, let psmouse and atkbd
drivers execute basic protocol handling and only then signal wakeup
condition. This solves the issue where we increment wakeup counter
simply because we are getting responses from keyboard/mouse to the
commands we ourselves send to them as part of suspend transition.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/keyboard/atkbd.c     | 2 ++
 drivers/input/mouse/psmouse-base.c | 2 ++
 drivers/input/serio/i8042.c        | 3 ---
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 850bb259c20e..3ad93e3e2f4c 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -401,6 +401,8 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
 		if  (ps2_handle_response(&atkbd->ps2dev, data))
 			goto out;
 
+	pm_wakeup_event(&serio->dev, 0);
+
 	if (!atkbd->enabled)
 		goto out;
 
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index d3ff1fc09af7..94f7ca5ad077 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -373,6 +373,8 @@ static irqreturn_t psmouse_interrupt(struct serio *serio,
 		if  (ps2_handle_response(&psmouse->ps2dev, data))
 			goto out;
 
+	pm_wakeup_event(&serio->dev, 0);
+
 	if (psmouse->state <= PSMOUSE_RESYNCING)
 		goto out;
 
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 95a78ccbd847..6462f1798fbb 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -573,9 +573,6 @@ 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.21.0.392.gf8f6787159e-goog


-- 
Dmitry

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

* Re: [PATCH] Input: i8042 - signal wakeup from atkbd/psmouse
  2019-03-27  0:28 [PATCH] Input: i8042 - signal wakeup from atkbd/psmouse Dmitry Torokhov
@ 2019-03-28 10:26 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2019-03-28 10:26 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-input, Ravi Chandra Sadineni, Rafael J. Wysocki,
	Shaunak Saha, linux-kernel

On Wednesday, March 27, 2019 1:28:00 AM CET Dmitry Torokhov wrote:
> Instead of signalling wakeup directly from i8042, let psmouse and atkbd
> drivers execute basic protocol handling and only then signal wakeup
> condition. This solves the issue where we increment wakeup counter
> simply because we are getting responses from keyboard/mouse to the
> commands we ourselves send to them as part of suspend transition.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

LGTM:

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  drivers/input/keyboard/atkbd.c     | 2 ++
>  drivers/input/mouse/psmouse-base.c | 2 ++
>  drivers/input/serio/i8042.c        | 3 ---
>  3 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
> index 850bb259c20e..3ad93e3e2f4c 100644
> --- a/drivers/input/keyboard/atkbd.c
> +++ b/drivers/input/keyboard/atkbd.c
> @@ -401,6 +401,8 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data,
>  		if  (ps2_handle_response(&atkbd->ps2dev, data))
>  			goto out;
>  
> +	pm_wakeup_event(&serio->dev, 0);
> +
>  	if (!atkbd->enabled)
>  		goto out;
>  
> diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
> index d3ff1fc09af7..94f7ca5ad077 100644
> --- a/drivers/input/mouse/psmouse-base.c
> +++ b/drivers/input/mouse/psmouse-base.c
> @@ -373,6 +373,8 @@ static irqreturn_t psmouse_interrupt(struct serio *serio,
>  		if  (ps2_handle_response(&psmouse->ps2dev, data))
>  			goto out;
>  
> +	pm_wakeup_event(&serio->dev, 0);
> +
>  	if (psmouse->state <= PSMOUSE_RESYNCING)
>  		goto out;
>  
> diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
> index 95a78ccbd847..6462f1798fbb 100644
> --- a/drivers/input/serio/i8042.c
> +++ b/drivers/input/serio/i8042.c
> @@ -573,9 +573,6 @@ 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" : "",
> 



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

end of thread, other threads:[~2019-03-28 10:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27  0:28 [PATCH] Input: i8042 - signal wakeup from atkbd/psmouse Dmitry Torokhov
2019-03-28 10:26 ` 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).