summaryrefslogtreecommitdiff
path: root/include/usb_prl_sm.h
diff options
context:
space:
mode:
authorPeter Marheine <pmarheine@chromium.org>2020-08-04 11:24:16 +1000
committerCommit Bot <commit-bot@chromium.org>2020-08-06 07:27:49 +0000
commit0385893469bad2c00690268d112436086fa69d1a (patch)
tree80f2a73e6933d8aa3c76b12172659348e42a71bc /include/usb_prl_sm.h
parentea334082eb7bcf690a54e2773ddaec2905075922 (diff)
downloadchrome-ec-0385893469bad2c00690268d112436086fa69d1a.tar.gz
usbc: correctly handle Get_Source_Cap as a sink
USB Power Delivery Specification Revision 3.0, version 2.0 section 6.3.7 states that a dual-role port shall respond to Get_Source_Cap with its source capabilities, but this was incorrectly handled by responding with a request for source capabilities. Per section 8.3.3.18.10, implement the PE_DR_SNK_Give_Source_Cap state to handle this correctly. To support the new test, some helper functions for the fake PE are added and the test code's copy of the PE state enum is updated to be in sync with the real one. BUG=b:161400825,b:161331630 TEST=New host test for this state, and verified on Dalboz that requesting a PRS via the EC console (`pd 1 swap power`) now sends source capabilities when the partner requests them. BRANCH=None Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: I87c27d406e0a3f57cf2c25fa583bee51155b6b12 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2336233 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'include/usb_prl_sm.h')
-rw-r--r--include/usb_prl_sm.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/usb_prl_sm.h b/include/usb_prl_sm.h
index 4b99d4c4c3..4f6f86e346 100644
--- a/include/usb_prl_sm.h
+++ b/include/usb_prl_sm.h
@@ -124,6 +124,17 @@ enum pd_ctrl_msg_type fake_prl_get_last_sent_ctrl_msg(int port);
* Fake to set the last sent control message to an invalid value.
*/
void fake_prl_clear_last_sent_ctrl_msg(int port);
+
+/**
+ * Get the type of the last sent data message on the given port.
+ */
+enum pd_data_msg_type fake_prl_get_last_sent_data_msg_type(int port);
+
+/**
+ * Clear the last sent data message on the given port to an invalid value,
+ * making it possible to check that two of the same message were sent in order.
+ */
+void fake_prl_clear_last_sent_data_msg(int port);
#endif
#endif /* __CROS_EC_USB_PRL_H */