pm: Add a new function to query the next power state

Add a function that can be used by device drivers to know
what will be next power state used by the SoC.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2021-09-27 12:38:39 -07:00 committed by Maureen Helm
commit a507f60390
2 changed files with 17 additions and 0 deletions

View file

@ -173,6 +173,16 @@ bool pm_constraint_get(enum pm_state state);
*/
void pm_power_state_set(struct pm_state_info info);
/**
* @brief Gets the next power state that will be used.
*
* This function returns the next power state that will be used by the
* SoC.
*
* @return next pm_state_info that will be used
*/
const struct pm_state_info pm_power_state_next_get(void);
/**
* @brief Do any SoC or architecture specific post ops after sleep state exits.
*
@ -198,6 +208,8 @@ void pm_power_state_exit_post_ops(struct pm_state_info info);
#define pm_power_state_set(info)
#define pm_power_state_exit_post_ops(info)
#define pm_power_state_next_get() \
((struct pm_state_info){PM_STATE_ACTIVE, 0, 0})
#endif /* CONFIG_PM */

View file

@ -323,3 +323,8 @@ int pm_notifier_unregister(struct pm_notifier *notifier)
return ret;
}
const struct pm_state_info pm_power_state_next_get(void)
{
return z_power_state;
}