summaryrefslogtreecommitdiff
path: root/common/usb_pd_protocol.c
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2020-01-03 11:02:31 -0800
committerCommit Bot <commit-bot@chromium.org>2020-01-07 03:49:55 +0000
commit32266fc1d08a7fdfb6dc018ae8b21f741d01325d (patch)
treea6eaa0d8e708342b81d7a00bfbabf8f8fc746f2b /common/usb_pd_protocol.c
parentfa18c654e2f39e373f5e209ac9751082e4ae56a1 (diff)
downloadchrome-ec-32266fc1d08a7fdfb6dc018ae8b21f741d01325d.tar.gz
usb_pd: Set RDO flags correctly for communication capable PD devices
Setting the RDO flags correctly for communication capable PD devices. Ref: USB Power Delivery Specification (Revision 3.0, Version 2.0 / Revision 2.0, Version 1.3) 6.4.2.4 USB Communications Capable 6.4.2.5 No USB Suspend If the port partner is capable of USB communication set the USB Communications Capable flag. If the port partner is sink device do not suspend USB as the power can be used for charging. BUG=b:147134608 BRANCH=none TEST=TBT3 devices can enter into Thunderbolt-compatible mode Change-Id: If9010a4f6b1770415d386e03657e689c465bbaae Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1986883 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/usb_pd_protocol.c')
-rw-r--r--common/usb_pd_protocol.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index f0aaac259e..279dc465d2 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -1541,6 +1541,25 @@ static int pd_send_request_msg(int port, int always_send_request)
CPRINTF(" Mismatch");
CPRINTF("\n");
+ /*
+ * Ref: USB Power Delivery Specification
+ * (Revision 3.0, Version 2.0 / Revision 2.0, Version 1.3)
+ * 6.4.2.4 USB Communications Capable
+ * 6.4.2.5 No USB Suspend
+ *
+ * If the port partner is capable of USB communication set the
+ * USB Communications Capable flag.
+ * If the port partner is sink device do not suspend USB as the
+ * power can be used for charging.
+ *
+ * TODO (b/147249926): Move it to common code.
+ */
+ if (pd[port].flags & PD_FLAGS_PARTNER_USB_COMM) {
+ rdo |= RDO_COMM_CAP;
+ if (pd[port].power_role == PD_ROLE_SINK)
+ rdo |= RDO_NO_SUSPEND;
+ }
+
pd[port].curr_limit = curr_limit;
pd[port].supply_voltage = supply_voltage;
pd[port].prev_request_mv = supply_voltage;