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>
This commit is contained in:
Vincent Palatin
2015-09-18 09:15:25 -07:00
committed by chrome-bot
parent bde89ebc20
commit 03f11f6549

View File

@@ -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)