MLK-17133-01 tty: serial: lpuart: only enable wakeup interrupt when wakeup enabled
authorFugang Duan <fugang.duan@nxp.com>
Fri, 1 Dec 2017 06:27:39 +0000 (14:27 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:50:58 +0000 (14:50 -0500)
Current driver suppose system disable irq when wakeup is not enabled
like below follow, so it always enable the wakeup interrupt in .suspend_noirq().
dpm_suspend_noirq()
device_wakeup_arm_wake_irqs()
if (device_may_wakeup(wirq->dev))
enable_irq_wake(wirq->irq);
irq_set_irq_wake(irq, 1);
suspend_device_irqs();
if (irqd_is_wakeup_set(&desc->irq_data))
__disable_irq(desc);
device_suspend_noirq(dev);
...

But in i.MX8x chips, the gic-v3 chip->irq_disable() is not implemented,
so the device's irq line is not masked in noirq stage. Then lpuart interrupt
can wake up system even if it is not enabled as wakeup source.

To avoid the issue, only enable wakeup interrupt when it is enabled as
wakeup source.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Reviewed-by: Robin Gong <yibin.gong@nxp.com>
drivers/tty/serial/fsl_lpuart.c

index b89a1bc..7db61b0 100644 (file)
@@ -2357,7 +2357,7 @@ static int lpuart_suspend_noirq(struct device *dev)
        struct platform_device *pdev = to_platform_device(dev);
        struct lpuart_port *sport = platform_get_drvdata(pdev);
 
-       serial_lpuart_enable_wakeup(sport, true);
+       serial_lpuart_enable_wakeup(sport, !!sport->port.irq_wake);
 
        clk_disable(sport->ipg_clk);
        pinctrl_pm_select_sleep_state(dev);