diff options
author | Scott Collyer <scollyer@google.com> | 2017-10-06 08:19:24 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-05 17:14:35 +0000 |
commit | a934740c0703d3e33848361a743cf249dd0e3435 (patch) | |
tree | 95442e16c3e37fe5ed3c650daf8544ab4d50d2f3 | |
parent | 77d42f15067217d6ac46bc31cb0bbc6bb18386fd (diff) | |
download | chrome-ec-a934740c0703d3e33848361a743cf249dd0e3435.tar.gz |
eve: Make BATTERY_DISCONNECTED depend only on XDSG
The battery_check_disconnect() function was checking for both XCGH and
XDSG to be set before returning BATTERY_DISCONNECTED. This works
consistently when recovering from a battery cutoff when issued via a
I2C command. However, if the battery cutoff was initiated due to a
cell under voltage (CUV) trip, only the discharge FET will be
disabled. When an external charger is connected, the battery may not
be able to recover if the CUV event happened while SOC > 3%.
By modifying the battery_check_disconnected to look only at XDSG then
the normal battery cutoff and CUV triggered cutoff are recovered
properly when an external charger is connected.
BUG=b:67332823
BRANCH=eve
TEST=Had two different units where I was able to confirm that a CUV
event had happened. I obsereved that the system would brown out when
the AP was powered up, preventing the EC from being able to charge the
battery to get out of the CUV condition. Once I loaded FW that only
checked XDSG, then verified that the AP was not powered on and the
battery was able to be charged by the EC.
Change-Id: I893cfcdd4123810137e2d09a15256d51c918b38b
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/705055
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
Commit-Queue: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2320262
Commit-Queue: Patryk Duda <pdk@semihalf.com>
Tested-by: Patryk Duda <pdk@semihalf.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | board/eve/battery.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/board/eve/battery.c b/board/eve/battery.c index 4064c85c71..11f85cc47c 100644 --- a/board/eve/battery.c +++ b/board/eve/battery.c @@ -271,7 +271,7 @@ static void battery_now_present(void) DECLARE_DEFERRED(battery_now_present); /* - * Check for case where both XCHG and XDSG bits are set indicating that even + * Check for case where XDSG bit is set indicating that even * though the FG can be read from the battery, the battery is not able to be * charged or discharged. This situation will happen if a battery disconnect was * intiaited via H1 setting the DISCONN signal to the battery. This will put the @@ -287,15 +287,13 @@ static int battery_check_disconnect(void) int rv; uint8_t data[6]; - /* Check if battery charging + discharging is disabled. */ + /* Check if battery discharging is disabled. */ rv = sb_read_mfgacc(PARAM_OPERATION_STATUS, SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data)); if (rv) return BATTERY_DISCONNECT_ERROR; - if ((data[3] & (BATTERY_DISCHARGING_DISABLED | - BATTERY_CHARGING_DISABLED)) == - (BATTERY_DISCHARGING_DISABLED | BATTERY_CHARGING_DISABLED)) + if (data[3] & BATTERY_DISCHARGING_DISABLED) return BATTERY_DISCONNECTED; return BATTERY_NOT_DISCONNECTED; |