summaryrefslogtreecommitdiff
path: root/include/usb_pd_dpm.h
Commit message (Collapse)AuthorAgeFilesLines
* TCPM: Rename enum tcpm_sop_type and its constantsAbe Levkoy2021-08-311-2/+2
| | | | | | | | | | | | | | | 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: Rename enum tcpm_transmit_typeAbe Levkoy2021-08-181-2/+2
| | | | | | | | | | | | | | | 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>
* TCPMv2: Source out 3.0 A to non-PD portsDiana Z2021-02-191-0/+8
| | | | | | | | | | | | | | | | | | | | | | | 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/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Report correct source-out current in host commandDiana Z2021-02-081-0/+8
| | | | | | | | | | | | | | | | The EC_CMD_USB_PD_POWER_INFO host command was still querying the older charge_manager source current tracking. Instead, when TCPMv2 is defined the DPM should be treated as the authority for source-out current. BRANCH=None BUG=b:177714628 TEST=on drawcia, connect hub requiring 3A and confirm that value is reported from "ectool usbpdpower" Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I65f4fb976f0ab90f4d20f6573c1002ed80ff9532 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2676081 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Update source-out configsDiana Z2020-12-241-0/+9
| | | | | | | | | | | | | | | | | | | | 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/+17
| | | | | | | | | | | | | | | | | | | | | | | | | 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: Add typeccontrol enter-mode subcommandAbe Levkoy2020-10-221-0/+3
| | | | | | | | | | | | | | | | | | 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: Avoid alt mode files from changing DPM statesAyushee2020-10-141-8/+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>
* TCPMv2: Add common function for DPM entry and exit modeAyushee2020-07-171-12/+2
| | | | | | | | | | | | | | | | Added a common entry point into DPM for entering or exiting modes. BUG=b:155890173 BRANCH=None TEST=Tested on volteer, able to enter and exit 1. DisplayPort mode with type-C dock 2. Thunderbolt mode with a Thunderbolt dock Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I3bb996d96d0fff543ad7a2e1dc8e09d0b17d0171 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2299840 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Add common exit mode for all the alternate modesAyushee2020-07-171-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | When chipset is transitioning to a new state or on sysjump, the SOC re-negotiates to enter an alternate mode on booting up. This commit: 1. Adds a common DPM function to check for all the active alternate modes one at a time, construct the VDM and send the DPM request to exit the mode. 2. Marks thunderbolt mode as inactive in DFP's thunderbolt mode exit function. BUG=b:152235216 BRANCH=None TEST=Tested on volteer: 1. On connecting a DP dongle, able to enter into DP alternate mode on reboot 2. On connecting a Thunderbolt dock, able to enter into Thunderbolt mode on reboot Change-Id: I7da6a4b08cab9abb3446c0dafdc7c9e9378ef00e Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2270877 Tested-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Separate DPM and DP from PEAbe Levkoy2020-06-101-0/+62
Create separate modules representing DisplayPort (which decides whether and how we can set up the DP alt mode) and the Device Policy Manager (which decides whether we should). The end goal is to have essentially all code with DP-specific decisions or information in the DP module and all code with DPM-specific decisions or information in the DPM module. This will allow the PE to map as directly as practical to its behaviors defined in the PD spec. Essentially detach PE_DO_PORT_DISCOVERY from the rest of the PE state machine in preparation for deleting it. This change paves the way for 1) Allowing the AP to drive mode entry and 2) Allowing new alt modes to be supported via largely self-contained modules. BUG=b:155890173 TEST=Attach DP dongle; observe discovery and DP setup via Twinkie BRANCH=none Change-Id: Ie63a2e62d1ac6178722477dc53244898a04ef92f Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2203842 Reviewed-by: Diana Z <dzigterman@chromium.org>