mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] serial: 8250: Add missing wakeup event reporting
@ 2023-04-13 21:39 Florian Fainelli
  2023-04-14  7:19 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2023-04-13 21:39 UTC (permalink / raw)
  To: linux-kernel
  Cc: opendmb, bcm-kernel-feedback-list, Florian Fainelli,
	Greg Kroah-Hartman, Jiri Slaby, Ilpo Järvinen,
	Andy Shevchenko, Uwe Kleine-König, Maciej W. Rozycki,
	Eric Tremblay, Wander Lairson Costa, open list:SERIAL DRIVERS

An 8250 UART configured as a wake-up source would not have reported
itself through sysfs as being the source of wake-up, correct that.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/tty/serial/8250/8250_port.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index dfbc501cf9d1..fe8d79c4ae95 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -15,6 +15,7 @@
 #include <linux/moduleparam.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
+#include <linux/irq.h>
 #include <linux/console.h>
 #include <linux/gpio/consumer.h>
 #include <linux/sysrq.h>
@@ -1932,6 +1933,7 @@ static bool handle_rx_dma(struct uart_8250_port *up, unsigned int iir)
 int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
 {
 	struct uart_8250_port *up = up_to_u8250p(port);
+	struct tty_port *tport = &port->state->port;
 	bool skip_rx = false;
 	unsigned long flags;
 	u16 status;
@@ -1957,6 +1959,8 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
 		skip_rx = true;
 
 	if (status & (UART_LSR_DR | UART_LSR_BI) && !skip_rx) {
+		if (irqd_is_wakeup_set(irq_get_irq_data(port->irq)))
+			pm_wakeup_event(tport->tty->dev, 0);
 		if (!up->dma || handle_rx_dma(up, iir))
 			status = serial8250_rx_chars(up, status);
 	}
-- 
2.34.1


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

* Re: [PATCH] serial: 8250: Add missing wakeup event reporting
  2023-04-13 21:39 [PATCH] serial: 8250: Add missing wakeup event reporting Florian Fainelli
@ 2023-04-14  7:19 ` Greg Kroah-Hartman
  2023-04-14 12:54   ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2023-04-14  7:19 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-kernel, opendmb, bcm-kernel-feedback-list, Jiri Slaby,
	Ilpo Järvinen, Andy Shevchenko, Uwe Kleine-König,
	Maciej W. Rozycki, Eric Tremblay, Wander Lairson Costa,
	open list:SERIAL DRIVERS

On Thu, Apr 13, 2023 at 02:39:54PM -0700, Florian Fainelli wrote:
> An 8250 UART configured as a wake-up source would not have reported
> itself through sysfs as being the source of wake-up, correct that.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  drivers/tty/serial/8250/8250_port.c | 4 ++++
>  1 file changed, 4 insertions(+)

What commit does this fix?  Is it needed to go to stable kernel(s)?

thanks,

gre gk-h

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

* Re: [PATCH] serial: 8250: Add missing wakeup event reporting
  2023-04-14  7:19 ` Greg Kroah-Hartman
@ 2023-04-14 12:54   ` Florian Fainelli
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2023-04-14 12:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Florian Fainelli, Guennadi Liakhovetski
  Cc: linux-kernel, opendmb, bcm-kernel-feedback-list, Jiri Slaby,
	Ilpo Järvinen, Andy Shevchenko, Uwe Kleine-König,
	Maciej W. Rozycki, Eric Tremblay, Wander Lairson Costa,
	open list:SERIAL DRIVERS



On 4/14/2023 12:19 AM, Greg Kroah-Hartman wrote:
> On Thu, Apr 13, 2023 at 02:39:54PM -0700, Florian Fainelli wrote:
>> An 8250 UART configured as a wake-up source would not have reported
>> itself through sysfs as being the source of wake-up, correct that.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>>   drivers/tty/serial/8250/8250_port.c | 4 ++++
>>   1 file changed, 4 insertions(+)
> 
> What commit does this fix?  Is it needed to go to stable kernel(s)?

That would be b3b708fa2780cd2b5d8266a8f0c3a1cab364d4d2 ("wake up from a 
serial port").

I do not know of standard Linux distribution user-space relying on the 
wake-up counts from sysfs, though I certainly do care.

The patch I submitted should backport fine all the way down to 4.14 
where irqd_is_wakeup_set is available. Do you want me to submit a v2 
with that Fixes tag?
-- 
Florian

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

end of thread, other threads:[~2023-04-14 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-13 21:39 [PATCH] serial: 8250: Add missing wakeup event reporting Florian Fainelli
2023-04-14  7:19 ` Greg Kroah-Hartman
2023-04-14 12:54   ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®