Skip to content

Commit

Permalink
serial: stm32: add no_console_suspend support
Browse files Browse the repository at this point in the history
In order to display console messages in low power mode, console pins
must be kept active after suspend call.

Initial patch "serial: stm32: add support for no_console_suspend" was part
of "STM32 usart power improvement" series, but as dependancy to
console_suspend pinctl state has been removed to fit with Rob comment [1],
this patch has no more dependancy with any other patch of this series.

[1] https://lkml.org/lkml/2019/7/9/451

Signed-off-by: Erwan Le Ray <erwan.leray@st.com>

Link: https://lore.kernel.org/r/20200519094104.27082-1-erwan.leray@st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Erwan Le Ray authored and Greg Kroah-Hartman committed May 19, 2020
1 parent b14109f commit 55484fc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/tty/serial/stm32-usart.c
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,18 @@ static int __maybe_unused stm32_serial_suspend(struct device *dev)
else
stm32_serial_enable_wakeup(port, false);

pinctrl_pm_select_sleep_state(dev);
/*
* When "no_console_suspend" is enabled, keep the pinctrl default state
* and rely on bootloader stage to restore this state upon resume.
* Otherwise, apply the idle or sleep states depending on wakeup
* capabilities.
*/
if (console_suspend_enabled || !uart_console(port)) {
if (device_may_wakeup(dev))
pinctrl_pm_select_idle_state(dev);
else
pinctrl_pm_select_sleep_state(dev);
}

return 0;
}
Expand Down

0 comments on commit 55484fc

Please sign in to comment.