summaryrefslogtreecommitdiff
path: root/test/sbs_charging_v2.c
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-12-09 17:28:25 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-15 19:53:46 +0000
commit6cc992c3d703ecee5e44966a2a3f6580e85b60c3 (patch)
treeaecb12c5e2cd96e1dd30ad1d00542aea0d8921bb /test/sbs_charging_v2.c
parent0777ebaef6ea1017b897cde65b2a9d1a39570089 (diff)
downloadchrome-ec-6cc992c3d703ecee5e44966a2a3f6580e85b60c3.tar.gz
samus: fix charge state machine's handling of low power chargers
On samus it is possible to have AC plugged in but have the battery discharging. So, add a new variable to charge state machine for battery charging status and use that where necessary. For example, the low battery shutdown code should now be based on whether or not battery is charging rather than if AC is present. This also changes the hibernate behavior when battery is low. The change is to wait 30 seconds in G3 of low battery with no charging before hibernating because for some chargers, like a USB PD charger, the charger may increase it's current limit after a little bit of time. BUG=chrome-os-partner:34485 BRANCH=samus TEST=test on samus. use low power charger and make sure that ectool battery shows the "DISCHARGING" flag. use zinger and see "CHARGING" flag. also use power_supply_info to make sure that the battery state accurately reflects reality. Change-Id: I8ac0267dd393071c4ca1fa24fbc9a13bf27848a9 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/235491 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'test/sbs_charging_v2.c')
-rw-r--r--test/sbs_charging_v2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/sbs_charging_v2.c b/test/sbs_charging_v2.c
index 31dfb34e25..bb15a8d18b 100644
--- a/test/sbs_charging_v2.c
+++ b/test/sbs_charging_v2.c
@@ -285,6 +285,8 @@ static int test_low_battery(void)
mock_chipset_state = CHIPSET_STATE_SOFT_OFF;
hook_notify(HOOK_CHIPSET_SHUTDOWN);
wait_charging_state();
+ /* after a while, the EC should hibernate */
+ sleep(LOW_BATTERY_SHUTDOWN_TIMEOUT);
TEST_ASSERT(is_hibernated);
ccprintf("[CHARGING TEST] Low battery shutdown S5\n");
@@ -293,6 +295,8 @@ static int test_low_battery(void)
wait_charging_state();
sb_write(SB_RELATIVE_STATE_OF_CHARGE, 2);
wait_charging_state();
+ /* after a while, the EC should hibernate */
+ sleep(LOW_BATTERY_SHUTDOWN_TIMEOUT);
TEST_ASSERT(is_hibernated);
ccprintf("[CHARGING TEST] Low battery AP shutdown\n");