Skip to content

Commit b8fdcbb

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

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/entropy/entropy_stm32.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ static int start_pool_filling(bool wait)
417417
* rng pool is filled.
418418
*/
419419
pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_IDLE, PM_ALL_SUBSTATES);
420+
if (IS_ENABLED(CONFIG_PM_S2RAM)) {
421+
pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_RAM, PM_ALL_SUBSTATES);
422+
}
420423

421424
acquire_rng();
422425
irq_enable(IRQN);
@@ -546,6 +549,9 @@ static void stm32_rng_isr(const void *arg)
546549
irq_disable(IRQN);
547550
release_rng();
548551
pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_IDLE, PM_ALL_SUBSTATES);
552+
if (IS_ENABLED(CONFIG_PM_S2RAM)) {
553+
pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_RAM, PM_ALL_SUBSTATES);
554+
}
549555
entropy_stm32_rng_data.filling_pools = false;
550556
}
551557

0 commit comments

Comments
 (0)