diff options
author | Shobhit Srivastava <shobhit.srivastava@intel.com> | 2017-02-23 11:46:58 +0530 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-02-23 16:02:04 -0800 |
commit | 6d9dd9502e1ed28e12a64e68dea5b4960f1bd105 (patch) | |
tree | 644ba5e45de50256be81276fce76cd2d53ebea34 | |
parent | f07d03dcb13dd18b72b2c95170175a82c03d69dc (diff) | |
download | chrome-ec-6d9dd9502e1ed28e12a64e68dea5b4960f1bd105.tar.gz |
Poppy: Enable board hibernate functionality
This patch implements the board_hibernate() function for
poppy. When running on battery only and in G3 state, the board
should transition into PG3 after CONFIG_HIBERNATE_DELAY_SEC
BRANCH=none
BUG=chrome-os-partner:61098
TEST=Disconnect AC. Use hibernate command from EC console to put
system into hibernate. Wake up the system from hibernate using
power button press or AC insert. Alternatively Use hibdelay command
to specify the hibernate wait timeout. Put the system into G3.
After hibdelay seconds the board should hibernate.
Change-Id: Ie0fc10ad60f15d6f40cf46bbe8b6dc9493c19e79
Signed-off-by: Shobhit Srivastava <shobhit.srivastava@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/446242
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r-- | board/poppy/board.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/board/poppy/board.c b/board/poppy/board.c index b31309f254..8767033f32 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -557,7 +557,26 @@ int board_is_consuming_full_charge(void) } -/* TODO(crosbug.com/p/61098): add board_hibernate[_late] functions as needed */ +void board_hibernate(void) +{ + CPRINTS("Triggering PMIC shutdown."); + uart_flush_output(); + + /* Trigger PMIC shutdown. */ + 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."); + system_reset(SYSTEM_RESET_LEAVE_AP_OFF); + } + + /* Await shutdown. */ + while (1) + ; +} /* Lid Sensor mutex */ static struct mutex g_lid_mutex; |