From 954151e1776cf103a949ade16e14b9fcd4d3b690 Mon Sep 17 00:00:00 2001 From: Weiyi Lu Date: Wed, 3 Feb 2021 17:41:32 +0800 Subject: mt8192_scp/clock: Use ULPOSC1 when AP suspend Uses ULPOSC1(260/2MHz) when AP suspend(0.575V <= Vcore <= 0.6V) TEST=suspend/resume ok BUG=b:176317491 Signed-off-by: Weiyi Lu Change-Id: I6fa604f1663539dc108e3c52775054ecc64a8021 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2671264 Reviewed-by: Eric Yilun Lin Reviewed-by: Tzung-Bi Shih Commit-Queue: Tzung-Bi Shih Tested-by: Tzung-Bi Shih --- board/asurada_scp/board.h | 2 ++ chip/mt8192_scp/ipi.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/board/asurada_scp/board.h b/board/asurada_scp/board.h index 1648862275..b945a048c0 100644 --- a/board/asurada_scp/board.h +++ b/board/asurada_scp/board.h @@ -71,6 +71,8 @@ #define CONFIG_DRAM_BASE_LOAD 0x50000000 #define CONFIG_DRAM_SIZE 0x01400000 /* 20 MB */ +#define CONFIG_POWER_TRACK_HOST_SLEEP_STATE + #ifndef __ASSEMBLER__ #include "gpio_signal.h" #endif /* !__ASSEMBLER__ */ diff --git a/chip/mt8192_scp/ipi.c b/chip/mt8192_scp/ipi.c index 39fcc09809..d7c7248760 100644 --- a/chip/mt8192_scp/ipi.c +++ b/chip/mt8192_scp/ipi.c @@ -4,11 +4,14 @@ */ #include "atomic.h" +#include "clock.h" +#include "clock_chip.h" #include "common.h" #include "console.h" #include "hooks.h" #include "hostcmd.h" #include "ipi_chip.h" +#include "power.h" #include "registers.h" #include "system.h" #include "task.h" @@ -54,6 +57,19 @@ static void ipi_wake_ap(int32_t id) SCP_SCP2SPM_IPC_SET = IPC_SCP2HOST; } +__override void +power_chipset_handle_host_sleep_event(enum host_sleep_event state, + struct host_sleep_event_context *ctx) +{ + if (state == HOST_SLEEP_EVENT_S3_SUSPEND) { + ccprints("AP suspend"); + clock_select_clock(SCP_CLK_ULPOSC1); + } else if (state == HOST_SLEEP_EVENT_S3_RESUME) { + ccprints("AP resume"); + clock_select_clock(SCP_CLK_ULPOSC2); + } +} + int ipi_send(int32_t id, const void *buf, uint32_t len, int wait) { int ret; -- cgit v1.2.1