arch: arm: nordic_nrf: Add an API to check for valid PM state

Add an API _sys_soc_is_valid_power_state to check if a PM state
is valid or not.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
This commit is contained in:
Ramakrishna Pallala 2018-08-14 13:08:43 +05:30 committed by Anas Nashif
commit 1301cc636b
2 changed files with 23 additions and 0 deletions

View file

@ -97,3 +97,21 @@ void _sys_soc_power_state_post_ops(enum power_states state)
break;
}
}
bool _sys_soc_is_valid_power_state(enum power_states state)
{
switch (state) {
case SYS_POWER_STATE_CPU_LPS:
case SYS_POWER_STATE_CPU_LPS_1:
#if defined(CONFIG_SYS_POWER_DEEP_SLEEP)
case SYS_POWER_STATE_DEEP_SLEEP:
#endif
return true;
break;
default:
SYS_LOG_DBG("Unsupported State\n");
break;
}
return false;
}

View file

@ -27,6 +27,11 @@ enum power_states {
*/
void _sys_soc_set_power_state(enum power_states state);
/**
* @brief Check a low power state is supported by SoC
*/
bool _sys_soc_is_valid_power_state(enum power_states state);
/**
* @brief Do any SoC or architecture specific post ops after low power states.
*/