summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYilun Lin <yllin@chromium.org>2019-08-28 15:56:35 +0800
committerCommit Bot <commit-bot@chromium.org>2019-08-30 15:34:14 +0000
commit5452d39961681a09f425c8de8ad20376fd4759d9 (patch)
tree0815c6516ceeb9c77c6037325d6a94dfaa612877
parent03e1aecae1cdc4f92e80957fbf8555740956cb1c (diff)
downloadchrome-ec-5452d39961681a09f425c8de8ad20376fd4759d9.tar.gz
kukui_scp: support suspending tasks tasks when AP in S3
Some of the tasks may access AP DRAM. However, for power efficiency, AP stops DRAM clock in S3, so SCP shouldn't access DRAM. This CL enable HC host_sleep_event and stops the tasks when system in S3 and re-enable the tasks when system in S0. BUG=b:136240895 TEST=See SCP disable tasks when AP suspend and enable tasks when AP resume. BRANCH=None Change-Id: I6f423407358b74c2a68432dc1548d1f8259bb331 Signed-off-by: Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1753564 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r--board/kukui_scp/board.c26
-rw-r--r--board/kukui_scp/board.h3
2 files changed, 29 insertions, 0 deletions
diff --git a/board/kukui_scp/board.c b/board/kukui_scp/board.c
index 955f5e8595..df32664625 100644
--- a/board/kukui_scp/board.c
+++ b/board/kukui_scp/board.c
@@ -6,9 +6,11 @@
#include "common.h"
#include "console.h"
+#include "ec_commands.h"
#include "ec_version.h"
#include "gpio.h"
#include "hooks.h"
+#include "power.h"
#include "registers.h"
#include "task.h"
#include "timer.h"
@@ -33,3 +35,27 @@ static void board_init(void)
gpio_enable_interrupt(GPIO_EINT7_TP);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+__override void
+power_chipset_handle_host_sleep_event(enum host_sleep_event state,
+ struct host_sleep_event_context *ctx)
+{
+ int i;
+ const task_id_t s3_suspend_tasks[] = {
+#ifndef S3_SUSPEND_TASK_LIST
+#define S3_SUSPEND_TASK_LIST
+#endif
+#define TASK(n, ...) TASK_ID_##n,
+ S3_SUSPEND_TASK_LIST
+ };
+
+ if (state == HOST_SLEEP_EVENT_S3_SUSPEND) {
+ ccprints("AP suspend");
+ for (i = 0; i < ARRAY_SIZE(s3_suspend_tasks); ++i)
+ task_disable_task(s3_suspend_tasks[i]);
+ } else if (state == HOST_SLEEP_EVENT_S3_RESUME) {
+ ccprints("AP resume");
+ for (i = 0; i < ARRAY_SIZE(s3_suspend_tasks); ++i)
+ task_enable_task(s3_suspend_tasks[i]);
+ }
+}
diff --git a/board/kukui_scp/board.h b/board/kukui_scp/board.h
index 743f511d25..aed3ccb145 100644
--- a/board/kukui_scp/board.h
+++ b/board/kukui_scp/board.h
@@ -92,6 +92,9 @@
#undef UART0_PINMUX_11_12
#undef UART0_PINMUX_110_112
+/* Track AP power state */
+#define CONFIG_POWER_TRACK_HOST_SLEEP_STATE
+
/* Debugging features */
#define CONFIG_DEBUG_EXCEPTIONS
#define CONFIG_DEBUG_STACK_OVERFLOW