diff options
author | Wai-Hong Tam <waihong@google.com> | 2020-07-23 15:58:48 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-30 04:32:36 +0000 |
commit | 1cef85d675613e6cf18a5408675cc33085586d8b (patch) | |
tree | e27e38bd2fcec9982ead68ad36591f3e6595a7e4 /chip/stm32/spi.c | |
parent | c7a2cb72c6de063c83cc2b5385f1e67571267569 (diff) | |
download | chrome-ec-1cef85d675613e6cf18a5408675cc33085586d8b.tar.gz |
spi: Use different hooks for SPI enable/disable
If CONFIG_CHIPSET_RESUME_INIT_HOOK is defined, move the SPI
enable/disable to different hooks, i.e.
* RESUME_INIT instead of RESUME
* SUSPEND_COMPLETE instead SUSPEND
The SPI interface has to be enable earlier than other hooks
to receive a host sleep event.
BRANCH=None
BUG=b:148149387
TEST=make buildall -j
Change-Id: Ic56a7b5ef20fb8258487d1d350fc5f8a55e33049
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2324989
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'chip/stm32/spi.c')
-rw-r--r-- | chip/stm32/spi.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/chip/stm32/spi.c b/chip/stm32/spi.c index 6a38c2e262..21857837c2 100644 --- a/chip/stm32/spi.c +++ b/chip/stm32/spi.c @@ -633,7 +633,11 @@ static void spi_chipset_startup(void) enabled = 1; } +#ifdef CONFIG_CHIPSET_RESUME_INIT_HOOK +DECLARE_HOOK(HOOK_CHIPSET_RESUME_INIT, spi_chipset_startup, HOOK_PRIO_DEFAULT); +#else DECLARE_HOOK(HOOK_CHIPSET_RESUME, spi_chipset_startup, HOOK_PRIO_DEFAULT); +#endif static void spi_chipset_shutdown(void) { @@ -649,7 +653,12 @@ static void spi_chipset_shutdown(void) /* Allow deep sleep when AP off */ enable_sleep(SLEEP_MASK_SPI); } +#ifdef CONFIG_CHIPSET_RESUME_INIT_HOOK +DECLARE_HOOK(HOOK_CHIPSET_SUSPEND_COMPLETE, spi_chipset_shutdown, + HOOK_PRIO_DEFAULT); +#else DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, spi_chipset_shutdown, HOOK_PRIO_DEFAULT); +#endif static void spi_init(void) { |