summaryrefslogtreecommitdiff
path: root/board/servo_v4/usb_pd_policy.c
Commit message (Collapse)AuthorAgeFilesLines
* servo_v4: Added dts_mode on/off control for DUT port connectionScott2017-04-071-14/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | Added a new static variable disable_dts_mode. By default, DUT port will attempt to connect as a DTS source. However, if disable_dts_mode is set via a console command, the DUT port will connect as a regular source device. Charging behavior is identical between the two modes. In DTS mode, Rp is presented on both CC lines. When it's disabled Rp is presented only on CC1. Added tables to support the appropriate VNC and RD voltage thresholds. BUG=b:36908939 BRANCH=servo TEST=Tested with new console command 'dts on|off'. If new mode equals the current mode, no action is taken. If the mode is different, then verified that DUT port connects as DTS following 'dts on' and regular SRC following 'dts off'. Verifed this when the command is issued when connected to the DUT or disconnected. Validated that the H1 console is present for DTS mode and not present when DTS mode is disabled. Change-Id: Ie649709d6b2bbe947708d05eac42fde61d2677a8 Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/468447 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: Set desired data role for DUT port to UFPScott2017-03-261-10/+11
| | | | | | | | | | | | | | | | | | The default for servo_v4 DUT port is to be SRC to charge the DUT, but a UFP data role so that the DUT's usb mux gets connected. BUG=b:35586526 BRANCH=servo TEST=Connect to Electro and verify that servo_v4 data role is that of UFP and that electro is getting an IP address from the enet port on servo_v4. Change-Id: I8f2e4242777bf879598852004096f683d68c091c Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/452725 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: pd: Updated CC_NC and CC_RA macrosScott2017-03-261-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previous boards that implemented tcpc layer on chip didn't support variable Rp values. However, servo_v4 can present any of the 3 possible Rp values and therefore the voltage thresholds that are used to determine a no-connect or Ra attach status need a way to be set based on the Rp value that's current attached to a given CC line. - Added port and cc line selection to both the CC_NC and CC_RA macros and now check if they are already defined before being defined in usb_pd_tcpc.c. - Defined each of these macros in board.h to use a function that's able to select the threshold based on the current Rp configuration. BUG=b:35586526 BRANCH=servo TEST=Tested with servo_v4 against Electro and verified that it connects when a charger is and is not connected to CHG port which exercises the differnt Rp combinations that servo_v4 presents. Change-Id: I1a31e430c0f290486f0fa8a50bdafdddf20d23ca Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/451962 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: Enable VBUS passthrough from CHG to DUT portScott2017-03-241-36/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL adds support for the DUT port to advertise different current levels via the Rp resistor selection. The default setting is USB (500 mA). The board_manage_chg_port function relies on the off->on transitions only occurring when the CHG port is in a steady state condition. When the charger being used supports PD messaging, the entry point pd_set_input_current_limit() which is called after receiving a PS_RDY message. For TypeC only chargers, the entry point is typec_set_input_current_limit() which is called from SNK_DISOVERY after only after the max number of hard reset attempts have been attempted. This is intended to prevent this entry point from being called when a USB PD charger is connected and the CHG port enters SNK_DISCOVERY. When the CHG port Vbus transitions from off->on, a src_pdo is updated to reflect the current contract on the CHG port and this src_pdo can then be used by the DUT port when either a new connection is done or to update it's existing contract. BUG=b:35586526 BRANCH=servo TEST=Manual Connected servo_v4 DUT port to Reef with no charger connected. Verified that it connects, and CCD mode in Reef is enabled (H1 console is available) and that only 500 mA charging current is advertised. Then connected a 20V and 15V USB PD charger to the CHG port. In each case verified that the DUT renegotiates to the 20 and 15V level respectively. Repated the test with Guppy and verifed that VBUS is at 5V 3A. When Guppy is removed, then the DUT connection reverts back to the host as the VBUS source. Change-Id: I1a5eb346bbe1f0d586cb8b7bb24d77ff713fbf3c Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/449954 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: Support to enable Type C DTS modeScott2017-02-011-8/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Defined the config option CONFIG_USB_PD_DTS to board.h. - Added ccd_set_mode function in board.c - Removed ccd attach/detach functions from board.c as that function is - now integrated in the the usb_pd state machine. - Removed the fixed polarity that was being used in usb_pd_config.h so that the DUT port could connect as a SNK device. - Defined PD_ROLE_DEFAULT to override the value in usb_Pd.h so that CHG is SNK and DUT is SRC This set of changes allows servo_v4 to act like a suzyq. Hoever, PD messaging is still not supported. The CHG port can still connect as a SNK device, but VBUS on the DUT is only being provided by the host and not the CHG port. BUG=chrome-os-partner:61878 BRANCH=None TEST=Manual Connected zinger to CHG port and verifed via servo_v4 console that it reached SNK_READY. Connected DUT port to Reef and verified that it reached SRC_ACCESSORY state and that the correct SBU polarity was selected and that lsusb shows H1 as a USB device. Bus 003 Device 042: ID 18d1:5014 Google Inc. Change-Id: I4a0ab2468f383a3ba4db3a3236bb18df6a2c405a Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/428309 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* servo_v4: Added initial USB PD support for both CHG/DUT portsScott2017-01-091-0/+184
| | | | | | | | | | | | | | | | | | | | | | | - CHG port can connect as SNK at different voltage levels - DUT port presents as SNK only - DUT port uses fixed polarity since it has a fixed cable - Not supporting ALT or ALT_DP modes in terms of svdm messages at this point. - No support yet for USB mux. BUG=chromium:571476 BRANCH=None TEST=Manual CHG port: Tested with Zinger and Plankton and 5/12/20V VBUS levels. DUT port: Tested against Reef and verified that port reached SNK_READY. Change-Id: Ib645872790912f9e0a0d4adddc10345a59145d3e Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/424413 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* Revert "servo_v4: Added initial USB PD support for both CHG/DUT ports"Scott Collyer2016-12-281-184/+0
| | | | | | | | | | | This reverts commit 167f7e51d8e7693a277077d6c24294d2997e1c55. This CL followed https://chromium-review.googlesource.com/#/c/422450/ which needs to be reverted because PSTATE is required for keeping serial numbers. Change-Id: Icb26043e1ce3145a9d9d5ad159dc709e6b8bf98d Reviewed-on: https://chromium-review.googlesource.com/422480 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* servo_v4: Added initial USB PD support for both CHG/DUT portsScott2016-12-211-0/+184
- CHG port can connect as SNK at different voltage levels - DUT port presents as SNK only - DUT port uses fixed polarity since it has a fixed cable - Not supporting ALT or ALT_DP modes in terms of svdm messages at this point. - No support yet for USB mux. BUG=chromium:571476 BRANCH=None TEST=Manual CHG port: Tested with Zinger and Plankton and 5/12/20V VBUS levels. DUT port: Tested against Reef and verified that port reached SNK_READY. Change-Id: Idbdc963ba077a14efad9eea3b047f35a5a605bd6 Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/419117 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>