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 V3 2/2] tty: serial: imx: Add missing wakeup event reporting
Date: Thu, 25 Sep 2025 11:49:26 -0400 [thread overview]
Message-ID: <aNVkhvmZ4GThHNqD@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250925091132.2537430-3-sherry.sun@nxp.com>
On Thu, Sep 25, 2025 at 05:11:32PM +0800, Sherry Sun wrote:
> Current imx uart wakeup event would not report itself as wakeup source
> through sysfs. Add pm_wakeup_event() to support it.
>
> Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
> ---
> drivers/tty/serial/imx.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 87d841c0b22f..0eb3f5b8f820 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -30,7 +30,7 @@
> #include <linux/iopoll.h>
> #include <linux/dma-mapping.h>
>
> -#include <asm/irq.h>
> +#include <linux/irq.h>
> #include <linux/dma/imx-dma.h>
>
> #include "serial_mctrl_gpio.h"
> @@ -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;
> - bool may_wake = false;
> - u32 ucr3;
> + bool may_wake = false, wake_active = false;
> + u32 ucr3, usr1;
>
> 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);
I think you miss understand my means. suppose bool type only support
||, &&, ==, !=, !
wake_active = wake_active || (usr1 & USR1_RTSD);
a |= b actually equal to a = a | b.
bool | u32, bool convert to u32 then bitwise to u32, algthough it is
allowed, but it is strange, like bool++ is strange. (true | 0x2 is 0x3)
bool || u32, u32 convert to bool, bool || bool is perfered.
(true || 0x2 is true)
your case the result is the same.
If sparse don't report warning, it should be fine.
Frank
}
> 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
>
next prev parent reply other threads:[~2025-09-25 15:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 9:11 [PATCH V3 0/2] tty: serial: imx: improve the imx uart wakeup function Sherry Sun
2025-09-25 9:11 ` [PATCH V3 1/2] tty: serial: imx: Only configure the wake register when device is set as wakeup source Sherry Sun
2025-09-29 5:54 ` Jiri Slaby
2025-10-02 4:32 ` Sherry Sun
2025-09-25 9:11 ` [PATCH V3 2/2] tty: serial: imx: Add missing wakeup event reporting Sherry Sun
2025-09-25 15:49 ` Frank Li [this message]
2025-09-29 5:58 ` Jiri Slaby
2025-10-02 3:44 ` 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=aNVkhvmZ4GThHNqD@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®