summaryrefslogtreecommitdiff
path: root/common/battery.c
diff options
context:
space:
mode:
authorRobert Zieba <robertzieba@google.com>2023-03-30 02:40:43 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-30 16:46:19 +0000
commit665509933ec7c3913daf73d0d5564b8a86054121 (patch)
treec83c6950db8ab467d849e5adb39a13193889e090 /common/battery.c
parentd8596284c7df1d01afe9d42eff8d254043c7ae7d (diff)
downloadchrome-ec-665509933ec7c3913daf73d0d5564b8a86054121.tar.gz
common/battery: Add workaround for erroneous battery temperatures
Certain batteries appear to transiently return temperatures of 591.1K and 2151K. These values are clearly incorrect. Add a temporary workaround while the root cause is investigated. BRANCH=skyrim BUG=b:274812415 TEST=Ran suspend_stress_test with no battery temperature wakeups. Change-Id: I0c774a58770fa25907caf50aaf8d672a787addd3 Signed-off-by: Robert Zieba <robertzieba@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4383381 Commit-Queue: Isaac Lee <isaaclee@google.com> Tested-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Diffstat (limited to 'common/battery.c')
-rw-r--r--common/battery.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/common/battery.c b/common/battery.c
index 9e46cd8bbf..4a47991738 100644
--- a/common/battery.c
+++ b/common/battery.c
@@ -695,8 +695,12 @@ void battery_validate_params(struct batt_params *batt)
* anything above the boiling point of tungsten until this bug
* is fixed. If the battery is really that warm, we probably
* have more urgent problems.
+ * TODO(b/276000336). Some batteries occasionally give obviously
+ * incorrect results of 591.1K and 2151K, which are 318C and 1878C.
+ * Ignore these for now.
*/
- if (batt->temperature > CELSIUS_TO_DECI_KELVIN(5660)) {
+ if (batt->temperature > CELSIUS_TO_DECI_KELVIN(5660) ||
+ batt->temperature == 5911 || batt->temperature == 21510) {
CPRINTS("ignoring ridiculous batt.temp of %dC",
DECI_KELVIN_TO_CELSIUS(batt->temperature));
batt->flags |= BATT_FLAG_BAD_TEMPERATURE;