summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--baseboard/asurada/baseboard.c23
-rw-r--r--baseboard/asurada/build.mk1
-rw-r--r--baseboard/asurada/hibernate.c37
-rw-r--r--zephyr/projects/asurada/hayato/CMakeLists.txt1
4 files changed, 39 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();
+}
diff --git a/zephyr/projects/asurada/hayato/CMakeLists.txt b/zephyr/projects/asurada/hayato/CMakeLists.txt
index d18e8f20ba..660b0a9088 100644
--- a/zephyr/projects/asurada/hayato/CMakeLists.txt
+++ b/zephyr/projects/asurada/hayato/CMakeLists.txt
@@ -18,6 +18,7 @@ set(PLATFORM_EC_BOARD "${PLATFORM_EC}/board/hayato" CACHE PATH
zephyr_library_sources(
"${PLATFORM_EC_BASEBOARD}/board_chipset.c"
"${PLATFORM_EC_BASEBOARD}/board_id.c"
+ "${PLATFORM_EC_BASEBOARD}/hibernate.c"
"${PLATFORM_EC_BASEBOARD}/regulator.c"
"${PLATFORM_EC_BASEBOARD}/usbc_config.c"
"${PLATFORM_EC_BASEBOARD}/usb_pd_policy.c")