1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
|
# 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.
if PLATFORM_EC_USBC
menuconfig PLATFORM_EC_USB_POWER_DELIVERY
bool "USB Type-C Power Delivery (PD)"
default y
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_USB_PD_HOST_CMD
bool "Host commands related to USB Power Delivery"
default y
help
This enables host commands which allow finding out the capabilities
of USB PD, checking is status and controlling how it operates. For
devices which support firmware update, this is provided as well,
with the firmware being sent from the AP.
config PLATFORM_EC_CONSOLE_CMD_MFALLOW
bool "Console command: mfallow"
default y
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_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
bool "Support USB Type-C VCONN"
default y
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 if the board needs dynamic PDO selection.
DPS picks a power efficient PDO regarding to the underlying battery
configuration and the system loading.
Default configuration can be overridden by `dps_config` to adapt
to each board's need.
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_REV30
bool "USB PD Rev3.0 functionality"
default y
help
Enable this to allow Rev3.0 functionality, including features such as
Fast Role Swap, advertising the available power across all ports of a
multi-port charger, and USB4. If disabled, only USB Power Delivery
Rev2.0 functionality is supported.
This defaults to y because PD Rev3.0 is required for USB4
functionality.
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_ALT_MODE_DFP
bool "Downward Facing Port support"
default y
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_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_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_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_HOSTCMD_PD_CONTROL
bool "Host command: EC_CMD_PD_CONTROL"
default y
help
Enable the EC_CMD_PD_CONTROL host command. This allows control
of the USB-PD chip from the AP, including reset, suspend/resume
and enabling power.
This host command can be manually executed using the
"ectool pdcontrol" command from the Chromium OS shell.
config PLATFORM_EC_USB_PD_LOGGING
bool "Host command: EC_CMD_PD_GET_LOG_ENTRY"
help
Enable logging of USB Power Delivery events. The AP can request the
log to see what has happened recently.
The log events are stored in a circular buffer, each one being a
struct event_log_entry.
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_USB4
bool "USB4 support"
depends on PLATFORM_EC_USB_PD_REV30
default n
help
This enables support for entering into USB4 mode between two port
partners. The provides new features such as higher speeds and more
flexible multiplexing of data on the cable for different purposes,
e.g. attaching multiple displays and storage devices on the same bus.
config PLATFORM_EC_USB_PD_TBT_COMPAT_MODE
bool "Thunderbolt-compatible mode support"
depends on PLATFORM_EC_USB_PD_REV30
default n
help
Enable this to allow entering into Thunderbolt-compatible mode between
two port partners. This does not require that USB4 mode be enabled.
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_CONFIG_USB_PD_3A_PORTS
int "Number of USBC ports that can supply 3A"
default 1
help
Ensure that CONFIG_USB_PD_TCPMV2 is not being used with charge_manager source
defines, and define a default number of 3.0 A ports if not selected. Note
that the functionality of this default of 1 is equivalent to both previous
defines, which only ever allocated one 3.0 A port.
To turn off the TCPMv2 3.0 A current allocation from the DPM, set
CONFIG_USB_PD_3A_PORTS to 0.
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.
endif # PLATFORM_EC_USB_POWER_DELIVERY
endif # PLATFORM_EC_USBC
|