summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-09-18 09:15:25 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-18 17:55:34 -0700
commit03f11f6549fd8a33ddf82aa7716997e27d636f23 (patch)
tree8bcba37e263172a609d42fac4a264223ee42f814
parentbde89ebc203d9d15ede2cefb3eea8511d1fc3b65 (diff)
downloadchrome-ec-03f11f6549fd8a33ddf82aa7716997e27d636f23.tar.gz
honeybuns: ensure we are always a data UFP
The dock hub upstream port is wired to the type-C captive cable, so we can only be a data UFP : - ensure we reject data swap request to become a DFP (e.g. from dual role devices preferring to be a UFP such as Ryu) - swap to data UFP at startup (we will start as data DFP since we are a power source only). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=connect Honeybuns to Ryu and see Ryu becoming a power sink and a data DFP all the time. Change-Id: I876536451a327e04df0a81d8217ef19963d204b6 Reviewed-on: https://chromium-review.googlesource.com/300952 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org>
-rw-r--r--board/honeybuns/usb_pd_policy.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/board/honeybuns/usb_pd_policy.c b/board/honeybuns/usb_pd_policy.c
index 65c056f102..5ba1347106 100644
--- a/board/honeybuns/usb_pd_policy.c
+++ b/board/honeybuns/usb_pd_policy.c
@@ -139,8 +139,11 @@ int pd_check_power_swap(int port)
int pd_check_data_swap(int port, int data_role)
{
- /* Always allow data swap */
- return 1;
+ /*
+ * Ensure we always are a UFP :
+ * Allow data swap if we are a DFP, otherwise don't allow.
+ */
+ return (data_role == PD_ROLE_DFP) ? 1 : 0;
}
void pd_execute_data_swap(int port, int data_role)
@@ -154,6 +157,9 @@ void pd_check_pr_role(int port, int pr_role, int flags)
void pd_check_dr_role(int port, int dr_role, int flags)
{
+ /* if the partner is a DRP (e.g. tablet), try to switch to UFP */
+ if ((flags & PD_FLAGS_PARTNER_DR_DATA) && dr_role == PD_ROLE_DFP)
+ pd_request_data_swap(port);
}
int pd_alt_mode(int port, uint16_t svid)