diff options
-rw-r--r-- | chip/host/system.c | 3 | ||||
-rw-r--r-- | chip/it83xx/system.c | 3 | ||||
-rw-r--r-- | chip/lm4/system.c | 4 | ||||
-rw-r--r-- | chip/mec1322/system.c | 3 | ||||
-rw-r--r-- | chip/npcx/system.c | 3 | ||||
-rw-r--r-- | chip/nrf51/system.c | 3 | ||||
-rw-r--r-- | chip/stm32/system.c | 4 | ||||
-rw-r--r-- | include/system.h | 7 | ||||
-rw-r--r-- | power/braswell.c | 5 |
9 files changed, 35 insertions, 0 deletions
diff --git a/chip/host/system.c b/chip/host/system.c index b6a2fe6ab7..3de4ab10cd 100644 --- a/chip/host/system.c +++ b/chip/host/system.c @@ -154,6 +154,9 @@ test_mockable void system_hibernate(uint32_t seconds, uint32_t microseconds) { uint32_t i; + if (board_hibernate) + board_hibernate(); + save_reset_flags(RESET_FLAG_HIBERNATE); if (!seconds && !microseconds) diff --git a/chip/it83xx/system.c b/chip/it83xx/system.c index 8d434c9c5c..5247ea332f 100644 --- a/chip/it83xx/system.c +++ b/chip/it83xx/system.c @@ -24,6 +24,9 @@ enum system_bram_indices { void system_hibernate(uint32_t seconds, uint32_t microseconds) { + if (board_hibernate) + board_hibernate(); + /* TODO(crosbug.com/p/23575): IMPLEMENT ME ! */ } diff --git a/chip/lm4/system.c b/chip/lm4/system.c index 38cde27e1c..737c9e24b3 100644 --- a/chip/lm4/system.c +++ b/chip/lm4/system.c @@ -385,6 +385,10 @@ void system_hibernate(uint32_t seconds, uint32_t microseconds) { /* Flush console before hibernating */ cflush(); + + if (board_hibernate) + board_hibernate(); + hibernate(seconds, microseconds, HIBDATA_WAKE_PIN); } diff --git a/chip/mec1322/system.c b/chip/mec1322/system.c index 2526704b0c..4c8631a616 100644 --- a/chip/mec1322/system.c +++ b/chip/mec1322/system.c @@ -287,6 +287,9 @@ void system_hibernate(uint32_t seconds, uint32_t microseconds) cflush(); + if (board_hibernate) + board_hibernate(); + /* Disable interrupts */ interrupt_disable(); for (i = 0; i < 3; ++i) diff --git a/chip/npcx/system.c b/chip/npcx/system.c index 2a872d0b66..8d8dc42830 100644 --- a/chip/npcx/system.c +++ b/chip/npcx/system.c @@ -427,6 +427,9 @@ void system_hibernate(uint32_t seconds, uint32_t microseconds) /* Flush console before hibernating */ cflush(); + if (board_hibernate) + board_hibernate(); + #if SUPPORT_HIB /* Add additional hibernate operations here */ __enter_hibernate(seconds, microseconds); diff --git a/chip/nrf51/system.c b/chip/nrf51/system.c index 86d78b3170..94c36202e4 100644 --- a/chip/nrf51/system.c +++ b/chip/nrf51/system.c @@ -36,6 +36,9 @@ void system_hibernate(uint32_t seconds, uint32_t microseconds) /* Flush console before hibernating */ cflush(); + if (board_hibernate) + board_hibernate(); + /* chip specific standby mode */ CPRINTS("TODO: implement %s()", __func__); } diff --git a/chip/stm32/system.c b/chip/stm32/system.c index 88cde274fd..051340dbf6 100644 --- a/chip/stm32/system.c +++ b/chip/stm32/system.c @@ -106,6 +106,10 @@ void system_hibernate(uint32_t seconds, uint32_t microseconds) { /* Flush console before hibernating */ cflush(); + + if (board_hibernate) + board_hibernate(); + /* chip specific standby mode */ __enter_hibernate(seconds, microseconds); } diff --git a/include/system.h b/include/system.h index 320410b160..fe079aa646 100644 --- a/include/system.h +++ b/include/system.h @@ -264,6 +264,13 @@ int system_set_vbnvcontext(const uint8_t *block); */ void system_hibernate(uint32_t seconds, uint32_t microseconds); +/** + * Optional board-level callback function called prior to initiating chip-level + * hibernate sequence. This function may or may not return, depending if the + * board implements an alternate hibernate method. + */ +void board_hibernate(void) __attribute__((weak)); + /* Minimum duration to get proper hibernation */ #define SYSTEM_HIB_MINIMUM_DURATION 0, 150000 diff --git a/power/braswell.c b/power/braswell.c index 22659f5309..8086dcb5a1 100644 --- a/power/braswell.c +++ b/power/braswell.c @@ -340,6 +340,11 @@ enum power_state power_handle_state(enum power_state state) } #ifdef CONFIG_LOW_POWER_PSEUDO_G3 +void board_hibernate(void) +{ + enter_pseudo_g3(); +} + void enter_pseudo_g3(void) { CPRINTS("Enter Psuedo G3"); |