diff options
author | Scott Chao <scott_chao@wistron.corp-partner.google.com> | 2020-09-14 17:24:41 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-21 19:13:57 +0000 |
commit | c6e2ac5ba87352505985c6f374c142fa6189b5ac (patch) | |
tree | ddbcfe88825a600ac79af706033c64de532dbbe5 /baseboard/volteer | |
parent | db78abe0160364bf075e1595850407dfdd182297 (diff) | |
download | chrome-ec-c6e2ac5ba87352505985c6f374c142fa6189b5ac.tar.gz |
eldrid: fix battery cutoff
Eldrid's battery need to apply charging voltage input>3V
and aleast 2 sec to let C/D FET will turn on.
So add board_battery_is_initialized to check battery initialization.
And try to provide pre-charge current to battery
when battery have no response.
BUG=b:165780074
BRANCH=none
TEST=make -j BOARD=eldrid
TEST=make buildall
Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com>
Change-Id: I4265538b5a789b76a85d21a1459d19142a86106e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2409712
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'baseboard/volteer')
-rw-r--r-- | baseboard/volteer/baseboard.h | 9 | ||||
-rw-r--r-- | baseboard/volteer/battery_presence.c | 19 |
2 files changed, 28 insertions, 0 deletions
diff --git a/baseboard/volteer/baseboard.h b/baseboard/volteer/baseboard.h index b4d0645e3b..004e85bcae 100644 --- a/baseboard/volteer/baseboard.h +++ b/baseboard/volteer/baseboard.h @@ -8,6 +8,8 @@ #ifndef __CROS_EC_BASEBOARD_H #define __CROS_EC_BASEBOARD_H +#include <stdbool.h> + /* * By default, enable all console messages excepted HC */ @@ -266,6 +268,13 @@ unsigned char get_board_id(void); */ __override_proto void board_cbi_init(void); +/* + * Check battery disconnect state. + * This function will return if battery is initialized or not. + * @return true - initialized. false - not. + */ +__override_proto bool board_battery_is_initialized(void); + #endif /* !__ASSEMBLER__ */ #endif /* __CROS_EC_BASEBOARD_H */ diff --git a/baseboard/volteer/battery_presence.c b/baseboard/volteer/battery_presence.c index 0d6590011f..4953d7a49e 100644 --- a/baseboard/volteer/battery_presence.c +++ b/baseboard/volteer/battery_presence.c @@ -28,12 +28,21 @@ static bool battery_init(void) !!(batt_status & STATUS_INITIALIZED); } +__overridable bool board_battery_is_initialized(void) +{ + /* + * Set default to return true + */ + return true; +} + /* * Physical detection of battery. */ static enum battery_present battery_check_present_status(void) { enum battery_present batt_pres; + bool batt_initialization_state; /* Get the physical hardware status */ batt_pres = battery_hw_present(); @@ -53,6 +62,16 @@ static enum battery_present battery_check_present_status(void) return batt_pres; /* + * Check battery initialization. If the battery is not initialized, + * then return BP_NOT_SURE. Battery could be in ship + * mode and might require pre-charge current to wake it up. BP_NO is not + * returned here because charger state machine will not provide + * pre-charge current assuming that battery is not present. + */ + batt_initialization_state = board_battery_is_initialized(); + if (!batt_initialization_state) + return BP_NOT_SURE; + /* * Ensure that battery is: * 1. Not in cutoff * 2. Initialized |