serial: stm32: enable / disable wake irqs for mcrtl_gpio wakeup sources
authorErwan Le Ray <erwan.leray@foss.st.com>
Thu, 3 Feb 2022 17:16:44 +0000 (18:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Feb 2022 10:07:16 +0000 (11:07 +0100)
Enable mctrl_gpio wake_irq if device_may_wakeup when usart is suspended,
and disable mctrl_gpios wake_irq if device_may_wakeup when usart is
resumed.

Signed-off-by: Erwan Le Ray <erwan.leray@foss.st.com>
Link: https://lore.kernel.org/r/20220203171644.12231-3-erwan.leray@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/stm32-usart.c

index 9570002..1b3a611 100644 (file)
@@ -1756,6 +1756,7 @@ static int __maybe_unused stm32_usart_serial_en_wakeup(struct uart_port *port,
        if (enable) {
                stm32_usart_set_bits(port, ofs->cr1, USART_CR1_UESM);
                stm32_usart_set_bits(port, ofs->cr3, USART_CR3_WUFIE);
+               mctrl_gpio_enable_irq_wake(stm32_port->gpios);
 
                /*
                 * When DMA is used for reception, it must be disabled before
@@ -1782,7 +1783,7 @@ static int __maybe_unused stm32_usart_serial_en_wakeup(struct uart_port *port,
                        if (ret)
                                return ret;
                }
-
+               mctrl_gpio_disable_irq_wake(stm32_port->gpios);
                stm32_usart_clr_bits(port, ofs->cr1, USART_CR1_UESM);
                stm32_usart_clr_bits(port, ofs->cr3, USART_CR3_WUFIE);
        }