pm: Better return type for pm_system_suspend
Instead of returning PM_STATE_ACTIVE for when the cpu didn't enter a low power state and a different state when it entered, but has already left the state and is active again, it changes pm_system_suspend to return true when the cpu has entered a low power state and false otherwise. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
8c3d9afed7
commit
9444480c7b
4 changed files with 8 additions and 6 deletions
|
@ -32,7 +32,7 @@ static void pm_save_idle(void)
|
||||||
/*
|
/*
|
||||||
* Call the suspend hook function of the soc interface to allow
|
* Call the suspend hook function of the soc interface to allow
|
||||||
* entry into a low power state. The function returns
|
* entry into a low power state. The function returns
|
||||||
* PM_STATE_ACTIVE if low power state was not entered, in which
|
* false if low power state was not entered, in which
|
||||||
* case, kernel does normal idle processing.
|
* case, kernel does normal idle processing.
|
||||||
*
|
*
|
||||||
* This function is entered with interrupts disabled. If a low power
|
* This function is entered with interrupts disabled. If a low power
|
||||||
|
@ -42,7 +42,7 @@ static void pm_save_idle(void)
|
||||||
* idle processing re-enables interrupts which is essential for
|
* idle processing re-enables interrupts which is essential for
|
||||||
* the kernel's scheduling logic.
|
* the kernel's scheduling logic.
|
||||||
*/
|
*/
|
||||||
if (pm_system_suspend(ticks) == PM_STATE_ACTIVE) {
|
if (pm_system_suspend(ticks) == false) {
|
||||||
k_cpu_idle();
|
k_cpu_idle();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -240,8 +240,10 @@ void z_mem_manage_boot_finish(void);
|
||||||
*
|
*
|
||||||
* This function is entered with interrupts disabled. It should re-enable
|
* This function is entered with interrupts disabled. It should re-enable
|
||||||
* interrupts if it had entered a power state.
|
* interrupts if it had entered a power state.
|
||||||
|
*
|
||||||
|
* @return True if the system suspended, otherwise return false
|
||||||
*/
|
*/
|
||||||
enum pm_state pm_system_suspend(int32_t ticks);
|
bool pm_system_suspend(int32_t ticks);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify exit from kernel idling after PM operations
|
* Notify exit from kernel idling after PM operations
|
||||||
|
|
|
@ -267,7 +267,7 @@ static enum pm_state _handle_device_abort(struct pm_state_info info)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum pm_state pm_system_suspend(int32_t ticks)
|
bool pm_system_suspend(int32_t ticks)
|
||||||
{
|
{
|
||||||
uint8_t id = _current_cpu->id;
|
uint8_t id = _current_cpu->id;
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ enum pm_state pm_system_suspend(int32_t ticks)
|
||||||
k_sched_unlock();
|
k_sched_unlock();
|
||||||
SYS_PORT_TRACING_FUNC_EXIT(pm, system_suspend, ticks,
|
SYS_PORT_TRACING_FUNC_EXIT(pm, system_suspend, ticks,
|
||||||
z_power_states[id].state);
|
z_power_states[id].state);
|
||||||
return z_power_states[id].state;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pm_notifier_register(struct pm_notifier *notifier)
|
void pm_notifier_register(struct pm_notifier *notifier)
|
||||||
|
|
|
@ -162,7 +162,7 @@ TaskState 0xBF 1=dummy, 2=Waiting, 4=New, 8=Terminated, 16=Suspended, 32=Termina
|
||||||
154 k_lifo_alloc_put lifo=%I, data=%I
|
154 k_lifo_alloc_put lifo=%I, data=%I
|
||||||
|
|
||||||
|
|
||||||
155 pm_system_suspend ticks=%u | Returns %PowerState
|
155 pm_system_suspend ticks=%u | Returns %Bool
|
||||||
156 pm_device_runtime_get dev=%I | Returns %u
|
156 pm_device_runtime_get dev=%I | Returns %u
|
||||||
157 pm_device_runtime_put dev=%I | Returns %u
|
157 pm_device_runtime_put dev=%I | Returns %u
|
||||||
158 pm_device_runtime_put_async dev=%I | Returns %u
|
158 pm_device_runtime_put_async dev=%I | Returns %u
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue