diff options
author | Diana Z <dzigterman@chromium.org> | 2019-04-25 14:20:47 -0600 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-05-02 21:02:38 -0700 |
commit | 930955f202feb3cee2cf0df7e69ed91e1d4b3c5f (patch) | |
tree | b2ee4fa9697bbaa4c9e5ce3141fb194edb0337a0 /baseboard/octopus | |
parent | b7a7ad3ffc436fc074c79b62194c33980e746586 (diff) | |
download | chrome-ec-930955f202feb3cee2cf0df7e69ed91e1d4b3c5f.tar.gz |
Octopus: Allow power role swap to sink in S0ix
Currently, if a hub is plugged in during S0 and a system is suspended to
S0ix, we will reject any requests from that hub to power role swap if it
becomes powered (note this is not a concern for S5, when we will
disconnect a sinking partner, so on becoming powered the hub would start
a new connection).
This change allows role swaps if we are currently sourcing a partner who
could be providing us power instead.
BUG=b:131267739
BRANCH=octopus
TEST=plugged in unpowered 3-in-1 dongle to casta in S0, closed the lid
to trigger S0ix, plugged in power to the dongle and saw power role swap
was accepted
Change-Id: I1a25372c681a06681abb28c58b96f73e9416404e
Signed-off-by: Diana Z <dzigterman@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1585121
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'baseboard/octopus')
-rw-r--r-- | baseboard/octopus/usb_pd_policy.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/baseboard/octopus/usb_pd_policy.c b/baseboard/octopus/usb_pd_policy.c index 572b9fcdc5..554c625387 100644 --- a/baseboard/octopus/usb_pd_policy.c +++ b/baseboard/octopus/usb_pd_policy.c @@ -61,11 +61,16 @@ void pd_check_dr_role(int port, int dr_role, int flags) int pd_check_power_swap(int port) { /* - * Allow power swap as long as we are acting as a dual role device, - * otherwise assume our role is fixed (not in S0 or console command - * to fix our role). + * Allow power swap if we are acting as a dual role device. If we are + * not acting as dual role (ex. suspended), then only allow power swap + * if we are sourcing when we could be sinking. */ - return pd_get_dual_role(port) == PD_DRP_TOGGLE_ON ? 1 : 0; + if (pd_get_dual_role(port) == PD_DRP_TOGGLE_ON) + return 1; + else if (pd_get_role(port) == PD_ROLE_SOURCE) + return 1; + + return 0; } void pd_check_pr_role(int port, int pr_role, int flags) |