summaryrefslogtreecommitdiff
path: root/test/sbs_charging_v2.c
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2014-04-02 20:51:52 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-04-05 01:42:05 +0000
commit3e1db94ea03e43c37a165a5dd2f1693a54dbfefd (patch)
tree39a4abb67d8bf566adc4e924ab5c1cf128af0856 /test/sbs_charging_v2.c
parentfe84900c6faa281067212ba6c2c4f564f5d0fe34 (diff)
downloadchrome-ec-3e1db94ea03e43c37a165a5dd2f1693a54dbfefd.tar.gz
Samus: Workaround for flaky battery temp reading
Sometimes the battery happily reports that it's current temperature is 6280C, which is just a little bit high. This just treats unreasonably high temperatures as an error. BUG=chrome-os-partner:27527 BRANCH=ToT TEST=manual Make the change, watch the EC console while the AP is running and the battery charges and discharges. The problem is intermittent, but when it occurs it shuts the AP down immediately. With this change, it just prints a warning instead. I've also added a check for this to test/sbs_charging_v2.c Change-Id: Ibfa53cf0244499ec52d4887bcd06fb9126c07a6c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193277 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'test/sbs_charging_v2.c')
-rw-r--r--test/sbs_charging_v2.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/sbs_charging_v2.c b/test/sbs_charging_v2.c
index feedcb117b..69777042a3 100644
--- a/test/sbs_charging_v2.c
+++ b/test/sbs_charging_v2.c
@@ -116,6 +116,18 @@ static int test_charge_state(void)
state = wait_charging_state();
TEST_ASSERT(state == PWR_STATE_DISCHARGE);
+ /* Discharging waaaay overtemp is ignored */
+ ccprintf("[CHARGING TEST] AC off, batt temp = 0xffff\n");
+ gpio_set_level(GPIO_AC_PRESENT, 0);
+ sb_write(SB_CURRENT, -1000);
+ state = wait_charging_state();
+ TEST_ASSERT(state == PWR_STATE_DISCHARGE);
+ sb_write(SB_TEMPERATURE, 0xffff);
+ state = wait_charging_state();
+ TEST_ASSERT(!is_shutdown);
+ TEST_ASSERT(state == PWR_STATE_DISCHARGE);
+ sb_write(SB_TEMPERATURE, CELSIUS_TO_DECI_KELVIN(40));
+
/* Discharging overtemp */
ccprintf("[CHARGING TEST] AC off, batt temp = 90 C\n");
gpio_set_level(GPIO_AC_PRESENT, 0);