summaryrefslogtreecommitdiff
path: root/board/atlas
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2018-05-18 15:20:20 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-05-21 21:17:52 -0700
commit2eb29bb25fc2de1be45eb24c5678664b82a1dabf (patch)
tree1369552ce005b58f268f2d794047b72369e99080 /board/atlas
parenta93ed9b9aa51736ce48fd4bee5cf7b3bae346855 (diff)
downloadchrome-ec-2eb29bb25fc2de1be45eb24c5678664b82a1dabf.tar.gz
atlas: ignore unavailable battery temp readings
the battery temperature field is only valid after we've actually managed to read the battery temperatore parameter. so, if the temp field is marked "BAD", don't even look at it. this addresses a case where we were removing charge current during the precharge phase - basically removing charge current from a battery that we're trying to power so we can talk to its I2C controller. BUG=b:79354967 BRANCH=none TEST=instrumented code to verify we don't request 0 amps in ST_PRECHARGE Change-Id: I3b40903506fa949c14ecaf577f134f31cfcf8fb7 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1066789 Commit-Ready: Caveh Jalali <caveh@google.com> Tested-by: Caveh Jalali <caveh@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'board/atlas')
-rw-r--r--board/atlas/battery.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/board/atlas/battery.c b/board/atlas/battery.c
index d764367d0c..dd9cde9d5c 100644
--- a/board/atlas/battery.c
+++ b/board/atlas/battery.c
@@ -160,8 +160,12 @@ int charger_profile_override(struct charge_state_data *curr)
{
const struct battery_info *batt_info;
/* battery temp in 0.1 deg C */
- int bat_temp_c = curr->batt.temperature - 2731;
+ int bat_temp_c;
+ if (curr->batt.flags & BATT_FLAG_BAD_TEMPERATURE)
+ return 0;
+
+ bat_temp_c = curr->batt.temperature - 2731;
batt_info = battery_get_info();
/* Don't charge if outside of allowable temperature range */
if (bat_temp_c >= batt_info->charging_max_c * 10 ||