diff options
author | Duncan Laurie <dlaurie@google.com> | 2017-05-16 07:40:47 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-05-18 18:07:29 -0700 |
commit | a457573b0c588d617f4792680112182855e1dea3 (patch) | |
tree | 227f8efa7a2ab8e40c307539cfa5762d0da02171 | |
parent | a082274af650d95bfc2d016b643d128e15b8cead (diff) | |
download | chrome-ec-a457573b0c588d617f4792680112182855e1dea3.tar.gz |
eve: Shut down PMIC in hibernate
Instead of using EC hibernate shut down the PMIC over I2C.
This will turn off the DSW rail and the EC completely. The existing
wake sources are still able to wake the system.
BUG=b:35647896
BRANCH=none
TEST=manual testing on Eve board to ensure that wake sources that
are expected to wake from G3 are still functional. (AC, power, lid)
Change-Id: I91b14ec360190176dba0a8e7c458b2b0ab5b6dcd
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/506719
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
-rw-r--r-- | board/eve/board.c | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/board/eve/board.c b/board/eve/board.c index d9f99fa7aa..aed81eccbb 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -644,38 +644,6 @@ static void board_lid_change(void) } DECLARE_HOOK(HOOK_LID_CHANGE, board_lid_change, HOOK_PRIO_DEFAULT); -void board_hibernate_late(void) -{ - int i; - const uint32_t hibernate_pins[][2] = { - {GPIO_LID_OPEN, GPIO_INT_RISING}, - /* - * BD99956 handles charge input automatically. We'll disable - * charge output in hibernate. Charger will assert ACOK_OD - * when VBUS or VCC are plugged in. - */ - {GPIO_USB_C0_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN}, - {GPIO_USB_C1_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN}, - }; - - /* Change GPIOs' state in hibernate for better power consumption */ - for (i = 0; i < ARRAY_SIZE(hibernate_pins); ++i) - gpio_set_flags(hibernate_pins[i][0], hibernate_pins[i][1]); - - gpio_config_module(MODULE_KEYBOARD_SCAN, 0); - - /* - * Calling gpio_config_module sets disabled alternate function pins to - * GPIO_INPUT. But to prevent keypresses causing leakage currents - * while hibernating we want to enable GPIO_PULL_UP as well. - */ - gpio_set_flags_by_mask(0x2, 0x03, GPIO_INPUT | GPIO_PULL_UP); - gpio_set_flags_by_mask(0x1, 0x7F, GPIO_INPUT | GPIO_PULL_UP); - gpio_set_flags_by_mask(0x0, 0xE0, GPIO_INPUT | GPIO_PULL_UP); - /* KBD_KS02 needs to have a pull-down enabled to match cr50 */ - gpio_set_flags_by_mask(0x1, 0x80, GPIO_INPUT | GPIO_PULL_DOWN); -} - void board_hibernate(void) { /* Enable both the VBUS & VCC ports before entering PG3 */ @@ -683,6 +651,22 @@ void board_hibernate(void) /* Turn BGATE OFF for power saving */ bd9995x_set_power_save_mode(BD9995X_PWR_SAVE_MAX); + + /* Shut down PMIC */ + CPRINTS("Triggering PMIC shutdown"); + uart_flush_output(); + if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992, 0x49, 0x01)) { + /* + * If we can't tell the PMIC to shutdown, instead reset + * and don't start the AP. Hopefully we'll be able to + * communicate with the PMIC next time. + */ + CPRINTS("PMIC I2C failed"); + uart_flush_output(); + system_reset(SYSTEM_RESET_LEAVE_AP_OFF); + } + while (1) + ; } static int gpio_get_ternary(enum gpio_signal gpio) |