Skip to content

Commit

Permalink
[nrf fromlist] soc: nordic: nrf54h: disable IRQ before PM config
Browse files Browse the repository at this point in the history
IRQs must be disabled before starting any procedures to prepare
for low-power states.

Upstream PR #: 79067

Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
  • Loading branch information
adamkondraciuk committed Nov 13, 2024
1 parent 76896fa commit 7b04326
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 1 addition & 3 deletions soc/nordic/nrf54h/pm_s2ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,16 @@ int soc_s2ram_suspend(pm_s2ram_system_off_fn_t system_off)
{
int ret;

__disable_irq();
nvic_suspend(&backup_data.nvic_context);
mpu_suspend(&backup_data.mpu_context);
ret = arch_pm_s2ram_suspend(system_off);
if (ret < 0) {
__enable_irq();
/* On resuming or error we return exactly *HERE* */
return ret;
}

mpu_resume(&backup_data.mpu_context);
nvic_resume(&backup_data.nvic_context);
__enable_irq();

return ret;
}
Expand Down
6 changes: 4 additions & 2 deletions soc/nordic/nrf54h/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,16 @@ static void s2ram_enter(void)
void pm_state_set(enum pm_state state, uint8_t substate_id)
{
if (state == PM_STATE_SUSPEND_TO_IDLE) {
__disable_irq();
s2idle_enter(substate_id);
/* Resume here. */
s2idle_exit(substate_id);
}
#if defined(CONFIG_PM_S2RAM)
else if (state == PM_STATE_SUSPEND_TO_RAM) {
__disable_irq();
s2ram_enter();
/* On resuming or error we return exactly *HERE* */
/* Resume here. */
s2ram_exit();
}
#endif
Expand All @@ -206,5 +208,5 @@ void pm_state_set(enum pm_state state, uint8_t substate_id)

void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id)
{
irq_unlock(0);
__enable_irq();
}

0 comments on commit 7b04326

Please sign in to comment.