power: Send exit notification after post_ops callback
Currently notification about exiting an idle state is sent before post_ops and with interruptions locked. Change it to be sent after exit_pos_ops callback be called. Unfortunately it is not possible to just change the order these functions are called since the idle thread can be scheduled out just after irqs be unlocked and before has the chance to send the notification, so we are locking the scheduler and unlocking it only after the notification be sent. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
6091f0f116
commit
87c6311d99
1 changed files with 13 additions and 1 deletions
|
@ -131,8 +131,9 @@ void pm_system_resume(void)
|
|||
*/
|
||||
if (!post_ops_done) {
|
||||
post_ops_done = 1;
|
||||
pm_state_notify(false);
|
||||
pm_power_state_exit_post_ops(z_power_state);
|
||||
pm_state_notify(false);
|
||||
k_sched_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,6 +151,7 @@ void pm_power_state_force(struct pm_state_info info)
|
|||
post_ops_done = 0;
|
||||
pm_state_notify(true);
|
||||
|
||||
k_sched_lock();
|
||||
pm_debug_start_timer();
|
||||
/* Enter power state */
|
||||
pm_power_state_set(z_power_state);
|
||||
|
@ -204,6 +206,16 @@ enum pm_state pm_system_suspend(int32_t ticks)
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* This function runs with interruptions locked but it is
|
||||
* expected the SoC to unlock them in
|
||||
* pm_power_state_exit_post_ops() when returning to active
|
||||
* state. We don't want to be scheduled out yet, first we need
|
||||
* to send a notification about leaving the idle state. So,
|
||||
* we lock the scheduler here and unlock just after we have
|
||||
* sent the notification in pm_system_resume().
|
||||
*/
|
||||
k_sched_lock();
|
||||
pm_debug_start_timer();
|
||||
/* Enter power state */
|
||||
pm_state_notify(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue