summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-01-06 17:58:30 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-08 01:46:48 +0000
commit55c3456b52e7ed6a8f35c1dec3b5b0036239e8eb (patch)
treed819260336063a3b6289c44c3f9a69e4f4fccede
parentcca794d2fec61133f09b6e1cc6816392f11e15cb (diff)
downloadchrome-ec-55c3456b52e7ed6a8f35c1dec3b5b0036239e8eb.tar.gz
samus: pd: reject power swap if not in dual-role mode
Samus should reject request for a power swap if it is not in a dual-role mode, for instance if in S3 or lower. BUG=chrome-os-partner:35141 BRANCH=samus TEST=load on two samus'. turn on samus off, then request a power swap from the samus that is on and see that it is rejected. Change-Id: Ifb23febac967c981251c3932856e1e942818694f Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238963 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/samus_pd/usb_pd_policy.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c
index f767a1d7cf..8ba4d7a327 100644
--- a/board/samus_pd/usb_pd_policy.c
+++ b/board/samus_pd/usb_pd_policy.c
@@ -123,8 +123,12 @@ int pd_board_checks(void)
int pd_check_power_swap(int port)
{
/* TODO: use battery level to decide to accept/reject power swap */
- /* Always allow power swap */
- return 1;
+ /*
+ * 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).
+ */
+ return pd_get_dual_role() == PD_DRP_TOGGLE_ON ? 1 : 0;
}
int pd_check_data_swap(int port, int data_role)