summaryrefslogtreecommitdiff
path: root/common/usbc
Commit message (Collapse)AuthorAgeFilesLines
* TCPMv2: Handle message discard in snk_give_sink_capDiana Z2020-12-211-16/+35
| | | | | | | | | | | | | | | | | | If a port partner sends a message while we're attempting to send sink capabilities, then send a soft reset with the SOP of the incoming message. BRANCH=None BUG=b:157228506 TEST=on drawcia with Apple A2119, PE does not get stuck in snk_give_sink_cap state when interrupted Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ic4d184ac731c44b8a604a38cfd6c0cfcd3df1127 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2558909 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2600001
* TCPMv2: Handle message discard in vcs_evaluate_swapDiana Z2020-12-211-0/+19
| | | | | | | | | | | | | | | | | If the port partner sent a message while we were attempting to reply to a Vconn swap, soft reset with the incoming message's SOP. BRANCH=None BUG=b:157228506 TEST=on drawcia with Apple A2119, PE does not get stuck in vcs_evaluate_swap Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ifb40ee6bec02b88d96088d72b1a9371417b3338a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2558908 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2600000
* tcpci: Base retry count on active PD revAbe Levkoy2020-12-211-0/+5
| | | | | | | | | | | | | | | | | Retry twice when operating at PD 3.0 and thrice when operating at PD 2.0. Provide a TCPM-agnostic interface to get the number of retries. BUG=b:173025773,b:173025737 TEST=Pass TD.PD.LL.E3 Soft Reset Usage and TD.PD.LL.E4 Hard Reset Usage BRANCH=firmware-volteer-13521.B-master Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I422447718f1bfc9a9d4f8ffc5b284723a5332833 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2578201 Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2599999
* mock: Clean up TCPMv2 mocksAbe Levkoy2020-12-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Place mock functions in the mock libraries corresponding to the layers of the real implementations. Broadly, move towards one layer of the TCPM stack as a UUT, with mocks for the other layers as needed. There should be a one-to-one correspondence between real modules and mock modules. usb_pd_mock.c does not correspond to any real implementation module or TCPM stack layer, so remove it and move its contents to the layers corresponding to their real implementations. Also clean up some redundant or misplaced mocks inside tests. BUG=b:153071799,b:173791979 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ic44df8675de2b9f1f8c7669cd97dcdc296bf107f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2578200 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2599998
* task_set_event: remove the wait argumentDawid Niedzwiecki2020-12-143-8/+7
| | | | | | | | | | | | | | | | | | | | | | There is an option in the task_set_event function which force the calling task to wait for an event. However, the option is never used thus remove it. This also will help in the Zephyr migration process. BUG=b:172360521 BRANCH=none TEST=make buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ic152fd3d6862d487bcc0024c48d136556c0b81bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521599 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2590866
* usb_pe_drp_sm: clear PE_FLAGS_PS_RESET_COMPLETE after reset completeRuibin Chang2020-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | We should clear the PE_FLAGS_PS_RESET_COMPLETE after PE get the flag , or this flag is always set. BUG=none BRANCH=none TEST=on drawcia, console cmd "pd 0 hard" second times and later pe stays in pe_snk_transition_to_default_run state to wait PE_FLAGS_PS_RESET_COMPLETE set. Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw> Change-Id: I95c5a627e6b289d4405dc695eeaa97d369e1d92f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2577149 Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Ruibin Chang <Ruibin.Chang@ite.com.tw> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2590857
* usbc: Remove pd_ts_dts_plugged() check from PD_DRP_FORCE_SINKEdward Hill2020-12-141-14/+3
| | | | | | | | | | | | | | | | | | | | | | PD_DRP_FORCE_SINK had an exception (since crrev.com/c/277275), allowing role to remain source on S5 entry if DTS (debug accessory) is connected. Remove this exception. rddkeepalive on cr50 (set when servod starts) ensures CCD mode stays enabled across power and role changes. BUG=b:173457150 BRANCH=none TEST=servo_v4_role:snk, AP S0/S5/G3, EC reboot/hibernate -> CCD keeps working Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: Iccdfb504c6269ee2ba072e9818920e3e10a56739 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2542578 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2590840
* TCPMv2: Add source and sink cap PD APIs for TC-only useDiana Z2020-12-141-0/+27
| | | | | | | | | | | | | | | | | Stub out returns of 0 and NULL for the source and sink cap pd_ APIs if a board is not using the PE layer. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I32e74f3f29aacdf47aca9bc9d0664a4d799da3b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2585749 Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2590827
* TCPMv2: Update charge manager dual-role when getting source capsDiana Z2020-12-141-0/+9
| | | | | | | | | | | | | | | | | | If the partner reports it is dual-role in source capabilities, report this to the charge manager so the UI may display it as a type-c charging option, even if we're currently not sinking from this partner. BRANCH=dedede BUG=b:173166474 TEST=on waddledoo, DUT-DUT connections consistently result in the UI presenting the USB-C charging option in the power menu Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I25f43c34a319961ffd49f040901b3dadd0c10d5e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2577834 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2590826
* TCPMv2: Remove redundant TC flagsDiana Z2020-12-142-73/+6
| | | | | | | | | | | | | | | | The TC flags for the fixed PDO data are redundant with the stored PDOs we have for both sources and sinks. Remove these and their callers. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: If242d7f9b9210bccdcafedc97dbf89dd581797d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2576454 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2590825
* TCPMv2: Check fixed PDO for relevant flagsDiana Z2020-12-141-25/+47
| | | | | | | | | | | | | | | | | | | | | Have the pd_ functions which query fixed PDO flags retrieve the fixed PDO themselves, rather than going through stored TC flags. This reduces the liklihood of problems with the flags getting out of sync, and reflects our future goal of being able to provide the AP with the PDOs directly for decision-making. BRANCH=dedede BUG=b:173166474 TEST=on waddledoo, perform many DUT-DUT connections and verify that the other DUT will always show up as DR power and data in the "ectool usbpd" output Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I4dd46f5ef4156377d11169545a541b11e60a2cf4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2576453 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2590824
* TCPMv2: Add config option guard for prs checkScott Collyer2020-12-141-1/+3
| | | | | | | | | | | | | | | | | | | | This CL fixes an implicit config option assumption where a call from the type C layer would expect a power role swap function to exist. BUG=b:169299049 BRANCH=none TEST=verify that can build with usbc support only enabled. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I0a674beb0f68d4a767303fee5e48221e205e0887 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2581886 Tested-by: Scott Collyer <scollyer@chromium.org> Auto-Submit: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2590815
* TCPMv2: Fix Soft Reset logicAbe Levkoy2020-12-081-8/+17
| | | | | | | | | | | | | BUG=b:173025773,b:173025737,b:155181980 TEST=Observe Soft Reset after not receiving GoodCRC 3 times BRANCH=firmware-volteer-13521.B-master Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Iee7016549a8a83b21d0a7ca168ace7ea2594a594 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2578199 Reviewed-by: Diana Z <dzigterman@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2580277
* TCPMv2 DRP: always try sink caps on PE_SNK_Ready for FRSPeter Marheine2020-12-081-35/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this change, device policy was inhibited from requesting partner sink capabilities when entering SNK.Ready out of a power role swap (because the flag gets cleared while invalidating the old contract in the PRS process), which prevents Fast Role Swap from being enabled in most situations- for instance Section E.2 of the USB-PD specification revision 3.0 version 2.0 states that a PRS is a normal part of connecting to a hub and the device should request sink caps via device policy in order to enable FRS. This change attempts to get sink caps from the port partner in PE_SNK_Ready, then use them to evaluate support for FRS. By moving partner capabilities evaluation to PE_SNK_Ready, we also prevent FRS from being enabled when operating as a source: we don't expect sinks to send FRS, and this helps avoid detecting (and attempting to act on) spurious FRS signaling. BUG=b:146393213 TEST=Morphius connects to a hub supporting FRS as expected and successfully completes a fast role swap when power is removed from the hub. BRANCH=zork Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: Icf402b4ded99d35e23b51b168cb7f306c3ac156b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2564978 Reviewed-by: Diana Z <dzigterman@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2578223
* tcpmv2: change SOP' Discover Identity retry logic.Keith Short2020-12-081-10/+24
| | | | | | | | | | | | | | | | | | | To further improve the time to enter alternate modes, limit the number of SOP' DiscID retries that are performed before a contract is in place. This ensures interoperability with captive cable devices that cannot respond to SOP' until a contract is established. BUG=b:169741906, b:166650426 BRANCH=firmware-volteer-13521.B-master TEST=Connect TBT3 loopack device and verify TBT mode is entered. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I007780df567cd0e66236b2c3067d065eecf07fe1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2550307 Reviewed-by: Diana Z <dzigterman@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2579779
* usbc: Wake PD task on PE TX and RXEdward Hill2020-12-021-1/+4
| | | | | | | | | | | | | | | | Wake the PD task from pe_message_received(), pe_message_sent(), and pe_report_error() to avoid having to wait USBC_EVENT_TIMEOUT. BUG=none BRANCH=none TEST=make run-usb_pe_drp Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I2fd1465796224507e1eb64ea20572165918d5bf3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2564818 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2570284
* TCPMv2: Handle unexpected message during PR_Swap SRC->SNKDenis Brockus2020-12-021-10/+14
| | | | | | | | | | | | | | | | | | | | | | | Dock is requesting a PR_Swap to become our SRC and, after accepting this, the dock sends a VDM Attention instead of the expected PS_RDY. Since we are past the initial PR_Swap/Accept, this is no longer handled as a Power Transition state and a SoftReset will be used. BUG=b:170265589 BRANCH=zork TEST=use test in bug Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I7afabbf3dc9cffb60de332b8eba38ee40b93d8ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2565695 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2570275
* TCPMv2: pd_can_source_from_device use cleanupDenis Brockus2020-12-021-32/+3
| | | | | | | | | | | | | | | | | | | | Instead of having the policy logic spread over a few locations, us pd_can_source_from_device to localize that policy BUG=none BRANCH=zork TEST=verify PR_Swaps to SNK only if partner can source Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I402abcf4c9e864203d580b37218859e68e74bf2a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2555866 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2570185
* TCPMv2: AP resume should consider Src->Snk swapDenis Brockus2020-12-022-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TCPMv1 used PD_FLAGS_CHECK_PR_ROLE and pd_check_pr_role() to accomplish this. This was missing from TCPMv2. In the TCPMv2 implementation, policy pd_can_source_from_device was added to put the logic in one place to detect if the PDO for a partner device can and should be the source Using this policy the AP resume code will check to see if an already attached partner that we are sinking from should be sinking from us instead. BUG=b:169299049 BRANCH=zork TEST=verify DRP phone will swap back to SNK on AP resume Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I8e584446445c8ee2e1c91973a58a04405cdf9e1b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2555865 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2570184
* PD: Fix passing information about polarity when DTS is connectedPatryk Duda2020-11-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 7dec638eb577aaa3a00d0551d73c276b94ebacb2 introduced two polarity modes POLARITY_CC1_DTS, POLARITY_CC2_DTS in enum tcpc_cc_polarity, but in many places there was an assumption that value other than 0 means that cable is inverted, the most notable example is usb_mux_set(). As a result kernel sometimes was not reporting SuperSpeed depending on if cable was inverted or not. This patch adds mapping from polarity with DTS to polarity without DTS where necessary. BUG=b:162254118 BRANCH=none TEST=Connect ServoV4 to eve and run servod. Make sure that USB-C muxer is connects USB3.0 lines (servod should set it). Flash EC ToT on eve. Boot ChromeOS and go to Developer Console. Run 'dmesg -w', check if device (eg. ethernet adapter) is attached as SuperSpeed device. Unplug cable, invert and plug again. Kernel should report that device is attached as SuperSpeed. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I354ef7047240cc8b5db01936b3780fae7387edb5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2555157 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2559359
* tcpmv2: reduce time to enter alternate modesKeith Short2020-11-241-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | The USB Type-C specification defines tAMETimeout (1000 ms) as the time between sink attach until a USB Billboard device class is exposed. For some SNK devices, the billboard class can interfere with processing of PD messages, causing PD discovery and altnernate modes to fail. Reduce the time to enter alternate modes for PD2.0 devices by only performing a hold-off delay after the first contract is established. This change also reduces the minimum hold off delay fro 400ms to 200ms. BUG=b:169741906 BRANCH=firmware-volteer-13521.B-master TEST=connect StarTech dongle to Delbin. Observe that altnerate mode entry occurs between 700 and 950ms. Prior to this change, altnernate mode entry took 900 to 1200ms. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Id65ad061a0019f07bbfba72dcab82c51472c6273 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2550306 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2559346
* TCPMv2: Store and report sink capsDiana Z2020-11-242-13/+45
| | | | | | | | | | | | | | | | | | | | | | | 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> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2559335
* TCPMv2: Use cached battery infoDiana Z2020-11-241-26/+71
| | | | | | | | | | | | | | | | | | | | | | Whenever possible, use our battery information we already cache for host commands to save time providing battery responses. Note that the battery status is not cached, and will still be retrieved over i2c, and any boards without host commands will continue running i2c commands for this message. BRANCH=None BUG=b:172983079,b:173018448 TEST=With GRL and source cap extended patch, TD.PD.SRC3.E15 Battery Capabilities sent timely and TD.PD.SRC3.E7 Battery Status Sent Timely pass Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I567c92601239b801bf0e4e4bba2a4a5809785b7c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2533523 Tested-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Sam Hurst <shurst@google.com> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2559334
* TCPMv2: Always probe sink capsDiana Z2020-11-241-37/+33
| | | | | | | | | | | | | | | | | | | | | | | This commit adds the ability to always probe the partner for sink capabilities, and re-names the state to reflect that sources may use it now too. This also fixes some issues in the state to get sink capabilities, including correcting the message detection and soft resetting with the SOP* of the unexpected message. This also updates the unit tests to expect a Get_Sink_Caps message as a part of typical startup. BRANCH=None BUG=b:168862110,b:160009733 TEST=on drawcia, observe sink caps are requested from source and sink partners Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I5da3adc17ccec71f6cad9e8f152b9570ec99691d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2540389 Reviewed-by: Keith Short <keithshort@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2559333
* TCPMv2: Replace charging allow listDiana Z2020-11-201-34/+32
| | | | | | | | | | | | | | | | | | | | | Replace the charging allow list with a check to verify whether the partner can provide at least 27W to the DUT. This should cover existing members of the allow list, and deprecate the need to continue adding to this list. BRANCH=None BUG=b:173070679 TEST=on drawcia, verify DUT can charge from power bank, Apple 3-in-1, and servo_v4 Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Id0b516782809b6912602e9b7ab0546938e0b85ed Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2535217 Tested-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2552137
* TCPMv2: Disallow hard resets without a batteryDiana Z2020-11-201-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | When a chromebook is booted without a battery and reaches the point where it would normally hard reset a connection, disable the PE for the port instead. This may result in a strange state for the board (ex. charge manager reporting the active port is a type-c supplier with 15V), but will not brown out the board during important factory sequences. Note that chromeboxes should brown out in this condition, as it would be undesirable to leave a connection up with only partial functionality on a customer system. BRANCH=None BUG=b:168169691 TEST=on drawlat, boot without a battery and run "flashrom -p ec" from the OS successfully Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I0d27348532920a0c7e36c85f1fba24495ba7d648 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2493111 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2551947
* TCPMv2: Disable SOP' messaging during PR swap to sinkDiana Z2020-11-201-0/+20
| | | | | | | | | | | | | | | | | | | | Some source partners may attempt to perform cable probing during startup after a power role swap, despite not being the Vconn source. Disable our SOP' transmissions to avoid confusing this traffic with our own GoodCRCs, and re-enable SOP' when we're heading into PE_SNK_READY with our new explicit contract. BRANCH=None BUG=b:168560801 TEST=on drawcia, confirm BenQ monitor can successfully power role swap with an e-marked cable and with a non-e-marked cable Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ia67119043661a4bd3c8c2a45021e59e98d6a0df5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2542865 Reviewed-by: Keith Short <keithshort@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2551944
* TCPC: Change SOP' disable interfaceDiana Z2020-11-201-2/+2
| | | | | | | | | | | | | | | | | Add the ability to enable or disable SOP' traffic through a new parameter. Name the function for "enable" to match other EC conventions. BRANCH=None BUG=b:168560801 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ife52e7d7d098825ab2163c70a4c59510da958876 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2542864 Reviewed-by: Keith Short <keithshort@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2551943
* TCPM: Add OCP moduleDiana Z2020-11-181-38/+46
| | | | | | | | | | | | | | | | | | | | | | Currently, the overcurrent protection is tracked in the PPC code. However, as different chips are able to report overcurrent move this code into a generic module. Logic for not sourcing Vbus or Vconn on latched ports moves into the TC layer, and an overridable board overcurrent function is provided for boards which have no special actions to take. BRANCH=None BUG=b:171501161 TEST=make -j buildall; TCPMv2 tested with following drawcia patch Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I75919e345a5b0bce4a0b67432a13515e7716cf6a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532676 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2546416
* TCPMv2: Fix compiler dependency of USB_PD_TRY_SRCScott Collyer2020-11-181-5/+4
| | | | | | | | | | | | | | | | | | | | This CL fixes a couple minor issues where usb_tc_drp_acc_trysrc_sm.c won't compile correctly unless CONFIG_USB_PD_TRY_SRC is defined. This fix takes advantage of the __maybe_unused pragma so that #ifdef guards are not required. BRANCH=None BUG=b:169812364 TEST=Build quiche without CONFIG_USB_PD_TRY_SRC defined. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Ibe8fc5fb765162d4b006b619b907aa35b5e1e73a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2531182 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2546407
* Tcpmv2: Handle transmission delay after Vccon swapPoornima Tom2020-11-161-0/+7
| | | | | | | | | | | | | | | | | | | | | While in PE state - PE_VCS_Send_Ps_Rdy_Swap,after successful vconn swap, it is expected to reset cable & receive the Accept/Reject Response. In case of more transmission delays, response_timer must be set, inorder to set the PE_FLAGS_TX_COMPLETE flag. BRANCH=None BUG=none TEST=Tested on ADL-RVP Signed-off-by: Poornima Tom <poornima.tom@intel.com> Change-Id: Ia7f7f183ad51c7500b4dc4629e6d2b17dddc8163 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2505399 Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2542148
* tcpmv2: Don't trigger BC1.2 detect if role doesn't changeKeith Short2020-11-121-12/+29
| | | | | | | | | | | | | | | | | | | | | Don't trigger BC12 client detect or BC1.2 host mode if the data role hasn't changed. This fixes issues seen with some CDP hosts that drop VBUS if BC1.2 client detect is restarted. BUG=b:158708115 BRANCH=firmware-volteer-13521.B-master TEST=Connect laptop CDP to Volteer. CDP falls back to SDP but remains stable instead of looping on BC1.2 detect. TEST=Connect desktop CDP to Volteer, verify 7.5W charging. TEST=Connect DCP to Volteer, verify 7.5W charging. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ifd0ee379a0d5894894d13fb1a64b4dec2e77ec9e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2529809 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2535296
* TCPMv2: Add support for linear re-driver cablesAyushee2020-11-063-57/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The linear re-driver cables enumerate as passive cables in the Discover mode SOP' response from the cable. But they have Active/Passive bit (B25) in the discover mode SOP' response set. Hence, if the cable is LRD, the port enters Thunderbolt mode SOP' before entering USB and it also sets the cable as active in the mux and retimer setting. USB4 PD flow for LRD cables: Is Discover mode SOP' B25? ----- N ----- Enter USB4 SOP with Gen 2 cable speed | y | Enter TBT SOP' | Enter USB4 SOP as per cable speed. TBT PD flow for LRD cables: Is Discover mode SOP' B25? ----- N ----- Enter TBT SOP | y | Enter TBT SOP' | Enter TBT SOP This CL also updates the retimer setting and Enter USB Data object for USB4 according to the type of cable detected (LRD/Active/passive) BUG=b:156749387 BRANCH=None TEST=With Linear re-driver cable, 1. Able to enter USB4 mode 2. Able to enter Thunderbolt mode 3. Able to exit and re-enter USB4 on reboot 4. Able to exit and re-enter Thunderbolt mode on reboot Change-Id: Ie5258f792e13a205dea71fc9f06b1d8987ec9194 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2470209 Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523868
* TCPMv2: Correct battery index detectionDiana Z2020-11-061-19/+35
| | | | | | | | | | | | | | | | | | | | The battery index is located in the first byte after the extended header, which is not passed up to the PE layer. Additionally, the PRL will start copying the message from byte 0 so correct the extended message population. Add condition to fill in a valid response if the battery is not currently present, and correct the battery status response initialization. BRANCH=None BUG=b:161837550 TEST=with GRL-C2, invalid battery index tests pass Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I65ebe56f197b9822a42463f8d9dfb42b34c1ffe1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2357517 Reviewed-by: Jett Rink <jettrink@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522189
* tcpmv2: ifdef cleanup with IS_ENABLEDDenis Brockus2020-11-056-293/+312
| | | | | | | | | | | | | | | | | | | | | | | | | | Remove as many #if preprocessor statements as possible without allowing the code to grow when it is compiled. Verified against the sizes built on current ToT and this CL on that ToT ~/trunk/src/platform/ec $ make newsizes Compared 699 of 699 files. File sizes are unchanged. BUG=b:172208011 BRANCH=none TEST=verify TCPMv2 functionality Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ib7d6a41b418f0683d3f7a14236b377073f346010 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2515279 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522268
* TCPMv2: Allow alternate mode reentryAbe Levkoy2020-11-052-4/+9
| | | | | | | | | | | | | | | | When the EC is waiting for the AP to direct it to enter alternate modes, allow the AP to direct an Exit Mode followed by another Enter Mode. BUG=b:168030639 TEST=Exit and reenter DP and TBT alt modes BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I9edf0ca0a787ed025de2d5a5403d4225a6683e3b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2518612 Reviewed-by: Diana Z <dzigterman@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522264
* TCPMv2: Remove unnecessary bracesAbe Levkoy2020-11-051-2/+1
| | | | | | | | | | | | | BUG=none TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ia9ae2cf5092530013df1da080c03d1dfc7bf7678 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2518611 Reviewed-by: Diana Z <dzigterman@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522263
* TCPMv2: Add support for USB4 active cableAyushee2020-11-054-39/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | USB4 PD flow for active cables: Structured VDM version (cable revision)-- <2.0 -------->| | | >=2.0 | | | VDO version---- <1.3 -------> Modal op? -- N --| (B21:23 of | | Discover ID SOP'- y | Active cable VDO1) | | | TBT SVID? -- N --| >=1.3 | | | y | Cable USB4 support? - N | | | | Gen4 cable? - N - Skip USB4 mode entry y Skip USB4 | | mode entry | Enter USB4 y (SOP',SOP'',SOP) | | |<---- NAK ----- Enter mode TBT SOP'<---| | | | | ACK | | | | |<---- NAK ----- Enter mode TBT SOP'' | | | | Exit TBT mode SOP ACK | | | | ACK/NAK Enter USB4 mode | | SOP | Exit TBT mode SOP'' | | | ACK/NAK | | | Exit TBT mode SOP' | | | ACK/NAK | | | |--------Retry done? ---- N ------------| | y | Skip USB4 mode entry The CL also checks if the port is VCONN source before sending Enter USB SOP' and SOP'' messages and requests for a vconn swap is it isn't In case of reboot, the port sends exit Thunderbolt mode SOP' and SOP'' and skips sending exit Thunderbolt mode for SOP, since it didn't enter Thunderbolt mode SOP prior to reboot. Note: 1. This is only applicable when the port enters USB4 mode SOP and Thunderbolt mode with the cable plug. 2. It is a temporary behaviour until data reset feature is in place (b/141363146) BUG=b:156749387 BRANCH=None TEST=1.Able to enter into USB4 with active cable. 2.Able to exit Thunderbolt mode SOP' and SOP'' on reboot and re-enter into USB4 mode with active cable. Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I828c7ca0fd9b7b1025f13bcc86c511692b9f9895 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2432868 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522262
* TCPMv2: Correct PE_VDM_Response name stringAbe Levkoy2020-11-051-1/+1
| | | | | | | | | | | | | | | | PE_VDM_RESPONSE isn't a superstate. BUG=none TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I3450f4eb0d12bd71187932b453bbb7ebeade7f48 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2517780 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522256
* tcpmv2: extended unlocked exception to battery removalJett Rink2020-11-051-1/+1
| | | | | | | | | | | | | | | | | | When the battery is removed and that is also tied to write protect, allow EFS2 device to get a higher power contract even if the EC-CR50 communication failed. BRANCH=none BUG=b:168521645 TEST=morphius is able to boot to recovery screen with battery unplugged Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Idcc80beeb0364264adcb21e2eaf2c44e366460f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2493104 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522132
* atomic: rename atomic_read_clear to atomic_clearDawid Niedzwiecki2020-11-021-1/+1
| | | | | | | | | | | | | | | | | | | Rename atomic_read_clear to atomic_clear to be consistent with the rest of the atomic functions, which return the previous value of the variable. BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I2588971bd7687879a28ec637cf5f6c3d27d393f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2505143 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2514696
* TCPMv2: Hard Reset to only disable ADD if Vbus dropsDenis Brockus2020-11-021-3/+4
| | | | | | | | | | | | | | | | | | | | If the sourcing partner does not leave Safe5V on Hard Reset then AutoDischargeDisconnect should not be disabled. BUG=b:170325888 BRANCH=zork TEST=SuzyQ should work Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ie191b0529b1f33bdaca09643b5a44af034935539 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2509977 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2514682
* Revert "hack: temporarily work around TX_COMPLETE failure"Ken Lu2020-11-021-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit bf411187b05aab57a9eb23c9a5b54f32b45aa2da. Reason for revert: PS8815 A1 firmware 0x0c fixes the TX_COMPLETE failure Original change's description: > hack: temporarily work around TX_COMPLETE failure > > After we removed the retry logic in the PRL layer, we uncovered an issue > that was being masked. On Delbin, the state machine is not receiving > that the PD messages (namely Request) is being sent successfully. We get > neither success or failure within 100ms. We still need to figure out and > fix this the root cause. > > This change just assumes that any sent PD traffic is successful after > 100ms (instead of a failure) for Delbin boards only. > > There is an upcoming build for Delbin that we will have power on > issues if we don't add some kind of power work around. This patch will > not allow the USB PD stack on Delbin to work properly in all scenarios; > this patch only aims to ensure that we can get power to the device to > test other non-PD functionality. > > This CL should be reverted within a two week time frame. > > BUG=b:164154200 > TEST=Delbin can power on > > Signed-off-by: Jett Rink <jettrink@chromium.org> > Change-Id: If6dce35dfd78ee3a70e6216a7b6bf62d3ded5646 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2376477 > Reviewed-by: Keith Short <keithshort@chromium.org> > Commit-Queue: Anson Tseng <ansontseng@google.com> > Tested-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com> BUG: b:164154200 BRANCH=firmware-volteer-13521.B Change-Id: If475ba52dd3f128848ad263a34ebb9ce50b93bfb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2505389 Tested-by: Ken Lu <ken_lu@pegatron.corp-partner.google.com> Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Ken Lu <ken_lu@pegatron.corp-partner.google.com> Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I85636d97d6b9c5d21870adeb51eb193c62de899c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2513977
* tcpmv2: Enable AutoDischargeDisconnect after applying RdEdward Hill2020-11-021-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Enabling AutoDischargeDisconnect before applying Rd in Attached.SNK was causing TCPC_REG_FAULT_STATUS_AUTO_DISCHARGE_FAIL (FAULT 0x20 detected) from NCT3807 when DRP was enabled (in S0) and Try.Src was disabled (battery < 5% CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC, or "pd trysrc 0"). This caused the battery to fail to charge, and powerd shutting down the AP due to low battery. Avoid this by enabling AutoDischargeDisconnect after CC lines have been set to Rd. BUG=b:171567398 BRANCH=zork TEST=charge ok with S0 + "pd trysrc 0" Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: If84bf70040cf0861596f46055502fc74e8ec9a6f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2500462 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Peichao Wang <pwang12@lenovo.corp-partner.google.com> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2513970
* TCPMv2: Notify AP when discovery is NAKedDiana Z2020-10-291-6/+10
| | | | | | | | | | | | | | | | | | When a partner doesn't support identity discovery, notify the AP that discovery is complete. The TYPEC_DISCOVERY results will show 0 VDMs for the identity and 0 SVIDs found. BRANCH=None BUG=b:171434553 TEST=on drawcia, plug in port partners which don't support SOP and SOP' identities and verify that events are set for their discovery being done Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Iac383cf42c4df091e9c35d00a59a01d854178e4f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2505778 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2508581
* tcpmv2: Use atomic_* implementationDawid Niedzwiecki2020-10-291-4/+2
| | | | | | | | | | | | | | | | | | Use atomic_* instead of deprecated_atomic_*, where it hasn't been done in CL:2504187 BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I53a55b9afcb936e1254331ba1a078254385c33ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2504670 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2508580
* tree: Use new atomic_* implementationDawid Niedzwiecki2020-10-273-62/+48
| | | | | | | | | | | | | | | | | | | | | | | | | It is done as a part of porting to Zephyr. Since the implementation of atomic functions is done for all architectures use atomic_* instead of deprecated_atomic_*. Sometimes there was a compilation error "discards 'volatile' qualifier" due to dropping "volatile" in the argument of the functions, thus some pointers casts need to be made. It shouldn't cause any issues, because we are sure about generated asm (store operation will be performed). BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I98f590c323c3af52035e62825e8acfa358e0805a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2478949 Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2504187
* TCPMv2: Add typeccontrol enter-mode subcommandAbe Levkoy2020-10-272-22/+129
| | | | | | | | | | | | | | | | | | | | Define and implement TYPEC_CONTROL_COMMAND_ENTER_MODE. Allow DPM state to be accessed asynchronously by host commands. Add support for this command to ectool. BUG=b:168030639 TEST=Attach DP dongle; discovers but does not enter TEST=ectool typeccontrol 1 2 0; enters DP TEST=Attach TBT dock and TBT active cable; discovers but does not enter TEST=ectool typeccontrol 1 2 1; enters TBT BRANCH=none Change-Id: I218c4b9a92004ef1efe9a27b2a920031961b33f3 Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2454538 Reviewed-by: Diana Z <dzigterman@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2504149
* TCPMv2: Add fields for sink capabilities to TYPEC_STATUSDiana Z2020-10-271-1/+2
| | | | | | | | | | | | | | | | | | | Round out the final fields of the new TYPEC_STATUS v0 command return with sink capabilities fields. Note that they are not yet being populated, but are being added now to avoid unnecessary return versioning in the coming months when the command is being used. BRANCH=None BUG=b:167700356 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I38a6e96a9ec4974e11b85839abcd4deafcf96b6c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2473099 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2504135
* TCPMv2: Report source capabilities in TYPEC_STATUSDiana Z2020-10-271-1/+5
| | | | | | | | | | | | | | | | | | Report the source capabilities for a port to the TYPEC_STATUS host command, and add decoding for the interesting fields here to ectool. BRANCH=None BUG=b:167700356 TEST=on waddledoo, confirm source capability decoding from ectool matches that from TotalPhase for servo_v4 and a charger Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ib79c36c613c47fc60cfd8736202216ee40fbb42f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2473098 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2504134