From: Frank Li <Frank.li@nxp.com>
To: Sherry Sun <sherry.sun@nxp.com>
Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org,
shawnguo@kernel.org, s.hauer@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com, shenwei.wang@nxp.com,
peng.fan@nxp.com, linux-serial@vger.kernel.org,
linux-kernel@vger.kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH V2 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source
Date: Wed, 24 Sep 2025 10:50:04 -0400 [thread overview]
Message-ID: <aNQFHJlnmn9V2Eyy@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250924031550.2516704-2-sherry.sun@nxp.com>
On Wed, Sep 24, 2025 at 11:15:49AM +0800, Sherry Sun wrote:
> Currently, the i.MX UART driver enables wake-related registers for all
> UART devices by default. However, this is unnecessary for devices that
> are not configured as wakeup sources. To address this, add a
> 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@nxp.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.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..87d841c0b22f 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -2697,8 +2697,23 @@ 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;
> + bool may_wake = false;
> u32 ucr3;
>
> + 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);
>
> ucr3 = imx_uart_readl(sport, UCR3);
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-09-24 14:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-24 3:15 [PATCH V2 0/2] tty: serial: imx: improve the imx uart wakeup function Sherry Sun
2025-09-24 3:15 ` [PATCH V2 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source Sherry Sun
2025-09-24 14:50 ` Frank Li [this message]
2025-09-24 3:15 ` [PATCH V2 2/2] tty: serial: imx: Add missing wakeup event reporting Sherry Sun
2025-09-24 14:53 ` Frank Li
2025-09-25 8:51 ` Sherry Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aNQFHJlnmn9V2Eyy@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=imx@lists.linux.dev \
--cc=jirislaby@kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=shenwei.wang@nxp.com \
--cc=sherry.sun@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®