summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-01-20 11:48:23 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-21 05:05:53 +0000
commit9e07dfb6cb7391844dfd56ba856b30329318f05e (patch)
treee8f77f7bd8b17ad8c810a41fc1b919e9f22d3ebe /common
parent43806f07e35de0ab9b27774e2f27841a78a2c527 (diff)
downloadchrome-ec-9e07dfb6cb7391844dfd56ba856b30329318f05e.tar.gz
pd: export the data role to the AP
For dual-role USB ports (host/device), let the AP know whether we are currently DFP (USB host) or UFP (USB device) by exporting the data role in addition to the power role in the EC_CMD_USB_PD_CONTROL response. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=none TEST=ectool --name=cros_pd usbpd 0 plug various accessories on the port and see properly "SRC DFP" for the USB key, "SNK DFP" for the power supply and "SNK UFP" for a regular C-to-A charging cable. Change-Id: I292da15fa8cf3566109dd05995ef1d00bed6f92d Reviewed-on: https://chromium-review.googlesource.com/242012 Reviewed-by: Alec Berg <alecaberg@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usb_pd_protocol.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index bc662abb77..57ad53054d 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -3255,7 +3255,8 @@ static int hc_usb_pd_control(struct host_cmd_handler_args *args)
args->response_size = sizeof(*r);
} else {
r_v1->enabled = pd_comm_enabled;
- r_v1->role = pd[p->port].power_role;
+ r_v1->role = pd[p->port].power_role |
+ (pd[p->port].data_role << 1);
r_v1->polarity = pd[p->port].polarity;
strzcpy(r_v1->state,
pd_state_names[pd[p->port].task_state],