diff options
author | Diana Z <dzigterman@chromium.org> | 2019-04-25 14:20:47 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-01 18:38:16 +0000 |
commit | 8006bf797e1b85d34dc4ceffc0f5db9f6f03fce5 (patch) | |
tree | ae11f5f3c5420659c28e5c04873b337b59720653 | |
parent | 123a2fd4e49342d8925117b8339af6c3fc3768a3 (diff) | |
download | chrome-ec-8006bf797e1b85d34dc4ceffc0f5db9f6f03fce5.tar.gz |
Nami: 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:143572158
BRANCH=nami
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
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: I76eea8d74df1b827ae39d54392627e90db0d6a95
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1894766
-rw-r--r-- | board/nami/usb_pd_policy.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/board/nami/usb_pd_policy.c b/board/nami/usb_pd_policy.c index 65baa5b6cf..294cc9e159 100644 --- a/board/nami/usb_pd_policy.c +++ b/board/nami/usb_pd_policy.c @@ -135,11 +135,16 @@ int pd_board_checks(void) 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; } int pd_check_data_swap(int port, int data_role) |