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)
commit3f4266b7e2e7bc767bfe2de114d135fa94e41591
treeae9e54571b95446b374546b0b48d2317c010af76
parent3a70029d1385872c64edeee85ad0f967b82d8a86
MLK-17133-01 tty: serial: lpuart: only enable wakeup interrupt when wakeup enabled

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