summaryrefslogtreecommitdiff
path: root/common
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 /common
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 'common')
-rw-r--r--common/usb_pd_policy.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index 87f6984c88..3149934d33 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -132,7 +132,9 @@ static int dfp_enter_mode(int port, uint32_t *payload)
if (!AMODE_VALID(port))
return 0;
- modep->fx->enter(port, modep->mode_caps);
+ if (modep->fx->enter(port, modep->mode_caps) == -1)
+ return 0;
+
payload[0] = VDO(modep->fx->svid, 1,
CMD_ENTER_MODE |
VDO_OPOS((modep->index + 1)));