summaryrefslogtreecommitdiff
path: root/board/samus_pd/usb_pd_policy.c
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-10-23 17:31:21 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-25 08:14:26 +0000
commita08c2d579e099580c033f99e56b2130ff8383a97 (patch)
tree10509356b05ba5edf1960d82b6ea6e72e406f025 /board/samus_pd/usb_pd_policy.c
parenta019bf585393ba02ba24949b1ca4d99253a42d13 (diff)
downloadchrome-ec-a08c2d579e099580c033f99e56b2130ff8383a97.tar.gz
pd: for DP mode, only enter mode if device is DFP_U capable
Added return parameter to enter mode functions. For DP mode on samus and fruitpie, only send enter mode if device is a DP sink (DFP_U). BUG=none BRANCH=samus TEST=make buildall. tested a simpler version of this with a third-party DFP_D capable device and verified we don't send enter mode. Change-Id: I5caf008b7b3711232aeb1a1012cde2022584109b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225288 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/samus_pd/usb_pd_policy.c')
-rw-r--r--board/samus_pd/usb_pd_policy.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c
index 507c6d3bce..ea297b8c13 100644
--- a/board/samus_pd/usb_pd_policy.c
+++ b/board/samus_pd/usb_pd_policy.c
@@ -243,9 +243,15 @@ static void svdm_safe_dp_mode(int port)
board_set_usb_mux(port, TYPEC_MUX_NONE, pd_get_polarity(port));
}
-static void svdm_enter_dp_mode(int port, uint32_t mode_caps)
+static int svdm_enter_dp_mode(int port, uint32_t mode_caps)
{
- svdm_safe_dp_mode(port);
+ /* Only enter mode if device is DFP_D capable */
+ if (mode_caps & MODE_DP_SNK) {
+ svdm_safe_dp_mode(port);
+ return 0;
+ }
+
+ return -1;
}
static int dp_on;