summaryrefslogtreecommitdiff
path: root/baseboard/asurada
diff options
context:
space:
mode:
authorTim Lin <tim2.lin@ite.corp-partner.google.com>2021-09-08 10:51:41 +0800
committerCommit Bot <commit-bot@chromium.org>2021-09-10 17:34:45 +0000
commit77c74fa5ed663478062f652559eb17e015363b6f (patch)
tree48512d9d2f8fcd60cd7ca7ef2cc3a2d4c947ca41 /baseboard/asurada
parentf7de5f9b916e36cd36d36447b605a593b0728d8e (diff)
downloadchrome-ec-77c74fa5ed663478062f652559eb17e015363b6f.tar.gz
asurada: move the hibernate routine into separate file
Move the hibernate routine from baseboard.c to separate hibernate.c files. BUG=b:198305804 BRANCH=none TEST=make BOARD=asurada -j The interrupt of GPIO_AC_PRESENT can wake up CPU in hibernate mode. Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: I0aea0b812f535c907ac8963fc1f09206dfef5956 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3146773 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'baseboard/asurada')
-rw-r--r--baseboard/asurada/baseboard.c23
-rw-r--r--baseboard/asurada/build.mk1
-rw-r--r--baseboard/asurada/hibernate.c37
3 files changed, 38 insertions, 23 deletions
diff --git a/baseboard/asurada/baseboard.c b/baseboard/asurada/baseboard.c
index 60a9622fa8..c89348a562 100644
--- a/baseboard/asurada/baseboard.c
+++ b/baseboard/asurada/baseboard.c
@@ -52,29 +52,6 @@ enum gpio_signal hibernate_wake_pins[] = {
};
int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
-__override void board_hibernate_late(void)
-{
- /*
- * Turn off PP5000_A. Required for devices without Z-state.
- * Don't care for devices with Z-state.
- */
- gpio_set_level(GPIO_EN_PP5000_A, 0);
-
- /*
- * GPIO_EN_SLP_Z not implemented in rev0/1,
- * fallback to usual hibernate process.
- */
- if (IS_ENABLED(BOARD_ASURADA) && board_get_version() <= 1)
- return;
-
- isl9238c_hibernate(CHARGER_SOLO);
-
- gpio_set_level(GPIO_EN_SLP_Z, 1);
-
- /* should not reach here */
- __builtin_unreachable();
-}
-
/*
* I2C channels (A, B, and C) are using the same timing registers (00h~07h)
* at default.
diff --git a/baseboard/asurada/build.mk b/baseboard/asurada/build.mk
index 5fed63924b..ce7b7272bd 100644
--- a/baseboard/asurada/build.mk
+++ b/baseboard/asurada/build.mk
@@ -9,6 +9,7 @@
baseboard-y=baseboard.o
baseboard-y+=board_chipset.o
baseboard-y+=board_id.o
+baseboard-y+=hibernate.o
baseboard-y+=regulator.o
baseboard-y+=usbc_config.o
baseboard-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o
diff --git a/baseboard/asurada/hibernate.c b/baseboard/asurada/hibernate.c
new file mode 100644
index 0000000000..b26bd44adc
--- /dev/null
+++ b/baseboard/asurada/hibernate.c
@@ -0,0 +1,37 @@
+/* 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 "charger.h"
+#include "driver/charger/isl923x_public.h"
+#include "gpio.h"
+#include "system.h"
+
+/* Hayato board specific hibernate implementation */
+__override void board_hibernate_late(void)
+{
+ /*
+ * Turn off PP5000_A. Required for devices without Z-state.
+ * Don't care for devices with Z-state.
+ */
+ gpio_set_level(GPIO_EN_PP5000_A, 0);
+
+ /*
+ * GPIO_EN_SLP_Z not implemented in rev0/1,
+ * fallback to usual hibernate process.
+ */
+ if (board_get_version() <= 1) {
+ if (IS_ENABLED(BOARD_ASURADA) ||
+ (IS_ENABLED(CONFIG_ZEPHYR) &&
+ IS_ENABLED(CONFIG_BOARD_ASURADA)))
+ return;
+ }
+
+ isl9238c_hibernate(CHARGER_SOLO);
+
+ gpio_set_level(GPIO_EN_SLP_Z, 1);
+
+ /* should not reach here */
+ __builtin_unreachable();
+}