pmconfig: add mulit domain support

pmconfig [domain]
pmconfig relax/stay state [domain]

Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
This commit is contained in:
zhuyanlin 2022-04-20 12:26:27 +08:00 committed by Xiang Xiao
parent 426cc840d8
commit a5a4c561fb
2 changed files with 14 additions and 4 deletions

View File

@ -402,8 +402,8 @@ static const struct cmdmap_s g_cmdmap[] =
#endif #endif
#if defined(CONFIG_PM) && !defined(CONFIG_NSH_DISABLE_PMCONFIG) #if defined(CONFIG_PM) && !defined(CONFIG_NSH_DISABLE_PMCONFIG)
{ "pmconfig", cmd_pmconfig, 1, 3, { "pmconfig", cmd_pmconfig, 1, 4,
"[stay|relax] [normal|idle|standby|sleep]" }, "[stay|relax] [normal|idle|standby|sleep] [domain]" },
#endif #endif
#if defined(CONFIG_BOARDCTL_POWEROFF) && !defined(CONFIG_NSH_DISABLE_POWEROFF) #if defined(CONFIG_BOARDCTL_POWEROFF) && !defined(CONFIG_NSH_DISABLE_POWEROFF)

View File

@ -178,7 +178,7 @@ int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
{ {
}; };
if (argc == 1) if (argc <= 2)
{ {
int current_state; int current_state;
int normal_count; int normal_count;
@ -186,6 +186,11 @@ int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
int standby_count; int standby_count;
int sleep_count; int sleep_count;
if (argc == 2)
{
ctrl.domain = atoi(argv[1]);
}
ctrl.action = BOARDIOC_PM_QUERYSTATE; ctrl.action = BOARDIOC_PM_QUERYSTATE;
boardctl(BOARDIOC_PM_CONTROL, (uintptr_t)&ctrl); boardctl(BOARDIOC_PM_CONTROL, (uintptr_t)&ctrl);
current_state = ctrl.state; current_state = ctrl.state;
@ -210,8 +215,13 @@ int cmd_pmconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
nsh_output(vtbl, "Current state %d, PM stay [%d, %d, %d, %d]\n", nsh_output(vtbl, "Current state %d, PM stay [%d, %d, %d, %d]\n",
current_state, normal_count, idle_count, standby_count, sleep_count); current_state, normal_count, idle_count, standby_count, sleep_count);
} }
else if (argc == 3) else if (argc <= 4)
{ {
if (argc == 4)
{
ctrl.domain = atoi(argv[3]);
}
if (strcmp(argv[1], "stay") == 0) if (strcmp(argv[1], "stay") == 0)
{ {
ctrl.action = BOARDIOC_PM_STAY; ctrl.action = BOARDIOC_PM_STAY;