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