From 34c5ffd676aba1c65e857d5312d9dc7602c557f4 Mon Sep 17 00:00:00 2001 From: Wai-Hong Tam Date: Tue, 22 Jun 2021 15:20:54 -0700 Subject: trogdor: Separate the board_hibernate() to a separate file Move the board_hiberante() from board.c to a separate file hibernate.c. This makes Zephyr easier to include the code. BRANCH=None BUG=b:191803008 TEST=Built the trogdor image successfully. Change-Id: Ie3749b9db72fc5b0535cfb6f9ef92499b3b46b82 Signed-off-by: Wai-Hong Tam Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2980447 Reviewed-by: Keith Short Commit-Queue: Keith Short --- board/trogdor/board.c | 12 ------------ board/trogdor/build.mk | 1 + board/trogdor/hibernate.c | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 board/trogdor/hibernate.c (limited to 'board') diff --git a/board/trogdor/board.c b/board/trogdor/board.c index 470f117a14..0d7eccdc57 100644 --- a/board/trogdor/board.c +++ b/board/trogdor/board.c @@ -122,18 +122,6 @@ static void board_init(void) } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); -void board_hibernate(void) -{ - /* - * Sensors are unpowered in hibernate. Apply PD to the - * interrupt lines such that they don't float. - */ - gpio_set_flags(GPIO_ACCEL_GYRO_INT_L, - GPIO_INPUT | GPIO_PULL_DOWN); - gpio_set_flags(GPIO_LID_ACCEL_INT_L, - GPIO_INPUT | GPIO_PULL_DOWN); -} - /* Called on AP S0 -> S3 transition */ static void board_chipset_suspend(void) { diff --git a/board/trogdor/build.mk b/board/trogdor/build.mk index 0d71877c98..7fe4452669 100644 --- a/board/trogdor/build.mk +++ b/board/trogdor/build.mk @@ -13,6 +13,7 @@ BASEBOARD:=trogdor board-y+=battery.o board-y+=board.o +board-y+=hibernate.o board-y+=led.o board-y+=switchcap.o board-y+=usbc_config.o diff --git a/board/trogdor/hibernate.c b/board/trogdor/hibernate.c new file mode 100644 index 0000000000..504a295463 --- /dev/null +++ b/board/trogdor/hibernate.c @@ -0,0 +1,18 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "gpio.h" + +void board_hibernate(void) +{ + /* + * Sensors are unpowered in hibernate. Apply PD to the + * interrupt lines such that they don't float. + */ + gpio_set_flags(GPIO_ACCEL_GYRO_INT_L, + GPIO_INPUT | GPIO_PULL_DOWN); + gpio_set_flags(GPIO_LID_ACCEL_INT_L, + GPIO_INPUT | GPIO_PULL_DOWN); +} -- cgit v1.2.1