Skip to content

Commit be26c71

Browse files
gautierg-stcarlescufi
authored andcommitted
drivers: serial: stm32: prevent suspend to ram when operation in progress
Prevent the system to enter Suspend to RAM state while UART operation is in progress. Signed-off-by: Guillaume Gautier <[email protected]>
1 parent 02ef0c5 commit be26c71

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/serial/uart_stm32.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ static void uart_stm32_pm_policy_state_lock_get(const struct device *dev)
9696
if (!data->pm_policy_state_on) {
9797
data->pm_policy_state_on = true;
9898
pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_IDLE, PM_ALL_SUBSTATES);
99+
if (IS_ENABLED(CONFIG_PM_S2RAM)) {
100+
pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_RAM, PM_ALL_SUBSTATES);
101+
}
99102
}
100103
}
101104

@@ -106,6 +109,9 @@ static void uart_stm32_pm_policy_state_lock_put(const struct device *dev)
106109
if (data->pm_policy_state_on) {
107110
data->pm_policy_state_on = false;
108111
pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_IDLE, PM_ALL_SUBSTATES);
112+
if (IS_ENABLED(CONFIG_PM_S2RAM)) {
113+
pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_RAM, PM_ALL_SUBSTATES);
114+
}
109115
}
110116
}
111117
#endif /* CONFIG_PM */

0 commit comments

Comments
 (0)