summaryrefslogtreecommitdiff
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 17:46:21 +0000
commit2bfda581d537ef9a5065e08b672357e280f927db (patch)
tree44dbddb5845cee46c388e66cd65579dd9581d9de
parentb9563746a7d23ef5f4c2742d501aeedfa2de59e2 (diff)
downloadchrome-ec-2bfda581d537ef9a5065e08b672357e280f927db.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/+/4382556 Tested-by: Isaac Lee <isaaclee@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Tested-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Commit-Queue: Isaac Lee <isaaclee@google.com>
-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;