1# PD FAFT 2 3PD FAFT is another set of firmware tests (FAFT), which targets testing USB-C and 4PD (Power Delivery) functionalities. 5 6[TOC] 7 8## Overview {#overview} 9 10The USB-C and PD stack is complex that involves multiple hardware/firmware: 11 12* TCPM (USB Type-C Port Manager), 13 [integrated in EC, using Chrome EC firmware](https://chromium.googlesource.com/chromiumos/platform/ec/+/master/docs/usb-c.md) 14* TCPC (USB Type-C Port Controller), usually using proprietary firmware, in 15 the form of 16 * dedicated chip, like ANX74xx, PS8xxx, 17 * integrated in EC, like IT83xx, or 18 * integrated in PMIC, like MT6370. 19 20The USB-C path also has other functions, like: 21 22* DisplayPort, which shares the SuperSpeed lanes and the SBU channel; 23* CCD, which shares the SBU channel and has special CC terminations. 24 25Many USB-C bugs are mysterious or flaky, like CCD not being detected, USB 26Ethernet connection being lost, or external monitors not showing up, etc. This 27kind of issue blocks BIOS/EC FAFT running. Some bugs may be even more serious 28that brick the hardware, negotiating a wrong voltage/current. 29 30PD FAFT was proposed to uncover any regression on the PD stack in an automated 31way. 32 33PD FAFT requires hardware to emulate the PD port partner, e.g. a PD-capable 34power adapter, a USB-C hub, a USB-C debug accessory, a USB-C protocol converter, 35a USB-C monitor, etc. The first version of PD FAFT uses 36[Plankton](https://www.chromium.org/chromium-os/plankton) as PDTester. The 37latest version uses 38[ServoV4](https://chromium.googlesource.com/chromiumos/third_party/hdctools/+/master/docs/servo_v4.md) 39as PDTester. 40 41## Test details {#test-details} 42 43The PD FAFT tests are located in the Autotest tree as directories, usually with 44the prefix firmware\_PD. 45 46firmware\_PDConnect, checks: 47 48* Ability to disconnect, then reconnect establishing a successful PD contract 49* If PD Dual role mode is operational in the DUT 50 51firmware\_PDPowerSwap, checks: 52 53* If the DUT advertises support for dualrole operation 54* If the DUT can receive power swap requests 55* If the DUT can initiate power swap requests 56 57firmware\_PDDataSwap, checks: 58 59* If the DUT advertises support for data role swaps 60* If the DUT can receive data swap requests 61* If the DUT can initiate data swap requests 62 63firmware\_PDResetHard, checks: 64 65* Ability of DUT to initiate hard resets 66* Ability of DUT to receive hard resets 67* If DUT is dualrole capable, hard resets are done with the DUT in each power 68 role 69 70firmware\_PDResetSoft, checks: 71 72* Ability of DUT to initiate soft resets 73* Ability of DUT to receive soft reset requests from Plankton 74* If DUT is dualrole capable, soft resets are done with the DUT in each power 75 role 76 77firmware\_PDTrySrc, checks: 78 79* If the DUT advertises support for dualrole and Try.SRC operation 80* A series of disconnects/connects with Try.SRC on 81* A series of disconnects/connects with Try.SRC off 82* Try.SRC on the DUT connects in SRC mode 83 84firmware\_PDVbusRequest, checks: 85 86* Ability to initiate a new PD contract with different VBUS value, according 87 to the attached charger capability, like 5V, 9V, 12V, 15V, 20V, etc. 88* Receiving Source Capability messages from PDTester 89* If PD Dual role mode is operational in the DUT 90 91The above tests may have multiple subtests, the same test body but different 92prerequisite. 93 94.flip subtest, checks 95 96* If DUT passes the same test on the flipped plug direction, which is 97 implemented by electrically flipping the CC signals on PDTester 98 99.dts subtest, checks 100 101* If DUT passes the same test on a USB-C debug accessory 102* No behavior difference between the normal scenarios and the CCD scenarios 103 (it is important as BIOS/EC FAFT uses the CCD setup) 104 105## How to run PD FAFT {#how-to-run-pd-faft} 106 107Hardware setup, check this 108[ServoV4 Type-C with servo micro setup](https://chromium.googlesource.com/chromiumos/third_party/autotest/+/refs/heads/master/docs/faft-how-to-run-doc.md#servov4-typec-micro). 109 110Software setup, check this 111[Running Tests instructions](https://chromium.googlesource.com/chromiumos/third_party/autotest/+/refs/heads/master/docs/faft-how-to-run-doc.md#faft-running-tests). 112 113## Known issues {#known-issues} 114 115### TCPMv2 {#tcpmv2} 116 117PD FAFT by far only supports testing DUT using TCPMv1. Porting to TCPMv2 is in 118progress. 119 120### Multiple USB-C ports {#multiple-usb-c-ports} 121 122Due to the hardware limitation, that PDTester (ServoV4) only supports testing 123one DUT-facing USB-C port at a time. If a DUT has two USB-C ports, you have to 124run PD FAFT twice -- once for each port under test. 125