summaryrefslogtreecommitdiff
path: root/zephyr/Kconfig.usbc
blob: 924349b6bc5d869bb4dd61548671d66e50d93602 (plain)
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
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

config PLATFORM_EC_USBC
	bool "Enable USB Type-C functionality"
	default y
	help
	  Enable this to support various USB Type-C features chosen by the
	  options below. USB-C is widely used on modern Chromebooks and the EC's
	  role is to negotiate power contracts (for sourcing or sinking power
	  over USB). The EC is also responsible for discovering the capabilities
	  of attached USB-C partners and enabling alternate operational modes,
	  including Display Port, Thunderbolt, and USB4.

if PLATFORM_EC_USBC

config PLATFORM_EC_USB_POWER_DELIVERY
	bool "Enable support for USB Type-C Power Delivery"
	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.

config PLATFORM_EC_CHARGE_MANAGER
	bool "Enable the charge manager"
	default y
	help
	  The EC charge manager manages charging the battery from all supported
	  power sources.  This includes dedicated charge ports (such as a
	  barrel jack connector), BC1.2 (Battery Charging 1.2) sources, and
	  USB-C sources. When multiple charge sources are connected to a
	  Chromebook simultaneously, the charge manager is responsible for
	  picking the best source.

	  Note that the charge manager assumes that at least one USB-C power
	  source is available on the hardware, so cannot be built without
	  PLATFORM_EC_USBC.

config PLATFORM_EC_CHARGER_INPUT_CURRENT
	int "Charger input current in mA"
	default 512
	help
	  This is the default input current for the board in mA.  Many boards
	  also use this as the least maximum input current during transients.

	  This value should depend on external power adapter, designed charging
	  voltage, and the maximum power of the running system. For type-C
	  chargers, this should be set to 512 mA in order to not brown-out
	  low-current USB charge ports in accordance with USB-PD r3.0 Sec. 7.3

config PLATFORM_EC_USBC_OCP
	bool
	help
	  USB-C overcurrent protection: Enable this to detect when a connected
	  USB-C partner draws too much power from the Chromebook and
	  automatically shut off power to the USB-C partner.

	  This should be enabled by drivers which can detect over-current. It
	  cannot be set otherwise, even in prj.conf

config PLATFORM_EC_USB_PD_HOST_CMD
	bool "Enable 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_USB_PD_PORT_MAX_COUNT
	int "Maximum number of USB PD ports supported"
	default 2
	help
	  This sets the limit on the number of PD ports supported on the
	  device. This is used to set the size for tables used by devices.

	  TODO(b/176237074): Can we calculate this from the devicetree at some
	  point? Or update the sn5S330 driver to use an 8-bit flag byte for
	  source_enabled[] so that plenty of ports are supported without this
	  configuration option?

choice "Measuring VBUS voltage"
	prompt "Select how VBUS voltage is measured"

config PLATFORM_EC_USB_PD_VBUS_MEASURE_NOT_PRESENT
	bool "VBUS voltage cannot be read"
	help
	  Enable this if the board does not provide any mechanism for the EC to
	  read the analog VBUS voltage.

config PLATFORM_EC_USB_PD_VBUS_MEASURE_CHARGER
	bool "On-board charger supports VBUS measurement"
	help
	  Enable this if the VBUS voltage can be read using a charger on the
	  board.

config PLATFORM_EC_USB_PD_VBUS_MEASURE_TCPC
	bool "Type-C Port Controller supports VBUS measurement"
	help
	  Enable this if the VBUS voltage can be read using the on-board
	  TCPC.

config PLATFORM_EC_USB_PD_VBUS_MEASURE_ADC_EACH_PORT
	bool "VBUS on each port is measured using an ADC channel"
	help
	  Enable this is there is a separate ADC channel for each USB-C VBUS
	  voltage.

endchoice  # Measuring VBUS voltage

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.

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_DISCHARGE
	bool "Board can discharge VBUS"
	default y
	help
	  Enable this if the board can enable VBUS discharge (eg. through a
	  GPIO-controlled discharge circuit, or through port controller
	  registers) to discharge VBUS rapidly on disconnect

choice "Discharge method"
	prompt "Select the discharge method"
	depends on PLATFORM_EC_USB_PD_DISCHARGE

config PLATFORM_EC_USB_PD_DISCHARGE_GPIO
	bool "GPIO control"
	help
	  Enable this if the discharge circuit is controlled by a GPIO

	  TODO: How to specify the GPIO?

config PLATFORM_EC_USB_PD_DISCHARGE_TCPC
	bool "Discharge circuit is provided by the TCPC"
	help
	  Enable this if the discharge circuit is provided by Power-Delivery
	  resistors on the USB Type-C Port Controller (TCPC).

config PLATFORM_EC_USB_PD_DISCHARGE_PPC
	bool "Discharge circuit is provided by the PPC"
	help
	  Enable this if the discharge circuit is using Power Delivery
	  resistors on the Power Path Controller.

endchoice  # Discharge method

if  PLATFORM_EC_USB_POWER_DELIVERY

config PLATFORM_EC_CONFIG_USB_PD_REV30
	bool "Enable 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.

choice "VBUS detection method"
	prompt "Select the method to detect VBUS"

config PLATFORM_EC_USB_PD_VBUS_DETECT_TCPC
	bool "TCPC detects VBUS"
	help
	  Choose this option if the TCPC can detect the presence of VBUS

config PLATFORM_EC_USB_PD_VBUS_DETECT_CHARGER
	bool "Charger detects VBUS"
	help
	  Choose this option if the battery charger can detect the presence
	  of VBUS

