power: move EXPLICIT_RELAX operation to pm_initialize()

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2022-07-25 14:28:21 +08:00 committed by Xiang Xiao
parent d8ebe98c6c
commit 487771033d
2 changed files with 14 additions and 19 deletions

View File

@ -70,11 +70,6 @@
int pm_set_governor(int domain, FAR const struct pm_governor_s *gov) int pm_set_governor(int domain, FAR const struct pm_governor_s *gov)
{ {
#if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX
int state;
int dom;
#endif
if (gov == NULL) if (gov == NULL)
{ {
return -EINVAL; return -EINVAL;
@ -93,19 +88,5 @@ int pm_set_governor(int domain, FAR const struct pm_governor_s *gov)
g_pmglobals.domain[domain].governor->initialize(); g_pmglobals.domain[domain].governor->initialize();
} }
#if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX
for (dom = 0; dom < CONFIG_PM_NDOMAINS; dom++)
{
for (state = 0; state < PM_COUNT; state++)
{
#if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX < 0
pm_stay(dom, state);
#else
pm_staytimeout(dom, state, CONFIG_PM_GOVERNOR_EXPLICIT_RELAX);
#endif
}
}
#endif
return 0; return 0;
} }

View File

@ -74,6 +74,9 @@ struct pm_global_s g_pmglobals =
void pm_initialize(void) void pm_initialize(void)
{ {
FAR const struct pm_governor_s *gov; FAR const struct pm_governor_s *gov;
#if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX
int state;
#endif
int i; int i;
pm_wakelock_global_init(); pm_wakelock_global_init();
@ -93,6 +96,17 @@ void pm_initialize(void)
pm_set_governor(i, gov); pm_set_governor(i, gov);
nxrmutex_init(&g_pmglobals.domain[i].lock); nxrmutex_init(&g_pmglobals.domain[i].lock);
#if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX
for (state = 0; state < PM_COUNT; state++)
{
# if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX < 0
pm_stay(i, state);
# else
pm_staytimeout(i, state, CONFIG_PM_GOVERNOR_EXPLICIT_RELAX);
# endif
}
#endif
} }
} }