summaryrefslogtreecommitdiff
path: root/include/usb_pd.h
Commit message (Collapse)AuthorAgeFilesLines
* Update license boilerplate text in source code filesstabilize-quickfix-15278.72.B-ishstabilize-quickfix-15183.78.B-ishstabilize-15446.B-ishstabilize-15439.B-ishstabilize-15432.B-ishstabilize-15429.B-ishstabilize-15415.B-ishstabilize-15395.B-ishstabilize-15393.48.B-ishstabilize-15381.B-ishstabilize-15364.B-ishstabilize-15361.B-ishstabilize-15359.B-ishstabilize-15359.58.B-ishstabilize-15359.50.B-ishstabilize-15359.45.B-ishstabilize-15335.B-ishstabilize-15329.59.B-ishstabilize-15329.44.B-ishstabilize-15317.B-ishstabilize-15301.B-ishstabilize-15300.B-ishstabilize-15278.64.B-ishstabilize-15251.B-ishstabilize-15245.B-ishstabilize-15236.66.B-ishstabilize-15208.B-ishstabilize-15207.B-ishstabilize-15185.B-ishstabilize-15185.7.B-ishstabilize-15183.82.B-ishstabilize-15183.69.B-ishstabilize-15183.14.B-ishstabilize-15174.B-ishstabilize-15167.B-ishstabilize-15129.B-ishstabilize-15122.B-ishstabilize-15120.B-ishstabilize-15117.86.B-ishstabilize-15117.48.B-ishstabilize-15117.111.B-ishrelease-R114-15437.B-ishrelease-R113-15393.B-ishrelease-R112-15359.B-ishrelease-R111-15329.B-ishrelease-R110-15278.B-ishrelease-R109-15237.B-ishrelease-R109-15236.B-ishrelease-R108-15183.B-ishrelease-R107-15117.B-ishishfirmware-ti50-prepvt-15315.B-ishfirmware-skyrim-15390.B-ishfirmware-skyrim-15369.B-ishfirmware-nissa-15217.B-ishfirmware-nissa-15217.45.B-ishfirmware-nissa-15217.126.B-ishfirmware-duplo-15151.B-ishfirmware-corsola-15194.B-ishfactory-trogdor-15210.B-ishfactory-skyrim-15384.B-ishfactory-nissa-15199.B-ishfactory-corsola-15197.B-ishfactory-corsola-15196.B-ishfactory-brya-15231.B-ishMike Frysinger2022-09-141-2/+2
| | | | | | | | | | | | | | 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: I5b357b85ae9473a192b80983871bef4ae0d4b16f Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3893394 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* usbpd: implement new api to access PD discovery dataDeepti Deshatty2021-09-201-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | API pd_get_am_discovery() sets the lock (task access bit) to keep track of EC tasks accessing the pd port discovery data. If any of the task access bits are set,EC host task typec discovery handler will return EC_RES_BUSY to host, indicating discovery data is modified while copying port discovery data to the host. Hence the lock/task access bit should be set only when the port discovery data is modified by any tasks. Setting of lock/task access is removed from pd_get_am_discovery() and implemented new api pd_get_am_discovery_and_notify_access() for this. pd_get_am_discovery() proto type is changed to return 'constant pointer' which forces developers to use pd_get_am_discovery_and_notify_access() when they intend to access and modify discovery data. summary of changes implemented. - Remove setting of task access bit from pd_get_am_discovery(). - modify pd_get_am_discovery() prototype to return constant pointer. - implement new api pd_get_am_discovery_and_notify_access() - Replace calls to pd_get_am_discovery() with new api wherever discovery data is accessed and modified. BRANCH=none BUG=b:197466819 b:190390784 TEST=Verified 50 cold boot cycling with TBT device attached. Device detected in every cycle. Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Change-Id: I5b6f1f2b91d92ddbe58f3bf994f684abee948c02 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139858 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Separate discovery and mode initAbe Levkoy2021-09-101-0/+7
| | | | | | | | | | | | | Don't clear discovery data when resetting active modes during mode exit. BUG=b:141363146 TEST=make buildall BRANCH=firmware-volteer-13672.B-main Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I8052641bb850ce8486eb9c82641b41880cb97d65 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3123837 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPM: Rename enum tcpm_sop_type and its constantsAbe Levkoy2021-08-311-35/+35
| | | | | | | | | | | | | | | As a followup to CL:3104290, give the TCPCI TRANSMIT and RX_BUF_FRAME_TYPE types more consistent names. Most of them can be used for receiving, not just transmitting. Fix lint errors thus revealed. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I399ec479eacc18622fc4d3f55f8bdabf4560fcff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3125995 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPM: Remove enum pd_msg_typeAbe Levkoy2021-08-181-9/+0
| | | | | | | | | | | | | Convert usages of this enum to tcpm_sop_type. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I5fed273d72e7ad0e191db0cb0d121b70bdd9ecdb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104291 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPM: Rename enum tcpm_transmit_typeAbe Levkoy2021-08-181-31/+31
| | | | | | | | | | | | | | | Rename tcpm_transmit_type to tcpm_sop_type to reflect that it can be used for Rx as well. Describe it in comments. This prepares to consolidate enum pd_msg_type into this enum. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ife97d4ad51c48f2e832b94e007954919e236a309 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104290 Reviewed-by: Keith Short <keithshort@chromium.org>
* ALT-DP: Don't send DP_ATTENTION until after DP_CONFIGScott Collyer2021-07-171-0/+7
| | | | | | | | | | | | | | | | | | | | | | | This CL adds a new variable to the hpd state that enables the pd policy layer to inform the hpd->DP_ATTENTION converter that at least one DP_CONFIG message has been received. This control is used to make sure that DP_ATTENTION messages aren't sent prior the DFP_D being configured for DP port mode. Some port partners may get confused if DP_ATTENTION is sent prior to either DP_CONFIG or DP_STATUS. BRANCH=quiche BUG=b:192051705 TEST=verifed on kasumi (grunt) that the display is extended correctly following usbc hotplug events. Previously, this case was failing 1 out of 3-4 times. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I80d576de7fc0075be2b1a838d1ed764ae7828e8e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3035785 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* TCPMv2: Add new override function for getting default RpScott Collyer2021-07-081-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | This CL addes a new overridable function typec_get_default_current_limit_rp() which is used in place of CONFIG_USB_PD_PULLUP to retrieve the correct Rp value to reflect the current limit. This functionality is required for boards which are not per port symmetric. Unless this function if overridden in a board/basebard specific file, there is no change in functionality from present design. BUG=b:191793195 BRANCH=quiche TEST=verfied on Gingerbread that Rp = 3.0A is selected for C0 and Rp = 1.5A is selected for port C1. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I9ec9daa563f6b4f551b4890ae7a56767f7c26764 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2980435 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* common/usbc: Allow boards to determine DTS (CCD) portCaveh Jalali2021-06-111-0/+10
| | | | | | | | | | | | | | | | | | | | | | This adds support for a board specific function to determine if a particular port supports DTS (Debug and Test System) - more commonly known as the CCD port. Typically, only one port supports CCD and we should not enter debug accessory mode on non-CCD ports. The default implementation simply returns true which is equivalent to the original behavior. Boards can override board_is_dts_port() to limit entering debug accessory mode to specific ports. BRANCH=none BUG=b:188851792 TEST=buildall passes Change-Id: I10ad3cbed68478b23379b5f7ec6eff6ebae11084 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2954196 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* TCPMv2: Rename pd_can_source_from_deviceDiana Z2021-06-051-2/+2
| | | | | | | | | | | | | | Clarify the function name by changing it to "can charge from" since "source from" isn't a generally common phrase in PD terms. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Id7a40ac9d8d4c0007e8ff6cb25c2e8c2d006df0c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2923239 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* tcpmv2: Don't enable USB mode until PD state resolvedKeith Short2021-06-031-0/+10
| | | | | | | | | | | | | | | | | | | | | | Don't enable USB superspeed signals until the PD capability is known. This fixes an issue where platforms that enable the virtual USB mux violate the tSenderResponse timeout when the attached SRC sends the Source Capabilities message. BUG=b:187796705 BRANCH=none TEST=Volteer - connect PD charger, obsserve no hard reset TEST=Connect non-PD USB device, verify USB mode is enabled TEST=Connect USB+DP monitor, verify DP mode entry and USB mode enabled TEST=Connect USB4 dock, verify USB4 entry TEST=faft_pd test suite passes on Voxel Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I4be08874178d1e225cf41939b9626a81b0da0524 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2895424 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Tested-by: caveh jalali <caveh@chromium.org>
* dedede: Rework `extpower_is_present()`Aseda Aboagye2021-05-191-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | The dedede boards erroneously assumed that if VBUS was present, then "extpower" was present. "extpower" is generally connected to the ACOK signal for the battery charger IC. It indicates that the voltage present at the switching node is valid for bucking or boosting. For our Type-C systems, this needs to be at least 4V. However, just because VBUS is present doesn't mean that the voltage is present at the switching node. The FETs on the selected charge port needs to be enabled first. This commit simply changes the logic to check the battery charger ICs' ACOK status to reflect whether extpower is present. BUG=b:187965740 BRANCH=dedede TEST=Build and flash drawcia and madoo, verify that "AC on" prints are emitted when the charge port is selected and not just when VBUS appears on the port. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: If5a4a10d502f2f08ccf1d3228e42f48fa6d45909 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2901254 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* TCPMV2: Remove redundant chunking time constantsAbe Levkoy2021-04-131-2/+0
| | | | | | | | | | | | | | Remove PD_T_CHUNK_SENDER_REQ and PD_T_CHUNK_SENDER_RSP. They are redundant with PD_T_CHUNK_SENDER_REQUEST and PD_T_CHUNK_SENDER_RESPONSE. BUG=b:179443762 TEST=make buildall BRANCH=firmware-volteer-13672.B-main Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Idf12b08af92bbff57fc9a587d17367ade7d8cef3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2812139 Reviewed-by: Diana Z <dzigterman@chromium.org>
* PD_INT: Add ability to process non-TCPC alerts in PD_INTDiana Z2021-04-061-0/+7
| | | | | | | | | | | | | | | | Some boards may have other chips sharing the TCPC interrupt line, in which case their alerts may need to be handled at the same priority as the TCPC itself. Otherwise, it becomes difficult to respond quickly to TCPC interrupts. BRANCH=None BUG=b:182534117,b:183679237 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I905f20eeb0dd89c8516de31005d402a890906595 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2803460 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* TCPMv2: PE: Add mechanism to request source power roleScott Collyer2021-03-201-0/+11
| | | | | | | | | | | | | | | | | | | | | This CL makes the function pd_can_source_from_device() overridable. This default implementation is used in deciding whether to request a power role swap. By making this overridable, boards have the option of implementing custom per port policy for requesting power role swaps. BUG=b:182441965 BRANCH=None TEST=verfied that on quiche when attaching as a sink that a power role swap request is generated. Previously, quiche relied on the host requesting a power role swap. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I9c5bdb77405a6075de9c5b4269213f810a20cc6c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2722989 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Don't enter Tx BIST mode when VBUS > VSafe5VScott Collyer2021-03-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | By spec we are only allowed to enter BIST mode when VBUS is at vSafe5V. This CL adds a check in pe_bist_tx_entry to make sure that BIST test mode is only entered if VBUS is at the correct level. We compared to the expected nominal VBUS level and not the actual measured level as not all boards will have accurate enough VBUS measurements. BUG=b:180957710 BRANCH=None TEST=Verfied that quiche can pass the TDA.2.2.7 compliance test. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Icc2e5ff6c32374c89490e5bea79af2c4517ea295 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2738397 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMV2: Add support for (CT) Vconn Powered DevicesSam Hurst2021-03-171-0/+70
| | | | | | | | | | | | | | | | | | | | | Add support for Charge Through Vconn Powered Devices BUG=b:165934405 BRANCH=none TEST=make runtests 1) Verified that Apple VPD audio device worked. 2) With charger plugged into Chocodile_Vpdmcu, verified that a Voxel could be charged. 3) FAILED: Plugging Chocodile_Vpdmcu into Voxel first and then plugging in charger to Chocodile_Vpdmcu, Chocodile is detected as a Debug Accessory (CC1 = Rd and CC2 = Rd) and VCONN is never applied. Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I977b316dc531aa33bb6a236523c8ddbbb23014d0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2748429 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Debounce Vbus loss when FRS is enabledDiana Z2021-03-161-0/+7
| | | | | | | | | | | | | | | | | A hub may send a Fast Role Swap signal when Vbus is less than vSafe5V, so allow a 5ms debounce after Vbus loss for the signal to come in before we declare the connection detached. BRANCH=None BUG=b:180453483 TEST=on voxel, confirm FRS behaves normally Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: If56106660c0a2bf82e28b91129bc9dd367ebc8fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2718838 Tested-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Add support for disabling type-2 BIST modeScott Collyer2021-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | This CL adds a TCPCI method to disable BIST mode for the case where the TCPC does not handle the duration automatically. This is required for the ucpd driver as once type-2 BIST mode is started, the ucpd peripheral needs to be reset to stop. This CL also reduces the timer value from 60 msec to 55 msec to ensure that there is enough time for BIST to be stopped and still be in spec. BUG=b:182436876 BRANCH=None TEST=verifed on Quiche that when type-2 BIST is started then it stops when the timer in PE expires. This fixes TDA.2.1.1.1: BMC-PHY-TX-EYE Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I59ee7ac0dead09ac3a1b5783cfa3fe9db238eb7e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2660803 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* USB PD: Lower SinkWaitCap timerDiana Z2021-03-121-1/+1
| | | | | | | | | | | | | | | | | Currently, our SinkWaitCap timer is about 20 ms below the maximum. Lower an additional 25 ms to ensure we're hard resetting consistently in time during testing. This should still offer relatively generous time for the partner to begin sending source capabilities. BRANCH=None BUG=b:173027500 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I308ad2c5590aeeed8179ed482cf03a784a852840 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2728946 Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* TCPMv2: Add PD interface to asynchronously request TC Error RecoveryDiana Z2021-03-091-0/+10
| | | | | | | | | | | | | | | | | If a condition is reached outside the PD task which requires USB Type-C Error Recovery, it can now use pd_set_error_recovery() to request that the PD task execute this. Note that this will return before the error recovery has completed, which is in contrast to the suspend port behavior. BRANCH=None BUG=b:180453483 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I487e0da3ef65c201ff406500f0c95244b460afcb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2718836 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Change PD_T_PS_SOURCE_OFF valueEric Herrmann2021-03-031-1/+1
| | | | | | | | | | | | | | | | | | | PD_T_PS_SOURCE_OFF is 750 to 920 ms, currently it is set to the maximum value. But, we need to detect the state and take the exit action within this maximum time, which leaves no room for overhead if this is set to the maximum value. Instead, set to the midpoint value of 835ms. BUG=b:181055620 TEST=TD.PD.FRSISNK3.E5 on Voxel BRANCH=None Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Change-Id: I4b2b75332774ca0fb8e0913053739da6d58d428a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2730631 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: DPM: Add support for sending SVDM Attention messageScott Collyer2021-03-011-0/+31
| | | | | | | | | | | | | | | | | | | | | | | This CL adds a new DPM function to generate a request to the PE to send a SVDM Attention message via the DPM. This change deprecates pd_send_hpd from TCPMv2, which existed for the same purpose. pd_send_hpd is now part of the hpd->DP Attention converter. This path replaces the need to use pd_send_vdm which can't be reliably used with its current design. BUG=b:175660576,b:180465870 BRANCH=None TEST=Verified on quiche that can enter ALT-DP mode as a UFP-D and that display is extended properly via display port or hdmi connector. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I9f8817cb8d40f32b878abdc09db605097a32548b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691969 Tested-by: Keith Short <keithshort@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* TCPMv2: Reset discovery events on AP resetDiana Z2021-02-261-0/+8
| | | | | | | | | | | | | | | | | | | | When the AP resets, reset the SOP and SOP' discovery events so it knows there is completed discovery information to consume. Additionally, remove the requirement that events only be set from the port's PD task. Since this is just an atomic or of events and the setting of a host event, it should be safe to do from other tasks. BRANCH=None BUG=b:179505381 TEST=on galtic, verify events are reset after reboot with: - Apple 3-in-1 (SOP identity, no SOP') - TBT dock (both SOP and SOP' identity) - Active cable tied to another chromebook (SOP' identity, no SOP) Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ib2c49854fd4269c65e771565210fe88222c6e848 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2708785 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* common: Add board_is_usb_pd_port_present functionCaveh Jalali2021-02-241-0/+9
| | | | | | | | | | | | | | | | | | This adds a new overridable function to check if a USB PD port exists on a system. This is preferred over using board_get_usb_pd_port_count() or CONFIG_USB_PD_PORT_MAX_COUNT because it handles sparse port numbering. The "missing" port no longer needs to be the highest numbered port and call sites no longer need to implement the special checks for this case. BRANCH=none BUG=b:173575131 TEST=buildall passes Change-Id: I3f74eddd99c6901b42ce05bab6f2bdd545127d1a Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2700313 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Add DPM controls for FRS detectionDiana Z2021-02-081-0/+2
| | | | | | | | | | | | | | | Add a DPM request to control FRS detection enable and disable on a task. This allows the FRS detection to be safely toggled from other tasks when 3A port balancing occurs. BRANCH=None BUG=b:141690755 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I41d4f4a77f536c95a8119fef0de0474f0726fbab Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2676083 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Wait for tSrcTransition after AcceptAbe Levkoy2021-01-261-0/+1
| | | | | | | | | | | | | | | | | During power contract negotiation, after sending Accept, wait for tSrcTransition before transitioning the supply and sending PS_RDY. See PD r3.0, v2.0, Table 7-22. BUG=b:173023378 TEST=Pass TDA.2.1.2.2 using MQP compliance tester (or at least don't fail due to sending PS_RDY too early). BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I76e31ff5df6bfd71f78642bda25e1e8f9f590f9c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2644179 Reviewed-by: Diana Z <dzigterman@chromium.org> Tested-by: JC Huang <j.c.huang@quanta.corp-partner.google.com>
* TCPMv1/TCPMv2: Add functions providing requested voltage and currentPatryk Duda2021-01-221-0/+14
| | | | | | | | | | | | | | | | | This patch adds functions responsible for providing voltage and current requested from charger. This patch doesn't introduce any logical changes. BUG=b:161775827 BRANCH=none TEST=make -j buildall Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: Ib86285e4c4e6f2da3f922a8a4389e78706f1de96 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2592497 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* TCPMv2: Test that PE ignores invalid BIST requestsAbe Levkoy2021-01-221-1/+8
| | | | | | | | | | | | | | | Send the PE BIST requests with inappropriate VBUS voltages or inappropriate BIST modes. Verify that the PE ignores them. BUG=b:173023378,b:169385081,b:172709198,b:173028832,b:173028791 BUG=b:173141941,b:173142113 TEST=run-usb_pe_drp passes BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I240ff6746debcf49934419940ab4f49b54e2b7e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2639585 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Ignore BIST messages when appropriateAbe Levkoy2021-01-221-0/+1
| | | | | | | | | | | | | | Ignore BIST messages when not operating at vSafe5V. Ignore unsupported BIST modes. BUG=b:169385081 TEST=make buildall BRANCH=firmware-volteer-13672.B-main Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ia7504cf0f7cf16273aa641edb364eef7e666a3ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2602720 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: TCPMv2 Send message with timed response should hard reset within rangeDenis Brockus2021-01-201-0/+14
| | | | | | | | | | | | | | | | | | | | PE_SRC_Send_Capabilities is supposed to wait for 24ms before sending HardReset but that reset must be sent before 30ms. Setting the delay to 30ms will guarantee we never are within this range and will always be after it. TD.PD.SRC.E5 is guaranteed to fail with this set to 30ms BUG=b:177999668 BRANCH=zork TEST=make run-usb_tcpmv2_compliance Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I8d743680b62e5dea840c935f06eb987c8358e473 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2640228 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* TCPMv1: Replace charging allow listTing Shen2021-01-121-11/+0
| | | | | | | | | | | | | | | | This CL backports CL:2535217 to TCPMv1, and completely removes charging allow list. BRANCH=kukui BUG=b:175364716 TEST=on Burnet, verify DUT can charge from power bank. Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I89476c89fd4ab6d46acf880f7573b5deb8b2c0f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2603614 Reviewed-by: Diana Z <dzigterman@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* tcpmv2: always issue SOP' soft resetKeith Short2021-01-091-20/+21
| | | | | | | | | | | | | | | | | | | 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>
* BB retimer: Set UFP mode of BB retimerAyushee2021-01-071-0/+17
| | | | | | | | | | | | | | | | | | | | | This CL enables getting the enter mode information received from DFP and sets the following BB retimer bits accordingly. Bit 2: RE_TIMER_DRIVER Bit 18: CABLE_TYPE Bit 19: VPRO_DOCK_DETECTED Bit 20: TBT_ACTIVE_LINK_TRAINING Bit 22: ACTIVE/PASSIVE Bits 27-25: TBT Cable speed Bits 29-28: TBT_GEN_SUPPORT BUG=b:157163664 BRANCH=None TEST=Tested with volteer as UFP, able to set the retimer bits Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I661aa4630b42fbaa136ff3855c4f70e3dee61546 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2382634 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Remove PE_BIST_RX stateAbe Levkoy2021-01-061-11/+10
| | | | | | | | | | | | | | 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: support TBT Alt mode as UFPli feng2020-12-211-1/+7
| | | | | | | | | | | | | | | | | | | Implemented SVDM responders for TBT Alt mode BUG=b:148528713,b:157163664,b:162986785 BRANCH=none TEST=1. Build ec with CL:2382634; OS CPFE 13447, CB CPFE 13535 2. Boot up Volteer, run "pd trysrc 0" on EC console; 3. Then connect port 1 to TGL Windows RVP TBT port; 4. Thunderbolt connection is established. Volteer port 1 as UFP, Windows RVP TBT port as DFP. From host console, thunderbolt0 is listed as network interface in ifconfig. Signed-off-by: li feng <li1.feng@intel.com> Change-Id: If4c80418677f541e9c1c7c8c84446357000aaecb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2370045 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Aashay Shringarpure <aashay@google.com>
* TBT: Enter Thunderbolt mode if the cable response timesoutAyushee Shah2020-12-161-9/+1
| | | | | | | | | | | | | | | | | | | | If the passive superspeed cable doesn't support Intel SVID, then the Thunderbolt cable speed should be set to Passive Gen 2 cable. Ref: USB Type-C Cable and Connector Specification, Fig F-1. This commit, checks if the cable is superspeed before returning the thunderbolt cable speed and sets the overridable maximum speed supported by the board to TBT_SS_TBT_GEN3. BUG=b:172364575 BRANCH=None TEST=Tested on Voxel, able to enter Thunderbolt mode if the cable fails to respond to Discover SVID SOP' Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Change-Id: Ib5137670c08cbe17166f5a90241ddbcb77e059f7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2582988 Reviewed-by: Keith Short <keithshort@chromium.org>
* virtual mux: Wait for mux config ACK from the kernelDivya Sasidharan2020-12-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL: 1. Add a new config CONFIG_USB_MUX_AP_ACK_REQUEST to enable request for ACK from AP 1. Adds a new feature flag to inform the AP that an ACK is needed for boards supporting Burnside bridge retimer. 2. Adds a new host command for the EC to wait for mux config ACK for entering and exiting the safe mode. 3. Adds 12.5msec delay after configuring retimer and SoC as recommended. BUG=b:166300460,b:161327513 BRANCH=none TEST=Verify Type-C dock is functional with multiple hotplugs and flipped orientation. Verify USB3.0 is detected and not downgraded. Verify no regression with TBT3 and USB4 dock. Cq-Depend: chromium:2530517 Change-Id: I5b8224648f0fc36b30e24ca3e7254d708c676149 Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2366127 Commit-Queue: YH Lin <yueherngl@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* tcpci: Base retry count on active PD revAbe Levkoy2020-12-151-0/+9
| | | | | | | | | | | | | | | 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>
* usbc: Remove pd_ts_dts_plugged() check from PD_DRP_FORCE_SINKEdward Hill2020-12-111-8/+0
| | | | | | | | | | | | | | | | | | | | 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>
* TCPMv2: AP resume should consider Src->Snk swapDenis Brockus2020-11-251-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* TCPMv2: Store and report sink capsDiana Z2020-11-201-0/+14
| | | | | | | | | | | | | | | | | | | | | 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: Replace charging allow listDiana Z2020-11-201-0/+6
| | | | | | | | | | | | | | | | | | | 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>
* TCPMv2: Correct battery index detectionDiana Z2020-11-051-1/+11
| | | | | | | | | | | | | | | | | | 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>
* TCPMv2: Add support for USB4 active cableAyushee2020-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* TCPMv2: Add allow_list for partners that didn't set UP but should haveDenis Brockus2020-10-301-3/+6
| | | | | | | | | | | | | | | | | | Added three additional monitors and renamed the defines to tell what the PID is. BUG=b:171013724 BRANCH=zork TEST=connect new devices and make sure they source us Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Iaf18d6aaad40ff5ac8d8bb57bc2568a9256712bb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2509974 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* morphius: Wait 500ms before allowing DP event to cause resume.Edward Hill2020-10-301-1/+1
| | | | | | | | | | | | | | | | | Turning off the MST hub in S3 (via IOEX_HDMI_DATA_EN_DB) causes a VDM:Attention that immediately wakes us back up from S3. Wait 500ms after S3 entry before setting EC_MKBP_EVENT_DP_ALT_MODE_ENTERED in pd_notify_dp_alt_mode_entry(). BUG=b:167949458 BRANCH=zork TEST=powerd_dbus_suspend with display connected to MST hub DB Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I0d90d0a5130403b9aca1057725509814cac0d545 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2506424 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Add typeccontrol enter-mode subcommandAbe Levkoy2020-10-221-0/+12
| | | | | | | | | | | | | | | | | | 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>
* TCPMv2: Create charge allow_list and add devicesDenis Brockus2020-10-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The charge allow_list is for partner devices that do not advertise Unconstrained Power in their SRC_Caps but we should still charge from them if they are the SRC. The allow_list should be constrained to partners that perform dual role and do not present Unconstrained Power in their SRC_Caps. It is preferred for the partner to send this correctly but for products that are already out in the wild, it may be a really bad user experience for this to fail. BUG=b:170644500,b:170848849,b:170970249 BRANCH=zork TEST=connect E24d monitor and verify it charges DUT Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ib4f2c62af3bb2c1ed066ea4353ec26cd536a4c26 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2490729 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Report source capabilities in TYPEC_STATUSDiana Z2020-10-211-11/+2
| | | | | | | | | | | | | | | | 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>