From 88e64e11e19be5284ce77fb1afab1dae48970a50 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Wed, 27 Jan 2016 16:12:43 -0800 Subject: chell: Trigger PMIC shutdown rather than hibernate Shut down all PMIC-supplied power rails rather than initiating EC / PD hibernate. This results in considerable power savings. BUG=chrome-os-partner:48835 BRANCH=glados TEST=Manual on chell. Run "hibernate" on EC console, verify that 3.3V EC DSW rail goes to 0V, and the EC powers up on zinger insert, lid open or power button press. Signed-off-by: Shawn Nematbakhsh Change-Id: I7bf0c494ea240183240f5a6abc3d611df8efb45a Reviewed-on: https://chromium-review.googlesource.com/324087 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Vincent Palatin --- board/chell/board.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/board/chell/board.c b/board/chell/board.c index b05926bb50..759521eeb9 100644 --- a/board/chell/board.c +++ b/board/chell/board.c @@ -369,17 +369,25 @@ static void board_chipset_suspend(void) } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT); -void board_set_gpio_hibernate_state(void) +void board_hibernate(void) { - /* Turn off LEDs in hibernate */ - gpio_set_level(GPIO_CHARGE_LED_1, 0); - gpio_set_level(GPIO_CHARGE_LED_2, 0); + 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); + } - /* - * Set PD wake low so that it toggles high to generate a wake - * event once we leave hibernate. - */ - gpio_set_level(GPIO_USB_PD_WAKE, 0); + /* Await shutdown. */ + while (1) + ; } /* Make the pmic re-sequence the power rails under these conditions. */ -- cgit v1.2.1