power: Send state changes notification after device PM
Currently the power subsys is sending notifications about power state changes before doing device pm. If one device fails to low power or suspend the system never goes to an idle state. Change to send notifications just before call SoC to suspend and avoid misleading information. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
9b246aba78
commit
741141e464
|
@ -138,7 +138,6 @@ static enum pm_state _handle_device_abort(struct pm_state_info info)
|
|||
{
|
||||
LOG_DBG("Some devices didn't enter suspend state!");
|
||||
pm_resume_devices();
|
||||
pm_state_notify(false);
|
||||
|
||||
z_power_state.state = PM_STATE_ACTIVE;
|
||||
return PM_STATE_ACTIVE;
|
||||
|
@ -160,7 +159,6 @@ enum pm_state pm_system_suspend(int32_t ticks)
|
|||
deep_sleep = pm_is_deep_sleep_state(z_power_state.state);
|
||||
|
||||
post_ops_done = 0;
|
||||
pm_state_notify(true);
|
||||
|
||||
if (deep_sleep) {
|
||||
/* Suspend peripherals. */
|
||||
|
@ -186,6 +184,7 @@ enum pm_state pm_system_suspend(int32_t ticks)
|
|||
|
||||
pm_debug_start_timer();
|
||||
/* Enter power state */
|
||||
pm_state_notify(true);
|
||||
pm_power_state_set(z_power_state);
|
||||
pm_debug_stop_timer();
|
||||
|
||||
|
|
|
@ -98,9 +98,9 @@ static void notify_pm_state_entry(enum pm_state state)
|
|||
zassert_true(z_is_idle_thread_object(_current), NULL);
|
||||
zassert_equal(state, PM_STATE_RUNTIME_IDLE, NULL);
|
||||
|
||||
/* at this point, devices are active */
|
||||
/* at this point, devices should not be active */
|
||||
device_get_power_state(dev, &device_power_state);
|
||||
zassert_equal(device_power_state, DEVICE_PM_ACTIVE_STATE, NULL);
|
||||
zassert_false(device_power_state == DEVICE_PM_ACTIVE_STATE, NULL);
|
||||
set_pm = true;
|
||||
notify_app_exit = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue