[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250923031613.2448073-3-sherry.sun@nxp.com>
Date: Tue, 23 Sep 2025 11:16:13 +0800
From: Sherry Sun <sherry.sun@....com>
To: gregkh@...uxfoundation.org,
jirislaby@...nel.org,
shawnguo@...nel.org,
s.hauer@...gutronix.de,
kernel@...gutronix.de,
festevam@...il.com,
shenwei.wang@....com
Cc: linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org,
imx@...ts.linux.dev
Subject: [PATCH 2/2] tty: serial: imx: Add missing wakeup event reporting
Current imx uart wakeup event would not report itself through sysfs as
being the source of wakeup, add pm_wakeup_event() to support this.
Signed-off-by: Sherry Sun <sherry.sun@....com>
---
drivers/tty/serial/imx.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 4ddfc89816bf..647123da04f5 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2700,8 +2700,8 @@ static void imx_uart_enable_wakeup(struct imx_port *sport, bool on)
struct tty_port *port = &sport->port.state->port;
struct tty_struct *tty;
struct device *tty_dev;
- u32 ucr3;
- bool may_wake;
+ u32 ucr3, usr1;
+ bool may_wake, wake_active;
tty = tty_port_tty_get(port);
if (tty) {
@@ -2716,12 +2716,14 @@ static void imx_uart_enable_wakeup(struct imx_port *sport, bool on)
uart_port_lock_irq(&sport->port);
+ usr1 = imx_uart_readl(sport, USR1);
ucr3 = imx_uart_readl(sport, UCR3);
if (on) {
imx_uart_writel(sport, USR1_AWAKE, USR1);
ucr3 |= UCR3_AWAKEN;
} else {
ucr3 &= ~UCR3_AWAKEN;
+ wake_active = usr1 & USR1_AWAKE;
}
imx_uart_writel(sport, ucr3, UCR3);
@@ -2732,10 +2734,14 @@ static void imx_uart_enable_wakeup(struct imx_port *sport, bool on)
ucr1 |= UCR1_RTSDEN;
} else {
ucr1 &= ~UCR1_RTSDEN;
+ wake_active |= usr1 & USR1_RTSD;
}
imx_uart_writel(sport, ucr1, UCR1);
}
+ if (wake_active && irqd_is_wakeup_set(irq_get_irq_data(sport->port.irq)))
+ pm_wakeup_event(tty_port_tty_get(port)->dev, 0);
+
uart_port_unlock_irq(&sport->port);
}
--
2.34.1
Powered by blists - more mailing lists