diff options
author | Alec Berg <alecaberg@chromium.org> | 2015-09-07 03:13:29 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-09-08 21:58:21 -0700 |
commit | 3963d3b77d380f29829456671d82ec0e5717f5f9 (patch) | |
tree | a37b03ec3a3a0c0fc7ab9319319eccc6e559af0c /test | |
parent | ebfdb59702f02dad5a7daae6b4a38f95a849cf9a (diff) | |
download | chrome-ec-3963d3b77d380f29829456671d82ec0e5717f5f9.tar.gz |
charge_manager: ensure we source power when not charging
Move asking for a power swap to become a source to happen
anytime we stop charging from a dual-role port. We used to
ask for a power swap when a dual-role override port was
cancelled, but with CONFIG_CHARGE_MANAGER_DRP_CHARGING we
can be charging from a dual-role port without having chosen
it as the override port, so this guarantees that we always
ask to become the source when we stop charging from a port.
BUG=chrome-os-partner:44958
BRANCH=smaug
TEST=build and run unit tests
Change-Id: I009178b479a4626888d11a9993c8738d928fbaf9
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/297880
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/charge_manager.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/test/charge_manager.c b/test/charge_manager.c index 756926609c..df569d957e 100644 --- a/test/charge_manager.c +++ b/test/charge_manager.c @@ -415,13 +415,19 @@ static int test_override(void) TEST_ASSERT(active_charge_limit == 100); /* - * Verify that an override request on a dual-role source port - * causes a role swap, and we charge from the port if the swap - * is successful. + * Verify that a don't charge override request on a dual-role + * port causes a swap to source. */ - charge_manager_set_override(OVERRIDE_DONT_CHARGE); + pd_set_role(0, PD_ROLE_SINK); charge_manager_update_dualrole(0, CAP_DUALROLE); - pd_set_role(0, PD_ROLE_SOURCE); + charge_manager_set_override(OVERRIDE_DONT_CHARGE); + wait_for_charge_manager_refresh(); + TEST_ASSERT(pd_get_role(0) == PD_ROLE_SOURCE); + + /* + * Verify that an override request to a dual-role source port + * causes a role swap to sink. + */ charge_manager_set_override(0); wait_for_charge_manager_refresh(); charge.current = 200; |