diff options
author | Sue Chen <sue.chen@quanta.corp-partner.google.com> | 2022-07-26 11:13:52 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-08-08 01:58:19 +0000 |
commit | 44f4798c7e9dd46d404862cf248d273783cfb662 (patch) | |
tree | 4bb29408e25d4fa6f4227e160dee681c03b58dcb /board/quackingstick | |
parent | bb8bd5abbb5865002d6d2cc1d36a0a85c4677179 (diff) | |
download | chrome-ec-44f4798c7e9dd46d404862cf248d273783cfb662.tar.gz |
Quackingstick: Move 2s delay time to battery_is_present
Remove the workaround 2s in HOOK_INIT for first boot.
Add 2s delay to battery_is_present() defined in board level.
BUG=b:231911921
BRANCH=trogdor
TEST=no power loss after the battery resume from cut off.
Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com>
Change-Id: Id0f8e5beeee2934b61e21d6602419c4ca29ef2de
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3787357
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'board/quackingstick')
-rw-r--r-- | board/quackingstick/board.c | 18 | ||||
-rw-r--r-- | board/quackingstick/board.h | 3 |
2 files changed, 14 insertions, 7 deletions
diff --git a/board/quackingstick/board.c b/board/quackingstick/board.c index 5b2a3a3f0f..1a44ab5a3d 100644 --- a/board/quackingstick/board.c +++ b/board/quackingstick/board.c @@ -434,21 +434,27 @@ void board_tcpc_init(void) } DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1); -void board_delay_on_first_power_on(void) +enum battery_present battery_is_present(void) { + static int first_check_done; + /* * b/231911921: It's found that the D-FET status is incorrect * when the battery resume from cut off. The battery needs * about 2s to ready to discharge so delay 2s before charge * manager init. */ - if (system_get_reset_flags() == EC_RESET_FLAG_POWER_ON) { - CPRINTS("Delay 2s on the first power on."); - sleep(2); + if (!first_check_done) { + if (battery_get_disconnect_state() == + BATTERY_NOT_DISCONNECTED) { + CPRINTS("Delay 2s on the first power on."); + sleep(2); + } + first_check_done = 1; } + + return gpio_get_level(GPIO_BATT_PRES_ODL) ? BP_NO : BP_YES; } -DECLARE_HOOK(HOOK_INIT, board_delay_on_first_power_on, - HOOK_PRIO_INIT_CHARGE_MANAGER - 1); void board_hibernate(void) { diff --git a/board/quackingstick/board.h b/board/quackingstick/board.h index 3e1bacc85c..40a93ab1c0 100644 --- a/board/quackingstick/board.h +++ b/board/quackingstick/board.h @@ -27,7 +27,8 @@ /* Battery */ #define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION" -#define CONFIG_BATTERY_REVIVE_DISCONNECT +#undef CONFIG_BATTERY_PRESENT_GPIO +#define CONFIG_BATTERY_PRESENT_CUSTOM #define CONFIG_BATTERY_FUEL_GAUGE #define CONFIG_BATTERY_VENDOR_PARAM |