config PLATFORM_EC_USB_PD_VBUS_DETECT_PPC
	bool "PPC detects VBUS"
	help
	  Choose this option if the Power-Path Controller (PPC) can detect the
	  presence of VBUS

config PLATFORM_EC_USB_PD_VBUS_DETECT_NONE
	bool "No way to detect VBUS"
	help
	  Choose this option if it is not possible to detect VBUS.

endchoice  # VBUS detection method

config PLATFORM_EC_USB_TYPEC_SM
	bool "Enable 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 "Enable 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 "Enable 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.

choice "USB-C device type"
	prompt "Select the USB-C device type"
	default PLATFORM_EC_USB_DRP_ACC_TRYSRC

config PLATFORM_EC_USB_VPD
	bool "VCONN-Powered Device"
	help
	  This enables support for supplying power to devices that accept power
	  over the USB VCONN line.

	  See here for details:

	  https://www.usb.org/sites/default/files/D1T2-3a%20-%20CTVPDs%20and%20Making%20Your%20Own%20USB-C%20Thingamajig.pdf

config PLATFORM_EC_USB_CTVPD
	bool "Charge-Through VCONN-Powered Device"
	help
	  This enables support for supplying power to devices, with a circuit
	  that deals with this without needing the involvement of the main
	  device.

config PLATFORM_EC_USB_DRP_ACC_TRYSRC
	bool "Dual-Role Port, Audio Accessory, and Try.SRC Device"
	help
	  This is the most flexible option, allowing the port to operate in
	  a dual-role capacity, so that power can be accepted or supplied on
	  a port.

endchoice  # USB-C device type

endif  # PLATFORM_EC_USB_POWER_DELIVERY

config PLATFORM_EC_USBC_PPC
	bool "Enable support for USB Type-C Power Path Controller"
	default y
	help
	  Enable this to support the USB Type-C PPC on your board. This enables
	  common routines for things like figuring out whether power is being
	  supplied to the Chromebook over USB-C, whether the Chromebook is
	  supplying power to another device, etc.

if PLATFORM_EC_USBC_PPC

config PLATFORM_EC_USBC_PPC_SN5S330
	bool "Support the TI SN5S330 PD 3.0 power mux"
	select PLATFORM_EC_USBC_OCP
	help
	  This is a USB Type-C Power Delivery 3.0 Bidirectional Power Mux with
	  CC and SBU short-to-VBUS Protection and Integrated Dead Battery
	  LDO. This chips provides protection against pins shorting to Vbus as
	  well as ESD (Electostatic discharge) protection. It provides a simple
	  I2C interface for for Mode Selection, Fast Role Swap, and Fault
	  Reporting.

config PLATFORM_EC_USBC_PPC_SYV682X
	bool "Support the SYV682X which is some kind of chip"
	select PLATFORM_EC_USBC_OCP
	help
	  The SYV682A is a 2 to 1 power mux switch for USB PD applications. The
	  SYV682A supports dead battery wake up function and Fast Role Swap
	  features. It provides protection against overcurrent, overvoltage,
	  thermal shutdown, and undervoltage conditions.

config PLATFORM_EC_USB_PD_TCPM_TUSB422
	bool "Support the TI TUSB422 Port Control with USB PD"
	help
	  This is a a USB PD PHY that enables a USB Type-C port with the
	  Configuration Channel (CC) logic needed for USB Type-C ecosystems. It
	  integrates the physical layer of the USB BMC power delivery (PD)
	  protocol to allow up to 100-W of power and support for alternate mode
	  interfaces. An external microprocessor, containing USB Type-C Port
	  Manager (TCPM), communicates with the TUSB422 through an I2C
	  interface.

choice "Type-C Port Manager (TCPM)"
	prompt "Choose a Type-C Port Manager (TCPM) to manage TCPC"

config PLATFORM_EC_USB_PD_TCPM_TCPCI
	bool "Use TCPCI"
	help
	  Enable a TCPC compatible with the Type-C Port Controller Interface
	  (TCPCI) Specification. This driver supports both Rev1 v1.2 and Rev2
	  v1.0 of the TCPCI specification. Select this driver directly only
	  if your specific TCPC chip is not listed as a separate config option.

	  Note: most of the TCPC will depend on PLATFORM_EC_USB_PD_TCPM_TCPCI.

# TODO: Add other choices:
#  CONFIG_USB_PD_TCPM_STUB
#  CONFIG_USB_PD_TCPM_FUSB302
#  CONFIG_USB_PD_TCPM_ITE_ON_CHIP
#  CONFIG_USB_PD_TCPM_ANX3429
#  CONFIG_USB_PD_TCPM_ANX740X
#  CONFIG_USB_PD_TCPM_ANX741X
#  CONFIG_USB_PD_TCPM_ANX7447
#  CONFIG_USB_PD_TCPM_ANX7688
#  CONFIG_USB_PD_TCPM_NCT38XX
#  CONFIG_USB_PD_TCPM_MT6370
#  CONFIG_USB_PD_TCPM_TUSB422
#  CONFIG_USB_PD_TCPM_RAA489000
#  CONFIG_USB_PD_TCPM_RT1715
#  CONFIG_USB_PD_TCPM_FUSB307
#  CONFIG_USB_PD_TCPM_STM32GX

endchoice  # Type-C Port Manager (TCPM)

config PLATFORM_EC_CONSOLE_CMD_PPC_DUMP
	bool "Enable ppc_dump command"
	depends on PLATFORM_EC_USBC_PPC
	default y

config PLATFORM_EC_CMD_TCPC_DUMP
	bool "Enable tcpi_dump command"
	default y
	# TODO: depends on ??

endif  # PLATFORM_EC_USBC_PPC

endif  # PLATFORM_EC_USBC