summaryrefslogtreecommitdiff
path: root/board/lazor
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2021-04-29 16:41:54 -0700
committerCommit Bot <commit-bot@chromium.org>2021-05-01 03:02:09 +0000
commitb30f7b8528b87933c4c060aa26019c04227fa3f1 (patch)
tree3ffca5953cae1af09dbdb4ab540b2e21997589a6 /board/lazor
parenta0b71d52be6734cc6f6c3670e6edb402d93059b9 (diff)
downloadchrome-ec-b30f7b8528b87933c4c060aa26019c04227fa3f1.tar.gz
trogdor: Move the hibernate functions into separate files
Move the hiberante functions from baseboard.c and board.c to separate hibernate.c files. This makes Zephyr easier to include the code. BRANCH=None BUG=b:183745774 TEST=Built the EC image and tested EC hibernate on Lazor. Change-Id: Ic2f0a73687075c5d6c0dddbb329abea7a0f27053 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2861057 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'board/lazor')
-rw-r--r--board/lazor/board.c31
-rw-r--r--board/lazor/build.mk1
-rw-r--r--board/lazor/hibernate.c39
3 files changed, 40 insertions, 31 deletions
diff --git a/board/lazor/board.c b/board/lazor/board.c
index e9d5f101e3..4ad8cf51fe 100644
--- a/board/lazor/board.c
+++ b/board/lazor/board.c
@@ -393,37 +393,6 @@ static void board_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-void board_hibernate(void)
-{
- int i;
-
- if (!board_is_clamshell()) {
- /*
- * 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);
- }
-
- /*
- * Board rev 5+ has the hardware fix. Don't need the following
- * workaround.
- */
- if (system_get_board_version() >= 5)
- return;
-
- /*
- * Enable the PPC power sink path before EC enters hibernate;
- * otherwise, ACOK won't go High and can't wake EC up. Check the
- * bug b/170324206 for details.
- */
- for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++)
- ppc_vbus_sink_enable(i, 1);
-}
-
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)
{
diff --git a/board/lazor/build.mk b/board/lazor/build.mk
index b51eda7cfd..8cf8679e35 100644
--- a/board/lazor/build.mk
+++ b/board/lazor/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+=sku.o
board-y+=switchcap.o
diff --git a/board/lazor/hibernate.c b/board/lazor/hibernate.c
new file mode 100644
index 0000000000..2b9bfa44eb
--- /dev/null
+++ b/board/lazor/hibernate.c
@@ -0,0 +1,39 @@
+/* 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 "common.h"
+#include "system.h"
+#include "usbc_ppc.h"
+
+void board_hibernate(void)
+{
+ int i;
+
+ if (!board_is_clamshell()) {
+ /*
+ * 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);
+ }
+
+ /*
+ * Board rev 5+ has the hardware fix. Don't need the following
+ * workaround.
+ */
+ if (system_get_board_version() >= 5)
+ return;
+
+ /*
+ * Enable the PPC power sink path before EC enters hibernate;
+ * otherwise, ACOK won't go High and can't wake EC up. Check the
+ * bug b/170324206 for details.
+ */
+ for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++)
+ ppc_vbus_sink_enable(i, 1);
+}