Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tty: serial: imx: Add missing wakeup event reporting

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>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20251002045259.2725461-3-sherry.sun@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sherry Sun and committed by
Greg Kroah-Hartman
0cfadf4b d55f3d23

+9 -3
+9 -3
drivers/tty/serial/imx.c
··· 30 30 #include <linux/iopoll.h> 31 31 #include <linux/dma-mapping.h> 32 32 33 - #include <asm/irq.h> 33 + #include <linux/irq.h> 34 34 #include <linux/dma/imx-dma.h> 35 35 36 36 #include "serial_mctrl_gpio.h" ··· 2699 2699 { 2700 2700 struct tty_port *port = &sport->port.state->port; 2701 2701 struct device *tty_dev; 2702 - bool may_wake = false; 2703 - u32 ucr3; 2702 + bool may_wake = false, wake_active = false; 2703 + u32 ucr3, usr1; 2704 2704 2705 2705 scoped_guard(tty_port_tty, port) { 2706 2706 struct tty_struct *tty = scoped_tty(); ··· 2715 2715 2716 2716 uart_port_lock_irq(&sport->port); 2717 2717 2718 + usr1 = imx_uart_readl(sport, USR1); 2718 2719 ucr3 = imx_uart_readl(sport, UCR3); 2719 2720 if (on) { 2720 2721 imx_uart_writel(sport, USR1_AWAKE, USR1); 2721 2722 ucr3 |= UCR3_AWAKEN; 2722 2723 } else { 2723 2724 ucr3 &= ~UCR3_AWAKEN; 2725 + wake_active = usr1 & USR1_AWAKE; 2724 2726 } 2725 2727 imx_uart_writel(sport, ucr3, UCR3); 2726 2728 ··· 2733 2731 ucr1 |= UCR1_RTSDEN; 2734 2732 } else { 2735 2733 ucr1 &= ~UCR1_RTSDEN; 2734 + wake_active = wake_active || (usr1 & USR1_RTSD); 2736 2735 } 2737 2736 imx_uart_writel(sport, ucr1, UCR1); 2738 2737 } 2738 + 2739 + if (wake_active && irqd_is_wakeup_set(irq_get_irq_data(sport->port.irq))) 2740 + pm_wakeup_event(tty_port_tty_get(port)->dev, 0); 2739 2741 2740 2742 uart_port_unlock_irq(&sport->port); 2741 2743 }