power_mgmt: Simplify _sys_soc_resume notification
_sys_soc_resume hook is over loaded to handle to different scenarios. It is primarily called to notify exit of kernel idling after PM operations. It is also used to notify exit from deep sleep. This is very confusing and also makes the implementation of the hook function very difficult because of very different conditions involved in the 2 different use cases. Further, users may not require either or both use cases depending of their custom boot flow and power state handling. To simplify, create a separate hook for the purpose of deep sleep exit notification. Use the existing one to only notify kernel idling exit after PM operations. Jira: ZEP-1256 Change-Id: I96350199a0fd37f16590c8ee5302a94a3d71b8ba Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
This commit is contained in:
parent
1d2fcc2254
commit
c0cd7acf34
3 changed files with 30 additions and 19 deletions
|
@ -49,7 +49,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
|
||||
GTEXT(_sys_soc_resume)
|
||||
GTEXT(_sys_soc_resume_from_deep_sleep)
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -180,14 +180,14 @@ __csSet:
|
|||
* the ISR stack size are some multiple of STACK_ALIGN, which
|
||||
* is at least 4.
|
||||
*
|
||||
* This is also used to call the _sys_soc_resume() routine
|
||||
* to avoid memory corruption if the system is resuming from
|
||||
* deep sleep. It is important that _sys_soc_resume() restores
|
||||
* the stack pointer to what it was at deep sleep before
|
||||
* This is also used to call the _sys_soc_resume_from_deep_sleep()
|
||||
* routine to avoid memory corruption if the system is resuming from
|
||||
* deep sleep. It is important that _sys_soc_resume_from_deep_sleep()
|
||||
* restores the stack pointer to what it was at deep sleep before
|
||||
* enabling interrupts. This is necessary to avoid
|
||||
* interfering with interrupt handler use of this stack.
|
||||
* If it is a cold boot then _sys_soc_resume() should not do
|
||||
* anything and must return immediately.
|
||||
* If it is a cold boot then _sys_soc_resume_from_deep_sleep() should
|
||||
* not do anything and must return immediately.
|
||||
*/
|
||||
#ifdef CONFIG_INIT_STACKS
|
||||
movl $0xAAAAAAAA, %eax
|
||||
|
@ -202,8 +202,8 @@ __csSet:
|
|||
|
||||
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
|
||||
/*
|
||||
* Invoke _sys_soc_resume() hook to handle resume from deep sleep.
|
||||
* It should first check whether system is recovering from
|
||||
* Invoke _sys_soc_resume_from_deep_sleep() hook to handle resume from
|
||||
* deep sleep. It should first check whether system is recovering from
|
||||
* deep sleep state. If it is, then this function should restore
|
||||
* states and resume at the point system went to deep sleep.
|
||||
* In this case this function will never return.
|
||||
|
@ -213,7 +213,7 @@ __csSet:
|
|||
* return and execution falls through to cold boot path.
|
||||
*/
|
||||
|
||||
call _sys_soc_resume
|
||||
call _sys_soc_resume_from_deep_sleep
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -53,21 +53,30 @@ static inline void _sys_soc_disable_wake_event_notification(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Hook function to notify exit from low power state
|
||||
* @brief Hook function to notify exit from deep sleep
|
||||
*
|
||||
* The purpose of this function is to notify exit from
|
||||
* low power states. The implementation of this function can vary
|
||||
* deep sleep. The implementation of this function can vary
|
||||
* depending on the soc specific boot flow.
|
||||
*
|
||||
* In the case of recovery from soc low power states like deep sleep,
|
||||
* this function would switch cpu context to the execution point at the time
|
||||
* system entered the soc low power state.
|
||||
* This function would switch cpu context to the execution point at the time
|
||||
* system entered deep sleep power state. Some implementations may not require
|
||||
* use of this function e.g. the BSP or boot loader may do the context switch.
|
||||
*
|
||||
* In boot flows where this function gets called even at cold boot, the
|
||||
* function should return immediately.
|
||||
*
|
||||
* Wake event notification:
|
||||
* This function would also be called from the ISR context of the event
|
||||
*/
|
||||
void _sys_soc_resume_from_deep_sleep(void);
|
||||
|
||||
/**
|
||||
* @brief Hook function to notify exit from kernel idling after PM operations
|
||||
*
|
||||
* This function would notify exit from kernel idling if a corresponding
|
||||
* _sys_soc_suspend() notification was handled and did not return
|
||||
* SYS_PM_NOT_HANDLED.
|
||||
*
|
||||
* This function would be called from the ISR context of the event
|
||||
* that caused exit from the low power state. This will be called immediately
|
||||
* after interrupts are enabled. This is called to give a chance to do
|
||||
* any operations before the kernel would switch tasks or processes nested
|
||||
|
@ -79,8 +88,6 @@ static inline void _sys_soc_disable_wake_event_notification(void)
|
|||
* notification. Alternatively _sys_soc_disable_wake_event_notification() can
|
||||
* be called in _sys_soc_suspend to disable this notification.
|
||||
*
|
||||
* @note A dedicated function may be created in future to notify wake
|
||||
* events, instead of overloading this one.
|
||||
*/
|
||||
void _sys_soc_resume(void);
|
||||
|
||||
|
|
|
@ -41,6 +41,10 @@ void __attribute__((weak)) _sys_soc_resume(void)
|
|||
{
|
||||
}
|
||||
|
||||
void __attribute__((weak)) _sys_soc_resume_from_deep_sleep(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Indicate that kernel is idling in tickless mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue