summaryrefslogtreecommitdiff
path: root/test/usb_pe.h
Commit message (Collapse)AuthorAgeFilesLines
* TCPMv2: Remove PE_HANDLE_CUSTOM_VDMAbe Levkoy2022-10-051-1/+0
| | | | | | | | | | | | | | | | | | Remove support for handling unstructured VDMs from the Policy Engine. TCPMv2 boards do not actually support any unstructured VDMs, so the code is unused. BUG=b:250015035 TEST=make buildall BRANCH=none LOW_COVERAGE_REASON=See b:251211412. This test covers source code paths. Covering identical sink paths would be "trivial" but too tedious to justify right now. Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I5b5c14c14cd637ee74e66564658e920969ae19df Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3931178 Reviewed-by: Diana Z <dzigterman@chromium.org>
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* TCPMv2: Switch unit tests to use usb_pe_private.hCaveh Jalali2022-04-211-59/+0
| | | | | | | | | | | | | | | | | | | * API update: pe_*_flag() changes to pe_*_fn(). flags are now identified by number instead of bit mask. these are only used by unit tests. * update usb_pe unit tests to use the newly introduced usb_pe_private.h header file to avoid duplicate definitions. * usb_pe_drp_old_noextended.c should ideally also be updated like usb_pe_drp_old.c, but this file has not been part of the build for a long time and is very stale. BRANCH=none BUG=b:229655319,b:229942100 TEST=buildall passes, compare_builds passes. Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I46638436ca2cf9f38eadaa8336d31cb79cbfe189 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3591910 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Remove unused pe_[sg]et_all_flags functionsCaveh Jalali2022-04-191-2/+0
| | | | | | | | | | | | BRANCH=none BUG=b:229655319 TEST=buildall passes. compare_builds passes Change-Id: I1529f65d6385e046c40ff502ba65b1db6397eafd Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3591908 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* tcpmv2: always issue SOP' soft resetKeith Short2021-01-091-0/+1
| | | | | | | | | | | | | | | | | | | After entering a PD contract, always issue an SOP' soft reset before sending any discovery VDMs to the cable. BUG=b:172364575 BRANCH=volteer TEST=connect monitor with emarked cable, verify SOP' soft reset is sent when EC starts as SNK/DFP. TEST=Connect monitor with non-emark cable. Verify SOP' soft reset is sent once regardless of starting role. TEST=Connect USB4 dock, verify USB4 entry. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Id5026a2c8c9877b860e1356dd33763bad3e51841 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2596838 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Remove PE_BIST_RX stateAbe Levkoy2021-01-061-1/+0
| | | | | | | | | | | | | | Nothing uses this, and anyway, the EC doesn't have the means to evaluate the results of a BIST Carrier Mode test that it initiates. BUG=none TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I8aa0d97c81422689de4ca165cb2c0c34c324f6a2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2602719 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Store and report sink capsDiana Z2020-11-201-0/+1
| | | | | | | | | | | | | | | | | | | | | Copy sink caps for later reference, and report them up to the AP in the TYPEC_STATUS host command return. This also moves the location of the DPM set for sink caps, to be symmetrical between source and sink inits. Set the old unit tests to clear all DPM requests. New PE tests will correctly handle our startup sequence, but the old tests may have erratic behavior based on how many states run before the connection is forced over to READY. BRANCH=None BUG=b:160009733,b:168862110 TEST=on drawcia, verify sink capabilities match those from PD traces with several docks and dongles Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Iadc6ef4c7364d7c709878a75fd5e707a965f77f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2540390 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Add DPM_REQUEST_GET_SRC_CAPDenis Brockus2020-09-021-0/+1
| | | | | | | | | | | | | | | | | | | | | As a SRC that runs on battery it can be handy to determine if the connected partner has unconstrained power available so we can try to PR_Swap to let them power us. This only requests the information, if it is not already available, and leaves it to other code to determine if the swap is a good idea. BUG=b:166446426 BRANCH=none TEST=connect a sink device and determine it performed the action Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: If45801a33df8b75e541989d7ee8f36ed316ffcc6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2381408 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: use sender_response message frameworkDenis Brockus2020-09-021-1/+0
| | | | | | | | | | | | | | | | | | Building up the framework to handle discarded DPM requests and using it on all of the sender_response messages BUG=b:165822172 BRANCH=none TEST=DUT-DUT PR_Swap Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I542d4cba89a923fb16588cc675d2ea4ab7954e0a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2376386 Tested-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* cleanup/usbc: organize all super states togetherJett Rink2020-08-131-7/+5
| | | | | | | | | | | | | | Like other state machine declarations, put all of the super states together to make it more clear when reading states. BRANCH=none BUG=none TEST=build and unit tests Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I1bb776434911d3acdb34abc64e7e8fa5f87154de Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2354193 Reviewed-by: Edward Hill <ecgh@chromium.org>
* usbc: add GEN_NOT_SUPPORTED macro for unsupported statesJett Rink2020-08-131-5/+3
| | | | | | | | | | | | | | | | | | | To enabled use of the IS_ENABLE macro we need to define some of the usb state machine states as extern variables that will never be linked. This allows the compiler to know about a state but will still fail the linking phase if the config option is not defined properly. This is just adding a convenience macro for this paradigm, not creating the paradigm itself. BRANCH=none BUG=none TEST=builds Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Ia19b5babd43d536f043745314481475cf25f6e01 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2353369 Reviewed-by: Edward Hill <ecgh@chromium.org>
* usbc: correctly handle Get_Source_Cap as a sinkPeter Marheine2020-08-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* TCPMv2: Optionally build extended message supportAbe Levkoy2020-07-291-2/+8
| | | | | | | | | | | | | | | | | | If CONFIG_USB_PD_EXTENDED_MESSAGES is defined, support sending and receiving extended messages. If it is not, remove the chunking state machines from the PRL and modify the PE to respond with Not Supported as appropriate. BUG=b:160374787,b:158572770 TEST=Attach various devices; observe PD traffic TEST=make run-usb_prl_noextended; make run-usb_pe_drp_noextended BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I862020155927b5613d599274708e60678c49c43c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2304263 Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* test: Use pd_task for pe testJett Rink2020-07-211-12/+0
| | | | | | | | | | | | | | | | Instead of calling pe function direction in unit test, use the existing state machine task for unit tests. This allows the real code to call into a task_set_event on the PD tasks. See CL:1786462 where this is needed. BRANCH=none BUG=none TEST=run test passes with and without CL:1786462 Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: If31f946e2253c724dd314b2b22e2265cf46197f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2307713 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Rename discovery flagsAbe Levkoy2020-06-191-2/+2
| | | | | | | | | | | | | | | | | | PE_FLAGS_DISCOVER_PORT_IDENTITY_DONE has been used to indicate that DisplayPort configuration is done for some time. PE_FLAGS_DISCOVER_PORT_CONTINUE is now only used to resume non-discovery VDM requests. Maybe the way they are used should change. For now, rename them to reflect their current use; this should make subsequent changes easier to understand. BUG=b:155890173,b:158813138 TEST=make buildall BRANCH=none Change-Id: Icbb6a44412b1b901ed160da58d4fbe016348bc2b Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250921 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Wait for Safe0V on PR Swap SNK to SRC before PS_RDYDenis Brockus2020-06-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We were out of spec for PR Swap transitioning from SNK to SRC by sending PS_RDY before we were Safe0V. We only waited for the TC state machine to go from attached.snk to attached.src, which happened on the first state machine tick after pe_prs_src_snk_transition_to_off_entry was called and this does not guarantee Safe0V as is needed. Added an extra state to reflect what the PD spec requests and now waiting for Safe0V before indicating we are powered off. BUG=b:157755939 BRANCH=none TEST=ThinkPad Dock G2 should attach Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I93eb36acc64f273e8b30ca0a0bb76d6fa96b64ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2223723 Tested-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Only include PD3.0 functionality when CONFIG_USB_PD_REV30Sam Hurst2020-05-211-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | The TCPMv2 stack defaults to PD2.0 functionality. Defining CONFIG_USB_PD_REV30 enables PD3.0 functionality. BUG=b:155879504 BRANCH=none TEST=make -j buildall Manual tests: passed FAFT_PD running on kohaku Before patch: *** 18624 bytes in flash and 29216 bytes in RAM on kohaku RO **** *** 18544 bytes in flash and 29216 bytes in RAM on kohaku RW **** After patch: *** 23320 bytes in flash and 30336 bytes in RAM on kohaku RO **** *** 23228 bytes in flash and 30336 bytes in RAM on kohaku RW **** Flash savings of 4696 bytest Ram savings of 1120 Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I082cf62617a91b487d2d3567afd5e340bd52258c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2184547 Reviewed-by: Jett Rink <jettrink@chromium.org>
* TCPMv2: Remove PE_FLAGS_SEND_SVDMAbe Levkoy2020-05-201-10/+8
| | | | | | | | | | | | | It is never checked. BUG=none TEST=make buildall BRANCH=none Change-Id: I74034ae998c8c8ac068c6712f9b078afcab8942b Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2203840 Reviewed-by: Diana Z <dzigterman@chromium.org>
* pd: Clarify flag commentsDenis Brockus2019-11-081-23/+40
| | | | | | | | | | | BRANCH=none BUG=b:141563840 TEST=make -j buildall Change-Id: Iaff605f5d93ccce26aec4d9e33be78017c7b9231 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1906194 Reviewed-by: Jett Rink <jettrink@chromium.org>
* pd: Remove EMarker Cable ProbeSam Hurst2019-11-081-3/+0
| | | | | | | | | | | | | | | The current PD3.0 EMarker cable probe functionality is unstable. Remove and add back as a feature after the PD3.0 code base is stable. BRANCH=none BUG=b:144093713 TEST=make -j buildall Used total phase to verify that the cable was not probed. Change-Id: I2906a16c96faff9d8107ef19286acdbe60869180 Signed-off-by: Sam Hurst <shurst@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1904157 Reviewed-by: Jett Rink <jettrink@chromium.org>
* pd: Comment all flagsSam Hurst2019-11-071-18/+28
| | | | | | | | | | | | | | | | All of the flags in all layer needs comments of what the flags means and a potential usage. all TC_FLAGS_*, PR_FLAGS_* and PRL_FLAGS_* BRANCH=none BUG=b:141563840 TEST=make -j buildall Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I520daa841a61e36a8a6b394e0f96b198b16ad561 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1904148 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org>
* pd: Add PE FRS unit test for new stackDenis Brockus2019-10-161-0/+133
BUG=none BRANCH=none TEST=make buildall -j Change-Id: I55453ddf1d1da0fdee902a33e14357716fb12c4a Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1859826 Reviewed-by: Jett Rink <jettrink@chromium.org>