[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250923031613.2448073-2-sherry.sun@nxp.com>
Date: Tue, 23 Sep 2025 11:16:12 +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 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source
Currently, imx uart defaults to enabling the wake related registers for
all uart devices. However, it is unnecessary for those devices not
configured as wakeup source, so add device_may_wakeup() check before
configuring the uart wake related registers.
Fixes: db1a9b55004c ("tty: serial: imx: Allow UART to be a source for wakeup")
Signed-off-by: Sherry Sun <sherry.sun@....com>
---
drivers/tty/serial/imx.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 500dfc009d03..4ddfc89816bf 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2697,7 +2697,22 @@ static void imx_uart_save_context(struct imx_port *sport)
/* called with irq off */
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;
+
+ tty = tty_port_tty_get(port);
+ if (tty) {
+ tty_dev = tty->dev;
+ may_wake = tty_dev && device_may_wakeup(tty_dev);
+ tty_kref_put(tty);
+ }
+
+ /* only configure the wake register when device set as wakeup source */
+ if (!may_wake)
+ return;
uart_port_lock_irq(&sport->port);
--
2.34.1
Powered by blists - more mailing lists