summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Chen <marcochen@chromium.org>2019-12-25 15:20:10 +0800
committerJustin TerAvest <teravest@chromium.org>2020-01-04 02:02:37 +0000
commita25fd9ccb9b38b2d81cf2027c3f081330c5e9c29 (patch)
tree9898b316b6a858008b30e133a89077862661bcbc
parenta202c79b41dc3451dc1867f799528042b93565c8 (diff)
downloadchrome-ec-a25fd9ccb9b38b2d81cf2027c3f081330c5e9c29.tar.gz
USB PD: Consider DFET of battery when refrain from snk_reset
CL:1565147 introduced a new clause to the SNK_DISCOVERY state to prevent reset timers from starting when a battery is reporting below a configured level, which indicates the point at which the battery is capable of withstanding the potential loss of Vbus. There is an another case of having good battery level but battery can't discharge due to the DFET status of fuel gauge so we need to consider it as well. BUG=b:146758440 BRANCH=octopus TEST=Verify on the DUT with bad battery which can report battery level correctly but DFET is disabled and can't be revived. Change-Id: Ia3f3d26625a054f631fdddc74065f2e829852989 Signed-off-by: Marco Chen <marcochen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1980406 Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r--common/usb_pd_protocol.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 460d2db2a4..f0aaac259e 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -2434,7 +2434,8 @@ static void pd_update_snk_reset(void)
int i;
int batt_soc = usb_get_battery_soc();
- if (batt_soc < CONFIG_USB_PD_RESET_MIN_BATT_SOC)
+ if (batt_soc < CONFIG_USB_PD_RESET_MIN_BATT_SOC ||
+ battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED)
return;
for (i = 0; i < board_get_usb_pd_port_count(); i++) {
@@ -4098,7 +4099,8 @@ void pd_task(void *u)
*/
int batt_soc = usb_get_battery_soc();
- if (batt_soc < CONFIG_USB_PD_RESET_MIN_BATT_SOC)
+ if (batt_soc < CONFIG_USB_PD_RESET_MIN_BATT_SOC ||
+ battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED)
pd[port].flags |=
PD_FLAGS_SNK_WAITING_BATT;
else