From 6c7b7fdd7ab2144968ec6db7a9122dae875211ad Mon Sep 17 00:00:00 2001 From: Mike Lee Date: Wed, 30 Jun 2021 16:34:49 +0800 Subject: blipper: disable charger ADC function at Z-state In order to reduce the power consumption of Z-state, we need disable charger ADC function at Z-state, and we use HW solution to solve AC cannot wake up Z-state issue. BUG=b:186717219 BRANCH=dedede TEST=EE verify the power consumption ok,and AC can wakeup Z-state at rework duts Signed-off-by: Mike Lee Change-Id: I674f0b73d0b593ea88973aa5b8b3447bd34b81ed Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2994881 Reviewed-by: Weimin Wu Reviewed-by: Aseda Aboagye Commit-Queue: Aseda Aboagye --- board/blipper/board.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/board/blipper/board.c b/board/blipper/board.c index 1c3ad144b9..e26b3d4d51 100644 --- a/board/blipper/board.c +++ b/board/blipper/board.c @@ -7,6 +7,7 @@ #include "adc_chip.h" #include "button.h" +#include "cros_board_info.h" #include "charge_manager.h" #include "charge_state_v2.h" #include "charger.h" @@ -90,15 +91,6 @@ static void c0_ccsbu_ovp_interrupt(enum gpio_signal s) pd_handle_cc_overvoltage(0); } -void board_hibernate(void) -{ - /* - * Charger IC need to be put into their "low power mode" before - * entering the Z-state. - */ - raa489000_hibernate(0, false); -} - /* Must come after other header files and interrupt handler declarations */ #include "gpio_list.h" @@ -204,6 +196,8 @@ const int usb_port_enable[USB_PORT_COUNT] = { GPIO_EN_USB_A0_VBUS }; +static uint32_t board_id; + void board_init(void) { gpio_enable_interrupt(GPIO_USB_C0_INT_ODL); @@ -227,9 +221,27 @@ void board_init(void) keyscan_config.actual_key_mask[12] = 0xff; keyscan_config.actual_key_mask[13] = 0xff; keyscan_config.actual_key_mask[14] = 0xff; + + cbi_get_board_version(&board_id); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); +void board_hibernate(void) +{ + /* + * Charger IC need to be put into their "low power mode" before + * entering the Z-state. + * + * b:186717219: In order to solve the power consumption problem of + * hibernate,HW solution is adopted after board id 3 to solve the + * problem that AC cannot wake up hibernate mode. + */ + if (board_id > 2) + raa489000_hibernate(0, true); + else + raa489000_hibernate(0, false); +} + __override void board_pulse_entering_rw(void) { /* -- cgit v1.2.1