summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2022-03-10 17:27:32 +0000
committerCommit Bot <commit-bot@chromium.org>2022-03-17 18:08:24 +0000
commit2f71febc7988bd5c3427995ccb2feefed4edf7ed (patch)
treeef0e163e3a9ba58708a00ead145f9ac140954449
parent31c4d3f48ed907f1d4a6020e05a7a41fc2d06dce (diff)
downloadchrome-ec-firmware-volteer-13521.B-master.tar.gz
battery: Set EC_BATT_FLAG_INVALID_DATA correctlyfirmware-volteer-13521.B-master
There is a typo in the logic where EC_BATT_FLAG_INVALID_DATA is set. Because of this, currently, EC_BATT_FLAG_INVALID_DATA is reported to the host only if BATT_FLAG_BAD_CURRENT is set. BATT_FLAG_BAD_CURRENT happens to be 0x20 which is equal to EC_BATT_FLAG_INVALID_DATA. (This originates from I3c428c850020a29b3f452504b60b52946a04c503.) This patch corrects the logic by changing EC_BATT_FLAG_INVALID_DATA to BATT_FLAG_BAD_ANY. BUG=b:65697962,b:65697620 BRANCH=None TEST=None Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I7504932f078ce797daf8e5c017b7835c90220a99 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3516912 Reviewed-by: caveh jalali <caveh@chromium.org> (cherry picked from commit 550f6384d82a563d85248d8a740931257b11250c) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3533720 Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--common/charge_state_v2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 4bb6eb947a..b24a6b6119 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -832,7 +832,7 @@ static void update_dynamic_battery_info(void)
batt_present = 0;
}
- if (curr.batt.flags & EC_BATT_FLAG_INVALID_DATA)
+ if (curr.batt.flags & BATT_FLAG_BAD_ANY)
tmp |= EC_BATT_FLAG_INVALID_DATA;
if (!(curr.batt.flags & BATT_FLAG_BAD_VOLTAGE))
@@ -978,7 +978,7 @@ static void update_dynamic_battery_info(void)
batt_present = 0;
}
- if (curr.batt.flags & EC_BATT_FLAG_INVALID_DATA)
+ if (curr.batt.flags & BATT_FLAG_BAD_ANY)
tmp |= EC_BATT_FLAG_INVALID_DATA;
if (!(curr.batt.flags & BATT_FLAG_BAD_VOLTAGE))