| # Copyright 2022 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| menuconfig PLATFORM_EC_USB_POWER_DELIVERY |
| bool "USB Type-C Power Delivery (PD)" |
| default y |
| depends on PLATFORM_EC_USB_PD_TCPMV2 |
| help |
| USB has always provided basic power to an attached peripheral. USB-C |
| PD is part of the USB 3.0 standard and allows a lot more functionality |
| than the basic 500mA @ 5V. It allows negotiating power delivery over |
| the USB cable to select voltages up to 20V with current up to 5A. |
| |
| This option also enables the Type-C Port Manager (TCPM) on the EC. The |
| TCPM deals with the various state changes in the system as devices are |
| plugged and unplugged, as well as changes in power requirements from |
| those devices. |
| |
| if PLATFORM_EC_USB_POWER_DELIVERY |
| |
| config PLATFORM_EC_CONSOLE_CMD_MFALLOW |
| bool "Console command: mfallow" |
| default y |
| depends on CONFIG_USB_PD_DP_MODE |
| help |
| Controls whether multi-function support is allowed for DP (Display |
| Port) connections. Default setting allows multi-function support when |
| the attached device also supports multi-function mode. |
| |
| mfallow <port> [true | false] |
| |
| config PLATFORM_EC_CONSOLE_CMD_PD |
| bool "Console command: pd" |
| default y |
| help |
| Provides information about the current USB Power Delivery state and |
| also allows various changes to be made for testing purposes. |
| |
| It has a number of subcommands: |
| |
| pd dump <n> - sets the debug level (0-3). This affects all layers |
| of the stack |
| pd trysrc [0/1/2] - prints or sets the Try.SRC override. Use 0 to |
| force Try.SRC off, 1 to force Try.SRC on, and 2 to |
| let USB PD stack control the Try.SRC behavior. |
| pd version - show PD version in use |
| pd <port> state - show start for a PD port |
| |
| Ssee usb_pd_console.c for full details including various commands |
| for role swap, reset, enable/disable, requesting SNK or SRC, etc. |
| |
| config PLATFORM_EC_USB_PD_DEBUG_FIXED_LEVEL |
| bool "USB Power Delivery debug level is fixed at build time" |
| help |
| Enable this to set the debug level to a fixed value in the build. |
| This saves space but means that the level cannot be changed using |
| commands like 'pd dump'. Typically this should be set when a platform |
| is shipped. |
| |
| config PLATFORM_EC_USB_PD_DEBUG_LEVEL |
| int "Debug level to use" |
| depends on PLATFORM_EC_USB_PD_DEBUG_FIXED_LEVEL |
| help |
| Sets the value of the debug level to use. If this is 0 then no |
| debugging output is available from the USB Power Delivery stack. |
| The meaning of each level depends on the module in question, but |
| the maximum available level is 3. |
| |
| config PLATFORM_EC_USB_PD_INITIAL_DEBUG_LEVEL |
| int "Initial debug level to use" |
| default 1 |
| help |
| Sets the initial value of the debug level to use, while |
| still allowing the debug level to be changed using 'pd dump'. |
| A value of 0 will initially disable debug logging, and values 1 |
| through to 3 will increase the level of debug logging. |
| If this config is not set, the default level will be set to 1. |
| |
| config PLATFORM_EC_USB_PD_DEBUG_INTERVALS |
| bool "Whether to build USB PD interval debugging support" |
| default false |
| help |
| Enable this to build a framework to record custom time intervals and |
| print them out at convenient points with respect to each USB-C port. |
| This config does not directly enable any recording. The developer must |
| define the intervals and choose when to print the results. |
| |
| config PLATFORM_EC_USB_PD_FLAGS |
| bool "Whether to build USB PD flag support" |
| default 1 |
| help |
| Enable this to support checking the USB PD configuration via flags. |
| The usb_pd_flags modules provides functions such as |
| get_usb_pd_vbus_detect to get the type of VBUS detection performed on |
| this platform. |
| |
| if PLATFORM_EC_USB_PD_FLAGS |
| |
| config PLATFORM_EC_USB_PD_RUNTIME_FLAGS |
| bool "Whether to set PD flags at runtime" |
| default false |
| help |
| Sets PD flag values at runtime instead of based on static CONFIG_* |
| settings. The usb_pd_flags module provides functions such as |
| set_usb_pd_vbus_detect to set how VBUS detection will be performed on |
| this platform. |
| |
| endif # PLATFORM_EC_USB_PD_FLAGS |
| |
| config USB_PD_XID |
| int "USB XID" |
| default 0 |
| help |
| Sets the device XID reported for USB-C Authentication. Devices that |
| have not been submitted for certification and assigned XIDs by USB-IF |
| should use 0. |
| |
| config PLATFORM_EC_USB_PD_5V_EN_CUSTOM |
| bool "Custom method of detecting VBUS" |
| help |
| Enable this if your board needs a custom method to determine if VBUS |
| is enabled on a source port. You must provide an implementation of: |
| |
| int board_is_sourcing_vbus(int port) |
| |
| It should return 0 if not sourcing VBUS on that port and non-zero |
| if sourcing. |
| |
| config PLATFORM_EC_USB_PD_5V_CHARGER_CTRL |
| bool "Ask charger if VBUS is enabled on a source port" |
| help |
| Enable this if the charger controls VBUS on a source port. |
| The function charger_is_sourcing_otg_power is called |
| to determine if VBUS is enabled on the source port. |
| |
| config PLATFORM_EC_USBC_VCONN_SWAP |
| bool |
| help |
| Enable VCONN swap support. This is a helper symbol and should not be |
| manually enabled or disabled. |
| |
| config PLATFORM_EC_USBC_VCONN |
| bool "Support USB Type-C VCONN" |
| default y |
| select PLATFORM_EC_USBC_VCONN_SWAP |
| help |
| This enables support for USB Type-C connector voltage (VCONN). This |
| option must be enabled to communicate with electronically marked |
| (E-Mark) cables. This option is required for operation with USB4 and |
| Thunderbolt devices. |
| |
| This is not needed for captive cables. |
| |
| config PLATFORM_EC_USB_PD_DUAL_ROLE |
| bool "Board can act as a dual-role Power Delivery port" |
| default y |
| help |
| This enables support for switching between source and sink during |
| operation. This means that the port can accept power (e.g. to charge |
| up its battery), or send out power to an attached device on the same |
| port. |
| |
| menuconfig PLATFORM_EC_USB_PD_DPS |
| bool "Board can support Dynamic PDO Selection" |
| depends on PLATFORM_EC_BATTERY |
| depends on PLATFORM_EC_USB_POWER_DELIVERY |
| default n |
| select HAS_TASK_DPS |
| help |
| Enable this to permit dynamic PDO selection (DPS). DPS can select different |
| USB PDOs depending on system load and battery configuration to select input |
| characteristics (particularly voltage) that allow the system to operate more |
| efficiently. |
| |
| This should not be enabled without evaluating charger efficiency against |
| input voltage and overriding `dps_config` as necessary to accurately reflect |
| actual platform behavior: untuned behavior is likely to be worse than |
| leaving DPS disabled. |
| |
| config PLATFORM_EC_USB_PD_DUAL_ROLE_AUTO_TOGGLE |
| bool "Board can use TCPC-controlled DRP toggle" |
| depends on PLATFORM_EC_USB_PD_DUAL_ROLE |
| default y |
| help |
| Enable this if the USB Type-C Port Controllers (TCPC) used on the |
| board supports toggling of the power role autonomously. When this is |
| disabled, the USB power delivery task is responsible for manually |
| toggling the power role. |
| |
| config PLATFORM_EC_USB_PD_EXTENDED_MESSAGES |
| bool "USB 3.0 Extended Message Support" |
| default y |
| depends on PLATFORM_EC_USB_PD_REV30 |
| help |
| Support USB PD 3.0 Extended Messages. Note that Chromebooks disabling |
| this config item are non-compliant with PD 3.0, because they have |
| batteries but do not support Get_Battery_Cap or Get_Battery_Status. |
| |
| config PLATFORM_EC_USB_PD_ALT_MODE |
| bool "USB Power Delivery alternate mode" |
| default y |
| help |
| Enable this to support USB PD alternate mode. This allows negotiation |
| of a different mode of operation to allow non-USB traffic to pass over |
| a USB Type-C link. This makes use of some or all of the USB 3.0 bus |
| differential pairs. If all are used for the alternate mode, then USB |
| transmission is not available at all while in this mode. |
| |
| config PLATFORM_EC_USB_PD_REQUIRE_AP_MODE_ENTRY |
| bool "USB Power delivery requires AP to enter alternate modes" |
| depends on PLATFORM_EC_USB_PD_ALT_MODE |
| help |
| Do not enter USB PD alternate modes or USB4 automatically, Wait for |
| the AP to direct the EC to enter a mode. This requires AP software |
| support. |
| |
| config PLATFORM_EC_USB_PD_VDM_AP_CONTROL |
| bool "USB Power Delivery VDMs may be sent by the AP" |
| depends on PLATFORM_EC_USB_MUX_AP_CONTROL |
| select PLATFORM_EC_USB_PD_REQUIRE_AP_MODE_ENTRY |
| help |
| Allow the AP an interface to send any VDM REQ message it would like |
| to. This allows the AP to fully drive the alternate mode entry |
| process, and requires that the AP also be able to control the USB |
| muxes in order to sequence that mode entry. |
| |
| config PLATFORM_EC_USB_PD_ALT_MODE_DFP |
| bool "Downward Facing Port support" |
| default y |
| depends on PLATFORM_EC_USB_PD_DISCOVERY |
| help |
| Enable support for USB Power Delivery alternate mode of Downward |
| Facing Port. |
| |
| TODO: Add more help here |
| |
| config PLATFORM_EC_USB_PD_ALT_MODE_UFP |
| bool "Upward Facing Port support" |
| help |
| Enable support for USB Power Delivery alternate mode of Upward |
| Facing Port (UFP). |
| |
| By default, Chromium OS only enables alternate modes (Display Port, |
| USB4, Thuderbolt, etc) when the USB data role resolves to the |
| Downstream Facing Port (DFP) role. Enable this option to support |
| USB4 and ThunderBolt operation when the Chromium OS data role |
| resolves to the UFP role. |
| |
| config PLATFORM_EC_USB_PD_DISCOVERY |
| bool "Enable EC to direct Discover VDMs" |
| default y |
| help |
| This enables support for the EC probing and storing the various |
| partner discovery messages (DiscoverIdentity, DiscoverModes, |
| DiscoverSVIDs). |
| |
| config PLATFORM_EC_USB_PD_USB32_DRD |
| bool "Port is capable of operating as a USB3.2 device" |
| default n |
| help |
| Enable this if the board's USB Power Delivery Downward Facing Port is |
| capable of operating as both a USB Host (DFP, assumed by default) and a USB |
| Device (UFP): it is a Dual-Role Data (DRD) device. |
| |
| This is advertised to port partners so they can potentially take advantage |
| of the additional features available. |
| |
| config PLATFORM_EC_USB_PD_DP_HPD_GPIO |
| bool "Hotplug Detect (HPD) is controlled by an EC GPIO" |
| help |
| Enable this if the EC must send the Hotplug Detect (HPD) signal to |
| the DisplayPort Graphics Processing Unit (GPU) via a GPIO. Otherwise |
| this is sent by the display device. |
| |
| config PLATFORM_EC_USB_PD_DP_HPD_GPIO_CUSTOM |
| bool "Custom handling of HPD GPIO" |
| depends on PLATFORM_EC_USB_PD_DP_HPD_GPIO |
| help |
| Enable this if the Hotplug Detect (HPD) GPIO level has to be handled |
| by custom functions. In this case your board must implement a |
| function to enable the feature for a port and another function to |
| check the current state: |
| |
| void svdm_set_hpd_gpio(int port, int enable); |
| |
| int svdm_get_hpd_gpio(int port); |
| |
| config PLATFORM_EC_USB_PD_DP_HPD_GPIO_IRQ_ACCURATE |
| bool "Generate a more acuurate IRQ_HPD pulse" |
| depends on PLATFORM_EC_USB_PD_DP_HPD_GPIO |
| default y if SOC_IT8XXX2 |
| help |
| Enable this if the IRQ_HPD pulse interval HPD_DSTREAM_DEBOUNCE_IRQ |
| is longer than the requirement. This is common on ITE EC due to |
| performance issue. |
| |
| config PLATFORM_EC_USB_PD_DATA_RESET_MSG |
| bool "Enable the PD Data Reset Message." |
| depends on PLATFORM_EC_USB_PD_REV30 |
| help |
| Enable this to support the Data Reset PD message flows. This is |
| mandatory for products supporting USB4 but optional for other PD 3.0 |
| products. |
| |
| config PLATFORM_EC_USB_TYPEC_SM |
| bool "Type-C (TC) physical-layer state machine" |
| default y |
| help |
| This enables the bottom layer of the TCPMv2 state machine which |
| handles using CC lines to set the voltage-level of the power supplied. |
| You should normally define this unless you want to override it in your |
| board code, which is not recommended. |
| |
| config PLATFORM_EC_USB_PRL_SM |
| bool "Protocol layer (PRL) state machine" |
| default y |
| help |
| This enables the middle layer of the power-delivery (PD) protocol, |
| which deals with the flow of power messages across the USB Type-C |
| interface. You should normally define this unless you want to override |
| it in your board code, which is not recommended. |
| |
| config PLATFORM_EC_USB_PE_SM |
| bool "Policy engine (PE) state machine" |
| default y |
| help |
| This enables the top layer of the power-delivery (PD) protocol, which |
| deals with the actually PD messages that are exchanged with attached |
| USB devices. You should normally define this unless you want to |
| override it in your board code, which is not recommended. |
| |
| config PLATFORM_EC_USB_DPM_SM |
| bool "Device Policy Manager (DPM) state machine" |
| default y |
| help |
| This enables the device policy manager portion of the power-delivery |
| (PD), protocol which is used to define port policy decision. You |
| should normally define this unless you want to override it in your |
| board code, which is not recommended. |
| |
| config PLATFORM_EC_USB_PD_DECODE_SOP |
| def_bool y # Required for TCPMV2 |
| help |
| This enables support for encoding of the message's Start Of Packet |
| (SOP, SOP' and SOP'', collectively called SOP*) in bits 31-28 of the |
| 32-bit msg header type. |
| |
| config PLATFORM_EC_USB_PD_PRL_EVENT_LOG |
| bool "Log PRL state changes to a ring buffer" |
| help |
| Logs every PRL layer state change to a ring buffer, allowing those |
| events to be inspected at a later time with the `prllog` console |
| command. |
| |
| Logging to a ring buffer instead of increasing the overall PD log |
| verbosity has a much smaller effect on overall performance than |
| synchronous prints, making it easier to debug timing-sensitive |
| behavior. |
| |
| config PLATFORM_EC_USB_PD_PRL_EVENT_LOG_CAPACITY |
| int "PRL state log buffer capacity" |
| depends on PLATFORM_EC_USB_PD_PRL_EVENT_LOG |
| default 128 |
| help |
| Sets the number of entries stored in the PRL event log. Larger values |
| store a longer history but require more RAM. When the buffer is |
| filled, the oldest entries are replaced with new ones as they are |
| logged. |
| |
| config PLATFORM_EC_USB_PD_TRY_SRC |
| bool "Enable Try.SRC mode" |
| depends on PLATFORM_EC_USB_DRP_ACC_TRYSRC |
| default y |
| help |
| This enables Try.SRC mode so that the board will try to be a source |
| for power if the other end offers both options. This can be useful |
| for laptops, for example, since when attaching to a cellphone we want |
| the laptop to charge the phone, not vice versa. |
| |
| config PLATFORM_EC_USB_PD_DP21_MODE |
| bool "Enable DP2.1 Support" |
| depends on PLATFORM_EC_USB_PD_DP_MODE |
| help |
| This enables support for entering DisplayPort alternate mode 2.1 as |
| a DFP from the Embedded Controller directly. |
| |
| config PLATFORM_EC_USB_PD_STARTUP_DELAY_MS |
| int "PD thread startup delay time in milliseconds" |
| default 0 |
| help |
| Have the USB-PD thread(s) delay this many milliseconds after startup |
| before beginning regular processing. This can be helpful if external |
| processes need to happen shortly after reset and PD initialization may |
| interfere with them. |
| |
| For instance, if the EC enters programming mode when it receives a special |
| signal but requires USB-PD power in order to remain alive, PD |
| initialization can cause the system to reset and interrupt programming. |
| Adding a delay to startup can provide a wider window to enter programming |
| mode and help prevent such issues. |
| |
| config PLATFORM_EC_USB_PD_TEMP_SENSOR |
| int "Temperature sensor used in PD messages" |
| depends on PLATFORM_EC_TEMP_SENSOR |
| default 0 |
| help |
| Temperature related fields in USB PD messages assume a device only has |
| one temperature. But, Chromebooks can have multiple temperature sensors. |
| This option selects which temperature sensor is used for USB PD. |
| |
| config PLATFORM_EC_USB_PD_SHORT_PRESS_MAX_MS |
| int "Time limit in ms for short presses with a USB PD power button" |
| default 4000 |
| help |
| USB PD supports power buttons over USB-C using button press and button |
| release alerts. How a chromeOS device responds depends on whether the button |
| press is considered short or long. This config is used to set the short press |
| time limit in ms. Any press shorter will be a short press and any press |
| longer will either be a long press or invalid. |
| |
| config PLATFORM_EC_USB_PD_LONG_PRESS_MAX_MS |
| int "Time limit in ms for valid presses with a USB PD power button" |
| default 8000 |
| help |
| USB PD supports power buttons over USB-C using button press and button |
| release alerts. If a USB PD partner sends a press but never a release alert, |
| the EC should time out while waiting for the release and return to an idle |
| state. This value sets how long the EC waits for a release alert from the |
| partner in ms. Any press longer than this will not be considered a valid USB |
| PD button press. |
| |
| config PLATFORM_EC_USB_PD_EPR |
| bool "USB PD Extended Power Range support" |
| depends on PLATFORM_EC_USB_PD_REV30 |
| default n |
| help |
| This enables support for EPR (Extended Power Range). |
| |
| config PLATFORM_EC_USB_PD_RESET_PRESERVE_RECOVERY_FLAGS |
| bool "Workaround for cros_ec_softrec_power on chromeboxes" |
| help |
| cros_ec_softrec works by running `reboot wait-ext ap-off-in-ro`. If a |
| chromebox is powered by Type-C only, the EC reset will result in a PD |
| hard reset and the device will brown out. When it boots again the |
| ap-off and stay-in-ro flags are lost so recovery fails. To work around |
| this, we preserve the flags across a PD reset. |
| |
| This doesn't affect manual recovery on user devices, since it uses the |
| recovery signal from the GSC, not the reset flags. |
| |
| This should only be enabled on chromeboxes which don't have servo |
| micro and therefore can't use cros_ec_hardrec_power. See b/293545949 |
| and b/295363809. |
| |
| config PLATFORM_EC_USB_PD_INT_STORM_MAX |
| int "Interrupt limit per second" |
| default 1800 |
| help |
| Maximum rate of interrupts from PD stack (per second) that EC |
| can support without causing a watchdog. |
| |
| config PLATFORM_EC_USB_PD_EVENT_DRIVEN_CC_STATE |
| bool "Interrupt event driven CC state change detection" |
| default n |
| help |
| Enable interrupt event driven CC state change detection instead of |
| polling CC state from TCPC |
| |
| config PLATFORM_EC_USBC_PD3_T_SENDER_RESPONSE_OVERRIDE |
| bool "override for PD3_T_SENDER_RESPONSE" |
| default n |
| help |
| enable PD3_T_SENDER_RESPONSE value override. |
| |
| config PLATFORM_EC_USBC_PD3_SENDER_RESPONSE_MS |
| int "Value for PD3_T_SENDER_RESPONSE" |
| depends on PLATFORM_EC_USBC_PD3_T_SENDER_RESPONSE_OVERRIDE |
| default 29000 |
| help |
| configure PD3_T_SENDER_RESPONSE value. |
| |
| rsource "Kconfig.svdm_rsp" |
| |
| endif # PLATFORM_EC_USB_POWER_DELIVERY |