summaryrefslogtreecommitdiff
path: root/common/mock
Commit message (Collapse)AuthorAgeFilesLines
* ish: Trim down the release branchstabilize-wristpin-14469.59.B-ishstabilize-voshyr-14637.B-ishstabilize-quickfix-14695.187.B-ishstabilize-quickfix-14695.124.B-ishstabilize-quickfix-14526.91.B-ishstabilize-14695.85.B-ishstabilize-14695.107.B-ishstabilize-14682.B-ishstabilize-14633.B-ishstabilize-14616.B-ishstabilize-14589.B-ishstabilize-14588.98.B-ishstabilize-14588.14.B-ishstabilize-14588.123.B-ishstabilize-14536.B-ishstabilize-14532.B-ishstabilize-14528.B-ishstabilize-14526.89.B-ishstabilize-14526.84.B-ishstabilize-14526.73.B-ishstabilize-14526.67.B-ishstabilize-14526.57.B-ishstabilize-14498.B-ishstabilize-14496.B-ishstabilize-14477.B-ishstabilize-14469.9.B-ishstabilize-14469.8.B-ishstabilize-14469.58.B-ishstabilize-14469.41.B-ishstabilize-14442.B-ishstabilize-14438.B-ishstabilize-14411.B-ishstabilize-14396.B-ishstabilize-14395.B-ishstabilize-14388.62.B-ishstabilize-14388.61.B-ishstabilize-14388.52.B-ishstabilize-14385.B-ishstabilize-14345.B-ishstabilize-14336.B-ishstabilize-14333.B-ishrelease-R99-14469.B-ishrelease-R98-14388.B-ishrelease-R102-14695.B-ishrelease-R101-14588.B-ishrelease-R100-14526.B-ishfirmware-cherry-14454.B-ishfirmware-brya-14505.B-ishfirmware-brya-14505.71.B-ishfactory-kukui-14374.B-ishfactory-guybrush-14600.B-ishfactory-cherry-14455.B-ishfactory-brya-14517.B-ishJack Rosenthal2021-11-0519-2617/+0
| | | | | | | | | | | | | | | | | | | | | | In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* TCPM: Rename enum tcpm_sop_type and its constantsAbe Levkoy2021-08-316-28/+28
| | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | 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-185-19/+23
| | | | | | | | | | | | | | | 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>
* USB MUX: Generalize mux ACKDiana Z2021-08-141-1/+5
| | | | | | | | | | | | | | | | | | | | Currently, only the virtual mux driver uses the mux ACK feature, but the actual wait for the host command ACK is a part of the usb_mux general code. Generalize this mux ACK wait so it's available if needed in the future for more muxes. Additionally, moving this wait out of the mux set will allow us to lock the muxes intelligently between tasks, without keeping the muxes locked during the inactive ACK wait. BRANCH=None BUG=b:172222942,b:186777984 TEST=tast typec.Mode*.manual on voxel Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I61a043425a482cc6f3170548c888d91ec20c2a82 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078411 Reviewed-by: Keith Short <keithshort@chromium.org>
* SenderResponseTimer: offset with TCPC transmit success timestampudaykiran2021-06-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | The SenderResponseTimer shall be used by the sender's policy engine to ensure that a message requesting a response is responded to within a bounded time. Which is 24Msec to 30 Msec. However, delays associated TCPC I2C, PE, and PRL layers make hard reset response time greater 30Msec. This CL address the delay associated with TCPC. When TCPC transmit success is reported by TCPC upon receiving the GoodCRC, time stamp is recorded. Another time stamp is recorded just before starting SenderResponseTimer and offsetting PD_T_SENDER_RESPONSE. BUG=b:182439366 BRANCH=none TEST=checked with GRL compliance tester. Noted that total response time is in the middle of the expected time of 24ms to 30ms. This fix achieved response time about 27.675ms Signed-off-by: udaykiran <udaykiran@google.com> Change-Id: Id2ddcdd90eed8b3d66ade3d16877004871a21de8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2971078 Reviewed-by: Diana Z <dzigterman@chromium.org>
* tcpmv2: Don't enable USB mode until PD state resolvedKeith Short2021-06-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | 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>
* Mock: Add hard reset to PRL mockDiana Z2021-05-171-1/+5
| | | | | | | | | | | | | | Add the ability to detect hard reset send through the PRL mock. Note that a hard reset is a transmit type, not a control or data message. BRANCH=None BUG=b:184764468 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Iac4e52a66b8282e8a0e341e65c4f437c6154fe77 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2897127 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* TCPC: Cleanup: Enable PPC from PD or Power MUXVijay Hiremath2021-04-201-1/+1
| | | | | | | | | | | | | | | Some PD chips have integrated SRC FET and control the SRC/SINK FET from GPIOs hence cleaned up the code to enable Power Path Control from either from PD or from Power MUX. BUG=none BRANCH=none TEST=make buildall -j Change-Id: I77f96b681fd2e5fca35bce425e4bd5ec87d5ccfd Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2828980 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Revert "fpsensor: Support building firmware that works for both sensors"Tom Hughes2021-04-071-37/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit ac08c9d1dbc9f587df3ee6b15d58c0203f7e356e. Reason for revert: Breaks public build Original change's description: > fpsensor: Support building firmware that works for both sensors > > This is a refactoring to allow building FPMCU firmware that works for > one FPC sensor and one ELAN sensor. > > 1. When both drivers implement our common functions, e.g. fp_sensor_init(), > rename them to fp_sensor_init_fpc() and fp_sensor_init_elan(). > 2. There are a few functions implemented not in FPC driver but in FPC > private library, e.g. fp_sensor_finger_status(). I kept this as-is for > FPC but renamed the one in ELAN driver to fp_sensor_finger_status_elan() > 3. If building for ELAN, need to hardcode elan=1 in hatch_fp/board.c > because the sensor type GPIO always says FPC. > > BRANCH=none > BUG=b:175158241 > TEST=make run-fpsensor; make run-fpsensor_status; > make run-fpsensor_crypto > TEST=make -j BOARD=dartmonkey > TEST=add CONFIG_FP_SENSOR_ELAN515 to board/hatch_fp/board.h; > make -j BOARD=bloonchipper > Firmware binary fully works on Dragonair (FPC) and Voema (ELAN) > TEST=run device tests with http://crrev/c/2750547 and > http://crrev/i/3654297 on Dragonclaw, all pass > > Change-Id: I789090dbdfe35ac6aefd6a629fa4c7bde89dc437 > Signed-off-by: Yicheng Li <yichengli@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727971 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> > Commit-Queue: Tom Hughes <tomhughes@chromium.org> Bug: b:175158241, b:184616069 Change-Id: I2a02a6eefc316e7e13aa188f1ae16672dce2babd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809521 Auto-Submit: Tom Hughes <tomhughes@chromium.org> Tested-by: Tom Hughes <tomhughes@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: caveh jalali <caveh@chromium.org>
* fpsensor: Support building firmware that works for both sensorsYicheng Li2021-04-021-15/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a refactoring to allow building FPMCU firmware that works for one FPC sensor and one ELAN sensor. 1. When both drivers implement our common functions, e.g. fp_sensor_init(), rename them to fp_sensor_init_fpc() and fp_sensor_init_elan(). 2. There are a few functions implemented not in FPC driver but in FPC private library, e.g. fp_sensor_finger_status(). I kept this as-is for FPC but renamed the one in ELAN driver to fp_sensor_finger_status_elan() 3. If building for ELAN, need to hardcode elan=1 in hatch_fp/board.c because the sensor type GPIO always says FPC. BRANCH=none BUG=b:175158241 TEST=make run-fpsensor; make run-fpsensor_status; make run-fpsensor_crypto TEST=make -j BOARD=dartmonkey TEST=add CONFIG_FP_SENSOR_ELAN515 to board/hatch_fp/board.h; make -j BOARD=bloonchipper Firmware binary fully works on Dragonair (FPC) and Voema (ELAN) TEST=run device tests with http://crrev/c/2750547 and http://crrev/i/3654297 on Dragonclaw, all pass Change-Id: I789090dbdfe35ac6aefd6a629fa4c7bde89dc437 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727971 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org>
* TCPMv2: Compliance Unit Test - allow PROC.PD.E3 flexibilityDenis Brockus2021-03-191-4/+9
| | | | | | | | | | | | | | | | | Allow the startup messages to be optional and don't require a specific ordering. Also add PR_Swap when PD_ROLE_UFP. BUG=none BRANCH=none TEST=make run-usb_tcpmv2_compliance Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ifef6fa558a789c2ce34a9f9fbf38529dc90d5e6f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774580 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org>
* TCPMv2: Preserve selected source current in FRSDiana Z2021-03-171-0/+4
| | | | | | | | | | | | | | | | | | | | When executing a fast role swap, ensure that any 3.0 A selected current is preserved through the select_current_limit_rp in the TC layer. Additionally, use this selected current to set our current limit when first attaching as a source. If FRS is disabled on a port, restore the default Rp value for the board. BRANCH=None BUG=b:180434465 TEST=Check that a 3A FRS device loaded over 1.5 A is able to successfully complete FRS Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I6e6b2f95066a3f8972664c6ac62b450e179e408d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2757096 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Add PD interface to asynchronously request TC Error RecoveryDiana Z2021-03-091-0/+4
| | | | | | | | | | | | | | | | | 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: Source out 3.0 A to non-PD portsDiana Z2021-02-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | When no PD sinks require 3.0 A and no FRS ports require it, offer this current level to non-PD sinking devices. The non-PD devices will be downgraded whenever a higher-priority type of port is connected. BRANCH=None BUG=b:141690755 TEST=on madoo, verify: - plugging in a flash drive, it is offered 3.0 A - plugging in a 3.0 A PD sink, flash drive CC resistor is downgraded - unplugging 3.0 A PD sink, flash drive CC resistor is back to 3.0 A - connect power to 3.0 A PD sink, flash drive CC resistor is back to 3.0 A With FRS config check commented out, verify: - flash drive is downgraded and FRS enabled on powered hub plug in - flash drive is back to 3.0 A on FRS hub detach Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Iaa5c3f0a6a4f41db83978bb1e1d0b54f2519abb2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2692030 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Allocate FRS ports 3.0 A when neededDiana Z2021-02-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When there are no PD sinks requiring 3.0 A, any FRS ports which require that much current will have FRS detection enabled. If a PD sink requiring 3.0 A is attached, then FRS detection will be disabled on that port again. FRS port partners which require only USB or 1.5 A of current will always have FRS detection enabled. BRANCH=None BUG=b:141690755 TEST=on volteer-based system, verify: - FRS source partners requiring 1.5 A or less always have FRS detection enabled - FRS detection is disabled on detach - FRS source partner requiring 3.0 A has FRS detection enabled if no PD sink needing 3.0 A is present - Plugging in a 3.0 A PD sink disables FRS detection for the 3.0 A FRS partner - Unplugging a 3.0 A PD sink enables FRS detection for the 3.0 A FRS partner - When FRS occurs on 3.0 A port with detection enabled, partner is offered appropriate starting current in first source caps Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ib067ac7c1c2f4a6e64f36aeffd1b8dde5cb93760 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2676084 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Eric Herrmann <eherrmann@chromium.org> Tested-by: Eric Herrmann <eherrmann@chromium.org>
* TCPMv2: Remove prl_resetAbe Levkoy2021-02-081-3/+0
| | | | | | | | | | | | | It is now unused in implementation code. BUG=b:179198412,b:173725284 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: If9ce77f5958d4ee168412b22bd77cba2c4d0ec49 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2679992 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Check charge port when bootingDiana Z2021-02-051-0/+5
| | | | | | | | | | | | | | | | | | When booting into S0, take the current charge port into account when deciding whether to power role swap. If the port has been selected from the UI as a charge port, then refrain from swapping and continue to charge from it. BRANCH=None BUG=b:179334214,b:179095748,b:178070314 TEST=on madoo, connect to magolor and select charging from magolor on the UI. Go through suspend and shutdown iterations and confirm that madoo continues to charge from magolor Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I40ef73309f75372b0a34a7542282244ff30868ed Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2676924 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* fpsensor: Add FP sensor SPI detection logicTom Hughes2021-01-291-0/+5
| | | | | | | | | | | | BRANCH=none BUG=b:177908650 TEST=Flash icetower v0.2, observed FP_SPI_SEL on console TEST=Flash nocturne, observed FP_SPI_SEL on console Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I2b221139fed817de4c58db3b6c8198942ab86e7b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2648731 Reviewed-by: Craig Hesling <hesling@chromium.org>
* docs: Run mdformat on all .md filesTom Hughes2021-01-281-41/+42
| | | | | | | | | | | BRANCH=none BUG=b:178648877 TEST=view in gitiles Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I0ac5581ba7bc512234d40dbf34222422afa9c725 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2650551 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* pd: fix superspeed mux steering on UFPVincent Palatin2021-01-251-0/+5
| | | | | | | | | | | | | | | | | | | | | When the device has a USB superspeed UFP (which is uncommon, this is either servo v4.1 or a laptop port in SS device-mode), if we connect as a sink *before* trying PD communication, we should connect the SS mux without waiting for the partner PD comm capability as we might never be able to communicate with it over PD. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=b:150614702 BRANCH=servo TEST=use the sink mode enabled by 'cc pdsnk', connect to a USB-C Chromebook, try both video output on USB-C->mini-DP and USB 3.0. Change-Id: Iea0409fce2cb7aca089814ae406a7c05848dd8e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2637647 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* charge_manager: Create mockAbe Levkoy2021-01-223-0/+51
| | | | | | | | | | | | | | | Allow tests to use a mock charge_manager. Do not build the real charge manager when this is used. BUG=b:173023378,b:169385081,b:172709198,b:173028832,b:173028791 BUG=b:173141941,b:173142113 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I49caccafd024515833880d7251092b77623d4a71 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2639584 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Do not check for SinkTxOk in FRS-ModeEric Herrmann2021-01-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | After an FRS signal, the initial sink will attempt to initiate the FR Swap AMS, and the initial source should apply SinkTxOk. If the initial source is removed entirely, FRS will be triggered butSinkTxOk will never be applied and this will get the initial sink state machine stuck. So, in the case of an FRS ignore the CC voltage. After an FRS signal, the source isn't allowed to initiate an AMS. BUG=b:171740860 TEST=On Volteer with the PS8815, enable FRS and remove the FRS device. Make sure we enter ErrorRecovery instead of hanging in PE_PRS_SNK_SRC_Send_Swap TEST=make buildall BRANCH=none Change-Id: I8373a76c0c19feeb909b0623a1ae2d6b0ad5fa60 Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633654 Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* COIL: Remove non-inclusive words from common mockDossym Nurmukhanov2021-01-121-3/+3
| | | | | | | | | | | BUG=none BRANCH=none TEST=make runhosttests Signed-off-by: dossym@chromium.org Change-Id: I7338c137540ddf08886887d66ac92e7b7d57911c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2622068 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* TCPMv2: Compliance Unit Test - TD.PD.SRC3.E7Denis Brockus2021-01-071-0/+74
| | | | | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Iaa6888d2e0d861d64b2747856465789304dde414 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613724 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* UnitTest: Create battery mock for tcpmv2_complianceDenis Brockus2021-01-072-0/+212
| | | | | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I1b06d512b3b869a300c981c4dd6bda54a236f342 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2614773 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* Move tcpic.h header into include/driverSimon Glass2021-01-071-1/+1
| | | | | | | | | | | | | | | | | | This header cannot currently be accessed by Zephyr since it is in a driver directory, not an include directory. This header has quite a bit of public stuff in it, so it seems reasonable to consider everything public. Move the header file and update all users. BUG=b:175434113 BRANCH=none TEST=make buildall -j30 build volteer on zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ibba37f47a06783fafb5095f853f2a68d92b6df87 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2607745
* TCPMv2: Compliance Unit Test - allow rx with data to have timeoutDenis Brockus2021-01-061-2/+6
| | | | | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Iafbb0dd23a72ef32a1b3100fdfdeaf57c58b51f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613249 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* TCPMv2: Compliance Unit Test - add display for EXT messagesDenis Brockus2021-01-061-30/+56
| | | | | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I6d1f1ea59c07fa36d5817b9d3a8615ac633964d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613247 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* TCPMv2: Compliance Unit Test - TD.PD.SRC.E2Denis Brockus2020-12-301-0/+23
| | | | | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I0b498d56dd189e3360fd1498acbfb5314c9870d0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2602844 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Unit Test - reflect TCPCI registers initial valuesDenis Brockus2020-12-291-1/+103
| | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I262e99c7442acca0118250764017f942239ed493 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2604561 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Unit Test - remove unused out parameterDenis Brockus2020-12-281-9/+4
| | | | | | | | | | | | | | | | | | In an earlier cleanup, the need for returning the original transmit type value became no longer needed. So remove it. BUG=none BRANCH=none TEST=make builadll Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I8fe30d7a9a87325bda6c4da6b4a5070b2d3ee6c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2604560 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Update source-out configsDiana Z2020-12-241-0/+6
| | | | | | | | | | | | | | | | | | | | Now that the DPM will be handling source-out decisions for TCPMv2, remove references to its old configuration options from TCPMv2 boards in order to avoid any confusion as to what code is running now. Also remove the charge manager notifications of sink attach/detach since the policy is being centralized into the DPM. Note that the previous configuration options only ever allocated one 3.0 A port, and so the default number of 3.0 A ports has been set to 1. BRANCH=None BUG=b:168862110,b:141690755 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ie452e3da32b04226503539daa67b6b9f4a58aa58 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597431 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: DPM sourcing policy - 3.0 A PD sinksDiana Z2020-12-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Move the sourcing policy from the charge_manager to the DPM for TCPMv2. The first step of this policy will be to allocate 3.0 A only if a peripheral reports requiring more than 1.5 A in their Sink Capabilities vSafe5V operational current. For this commit, leave in some charge_manager APIs for linking which will be re-named or removed later. BRANCH=None BUG=b:141690755,b:168862110 TEST=on drawcia verify: - non-PD sink only offered 1.5 A Rp - PD sink requiring 1.5 A or less Rp isn't offered 3.0 A - PD sink requiring 3.0 A is offered a new 3.0 A Source Capability after sink capability probing. Port continues to receive 3.0 A over both hard and soft resets. - When 2 3.0 A sinks are plugged in, only the first is offered 3.0 A. After the first is unplugged, the second receives a 3.0 A source capability message Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Iec48312df1125086db2919c1503c7ba31fe12bcc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597429 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Remove test/usb_tcpmv2_tcpci.cEdward Hill2020-12-181-50/+0
| | | | | | | | | | | | | | Remove test/usb_tcpmv2_tcpci.c to avoid duplication with test/usb_tcpmv2_compliance.c BUG=none BRANCH=none TEST=make run-usb_tcpmv2_compliance Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: Ie62d0f7e2cc30c3086e03103a43dede5515006b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597598 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPMv2 test: Check all transmitsEdward Hill2020-12-171-1/+11
| | | | | | | | | | | | | | | | | Be explicit about checking all transmitted messages to avoid getting out of sync. Fix retries check in TD.PD.LL.E3, retries are handled by TCPC. BUG=b:175144677 BRANCH=none TEST=make run-usb_tcpmv2_compliance Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I017244c669e0c50e49b8974a7462007625c354ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597597 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Unit Test TD.PD.LL.E3 Soft Reset UsageDenis Brockus2020-12-171-5/+454
| | | | | | | | | | | | | | BUG=b:175144677 BRANCH=none TEST=make run-usb_tcpmv2_compliance Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I629e2811b2cba5aa9821d8c855e039a6cfaa32ce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2595816 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* mock: Clean up TCPMv2 mocksAbe Levkoy2020-12-155-102/+88
| | | | | | | | | | | | | | | | | | | | | | 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>
* test: Improve test_send_caps_error in usb_pe_drpEdward Hill2020-12-011-27/+63
| | | | | | | | | | | | | Better mock tx and rx messages, add sop type. BUG=b:161835483 b:173791979 BRANCH=none TEST=make run-usb_pe_drp Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: If1f91b6385d6841d662a8a6262af6382645da92e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2553343 Reviewed-by: Diana Z <dzigterman@chromium.org>
* common/mock: Make sure mocks are only in the test buildTom Hughes2020-10-3116-1/+64
| | | | | | | | | | | BRANCH=none BUG=b:171370392 TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I1517a7080bd4853918ffc7127d44e1955d925789 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2510455 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* TCPMv2: Avoid VCONN-Source discovery failureAbe Levkoy2020-10-211-1/+2
| | | | | | | | | | | | | | | | | Remove redundant checks for VCONN Source in pe_attempt_port_discovery (which prevent discovery from running). Allow pe_vdm_send_request to attempt to become VCONN Source if necessary. Make the checks in the VDM request child states more complete (not just checking for VCONN Source). BUG=b:170662791 TEST=Attach Tapex Creek board; observed successful discovery BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Id7d3a1b82d1029f69b3e05b845632e7237524bc6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2486303 Tested-by: Li1 Feng <li1.feng@intel.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Avoid alt mode files from changing DPM statesAyushee2020-10-141-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | USB4 mode: Added a function to check if the USB4 entry is completed Thunderbolt mode: Added 2 flags TBT_RETRY_DONE, TBT_EXIT_DONE to track the Thunderbolt mode's exit and if retry is needed and a new function to check if if the Thunderbolt mode entry is completed DisplayPort mode: Added a function to check if the DisplayPort entry is completed BUG=b:169169804 BRANCH=None TEST=1. Able to enter alternate mode on hotplug and reboot 2. Able to exit the alternate mode on chipset transition and on DPM's exit mode request. Change-Id: I09662449143ad8d94b30ae102ed5ce79db852687 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2421425 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TBT:Add support for exit mode SOP'/SOP'' on chipset transitionAyushee2020-10-141-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When chipset is transitioning to a new state or on sysjump, the EC re-negotiates to enter an alternate mode on booting up. This commit adds support for exiting Thunderbolt mode for SOP' and SOP'' for active cable on chipset transition and also moves all the alternate mode exit rotines to their respective files. It also delays deleting the SVID data until after the EXIT_MODE message has ACKed and avoids pd_dfp_exit_mode() from changing the alternate mode's internal states. This commit also makes sure that the mux is set to safe state before exiting the alternate mode and it is reconfigured according to the port's current data role on receiving ACK/NAK from the cable/port partner. BUG=b:151169925, b:159717794 BRANCH=none TEST=On reboot, able to exit and re-enter into DisplayPort mode, Thunderbolt mode with passive cable and thunderbolt mode with active cable. Change-Id: If1e48e9f31cd678e23fe89bd3494551b5d1a78f1 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2415082 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Add VBUS_REMOVED levelDiana Z2020-10-011-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | For boards which use Vbus ADCs, add a VBUS_REMOVED check level. The level for VBUS_PRESENT should be used in any locations looking for "Vbus is present" on transition, but in order to correctly detect disconnection with a load on Vbus, VBUS_REMOVED (vSinkDisconnect) is required. TODO statements have been added for places where work will be needed to support vSinkDisconnectPD in the future. For boards detecting Vbus through an external chip, the levels will likely be indistinguishable due to the chips setting a lower threshold for disconnect than for connection. Unit test code has also been added to encourage new Vbus levels to be added to the mock, and remind developers to update all locations using the vbus_level enum. BRANCH=None BUG=b:168831161 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I04014ce54ec162dd9c62f545126d921c6d880741 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2436580 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* test: Add test_send_caps_error to usb_pe_drpEdward Hill2020-09-222-21/+66
| | | | | | | | | | | | | | | | | As requested in CL:2321869 review, make a new version of test_send_caps_error that uses the external interface of the PE layer. BUG=b:161835483 BRANCH=none TEST=make run-usb_pe_drp Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I983b145cd1e731e844363955896898a2374a0a30 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2419834 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* TCPMv2: Define typeccontrol host commandAbe Levkoy2020-09-211-0/+8
| | | | | | | | | | | | | | | For now, just support exiting the entered mode, if that mode happens to be DisplayPort (getting TBT3 and USB4 to work correctly will require some more work). Support this command in ectool. BUG=b:168030639 TEST=ectool typeccontrol 0 1; observe DP Exit Mode exchange in PD trace BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ib30479cc88696115060e9ff74f6815ce074e6bf5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2415069 Reviewed-by: Diana Z <dzigterman@chromium.org>
* usb_pe_drp: new unit test with mocksPaul Fagerburg2020-08-316-8/+288
| | | | | | | | | | | | | | | | | | | Add a new unit test for usb_pe_drp with mocks for the various subsystems that it will use. The fake_prl module is already essentially a mock for the PRL layer, so just move it into the mocks directory and make it available as mock to other tests. BUG=b:163421994 BRANCH=None TEST=`make runhosttests` succeeds Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: I2aea3fa0694e8d9e6bae1f47516cb4d5d2a1e714 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2364050 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* fpsensor: Run maintenance when in maintenance modeTom Hughes2020-08-311-0/+5
| | | | | | | | | | | | BRANCH=none BUG=b:76037094 TEST=make buildall -j Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ibe8649c3cf77ef4542b5fc46d7df5eee03293b56 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2364755 Commit-Queue: Craig Hesling <hesling@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org>
* tcpmv2: wait before enabling HW auto toggleJett Rink2020-08-131-0/+10
| | | | | | | | | | | | | | | We need to ensure that the previous Rd or Rp has been held long enough before we transition into hardware auto toggle otherwise the first toggle might be too short and violate the DRP timing spec BRANCH=none BUG=b:163095971 TEST=Verify on scope Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I92e9f5ca7dbca2b347e438d774551cc11476195b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2343176 Reviewed-by: Edward Hill <ecgh@chromium.org>
* mock/usb_pd_mock: remove tc functionsPaul Fagerburg2020-08-121-8/+0
| | | | | | | | | | | | | Remove tc_set_data_role and tc_set_power_role from usb_pd_mock. BUG=b:163421165 BRANCH=None TEST=`make runhosttests`, all unit tests pass Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Change-Id: Ib380d2f04f833b58e23a16d0c6421316b72329fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2349282 Reviewed-by: Jett Rink <jettrink@chromium.org>