summaryrefslogtreecommitdiff
path: root/zephyr/Kconfig.usbc
blob: 6dcf03335c5ea86349efb67480b74da092cb926b (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
# Copyright 2020 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_USBC
	bool "USB Type-C"
	default y if PLATFORM_EC_BATTERY
	depends on PLATFORM_EC_MATH_UTIL
	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.

config TEST_DISABLE_PLATFORM_EC_USBC
	bool "Test disable USB type-C"
	depends on ZTEST && !PLATFORM_EC_USBC
	help
	  Use this config to allow tests for code that doesn't actually rely on
	  USBC.

rsource "Kconfig.retimer"
rsource "Kconfig.pd_int_shared"
rsource "Kconfig.pd_meas_vbus"
rsource "Kconfig.pd_frs"
rsource "Kconfig.pd_discharge"
rsource "Kconfig.pd_vbus_detection"
rsource "Kconfig.pd_console_cmd"
rsource "Kconfig.pd_usbc_device_type"
rsource "Kconfig.pd"
rsource "Kconfig.ppc"
rsource "Kconfig.usb_mux"
rsource "Kconfig.usbc_ss_mux"
rsource "Kconfig.tcpm"
rsource "Kconfig.usb_charger"

if PLATFORM_EC_USBC

config PLATFORM_EC_TCPC_INTERRUPT
	bool "Enables tcpc driver"
	default y
	help
	  By default, the tcpc driver is automatically enabled and will
	  initialize using the devicetree configs. Disable to stop tcpc
	  interrupt callbacks from being generated and save space on flash if a
	  custom driver is used instead.

config PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT
	int "Charger input current in mA"
	depends on PLATFORM_EC_CHARGE_MANAGER
	default 512
	help
	  Default input current limit for the board in mA.

	  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 no more than 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_CHARGER_MIN_INPUT_CURRENT_LIMIT
	int "Minimum charger input current limit in mA"
	default 0
	depends on PLATFORM_EC_CHARGE_MANAGER
	help
	  Minimum current limit in mA that will ever be set for chargers, even if a
	  lower limit is requested.

	  If set, this should usually be set to no more than 2.5W divided by the
	  maximum supported input voltage in order to satisfy USB-PD pSnkStdby
	  requirements. Higher values may help devices stay alive under low-battery
	  conditions at the cost of violating standby power limits.

	  Many boards set this to large values, since historically this number was
	  usually equal to the default current limit. New boards should avoid doing
	  so if possible, and usually leave this unset: customization of
	  board_set_charge_limit() should be considered instead if a device sometimes
	  requires amounts of power in violation of specs, to limit those violations
	  only to situations where they are necessary.

config PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT
	int "Charger input current derating percentage"
	default 5
	depends on PLATFORM_EC_CHARGE_MANAGER
	help
	  Setting this to a nonzero value causes actual charger current limits
	  to be adjusted by the given percentage. For example, setting this to
	  4 and requesting a current limit of 1000 mA causes the charge manager
	  to program an actual current limit of 960 mA.

	  This is useful if a charger consistently draws more current than the
	  programmed limit, or if it is desired to derate for other
	  safety-related reasons. If a more complex (non-linear) adjustment is
	  required, boards should override the board_set_charge_limit()
	  function instead of configuring this option.

	  The default value is set to prevent most overcurrent conditions during
	  load transients, because power supplies vary in their tolerance to
	  such short-lived overcurrent conditions and many chargers respond
	  slowly to those transients.

	  Projects SHOULD characterize system behavior to tune for system
	  behavior and charger response in order to optimize this (allowing the
	  derating to be reduced) and ensure transients do not exceed the range
	  of acceptable current (which might require greater derating).

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_PID
	hex "USB Product ID"
	default 0
	help
	  Each platform (e.g. baseboard set) should have a single VID/PID
	  combination. If there is a big enough change within a platform,
	  then we can differentiate USB topologies by varying the hardware
	  version field in the Sink and Source Capabilities Extended messages.

	  To reserve a new PID within Google, use go/usb and see
	  http://google3/hardware/standards/usb

config PLATFORM_EC_USB_BCD_DEV
	hex "USB Device ID"
	default 0
	help
	  This specifies the USB device version, reported by board when acting
	  as the upstream facing port (UFP). This is a 16-bit unsigned integer
	  and should be set to a version number relevant to the release version
	  of the product.

config PLATFORM_EC_USB_VID
	hex "USB Vendor ID"
	default 0x18d1
	help
	  This specifies the USB vendor ID used for boards which expose a
	  USB endpont when the port is in UFP mode. The default value is
	  set to Google's assigned VID and typically would not need to be
	  changed. But, in certain cases this may need to be changed to
	  match an OEM's vendor ID.

config PLATFORM_EC_USB_MS_EXTENDED_COMPAT_ID_DESCRIPTOR
	bool "USB MS Extended Compat ID Feature Descriptor"
	help
	  This enables USB-EP to contain a MS Windows USB string descriptor
	  which is then used by MS Windows to request a Extended Compatible
	  ID Feature descriptor so that Windows will know to load its WINUSB
	  driver.

config PLATFORM_EC_USB_PD_TCPC_LOW_POWER
	bool "Allow Type-C Port Controller to enter low-power mode"
	default y
	help
	  Allows entry to a low power mode when the USB port is idle.
	  When enabled, an enter_low_power_mode member is present in tcpm_drv
	  and should be set to a function that selects that mode, such as
	  tcpci_enter_low_power_mode() for TCPCI-compatible TCPCs.

config PLATFORM_EC_USB_PD_TCPC_LPM_EXIT_DEBOUNCE_US
	int "Debounce delay when exiting low-power mode (uS)"
	depends on PLATFORM_EC_USB_PD_TCPC_LOW_POWER
	default 25000
	help
	  Some TCPCs need additional time following a VBUS change to internally
	  debounce the CC line status and update the CC_STATUS register. This
	  is the delay in microseconds to allow before checking the CC line
	  status in the EC.

config PLATFORM_EC_USB_PD_TCPC_VCONN
	bool "If VCONN is enabled, the TCPC will provide VCONN"
	default y if !PLATFORM_EC_USBC_PPC_SYV682X
	default y if PLATFORM_EC_USB_PD_TCPM_ITE_ON_CHIP
	default y if PLATFORM_EC_USBC_PPC_SYV682X_NO_CC
	help
	  Source USB Type-C connector voltage (VCONN) from the Type-C Port
	  Controller (TCPC), and also the Power Path Controller (PPC) if
	  present. Some TCPC/PPC can't handle 5V on its host-side CC pins, so
          disable this config in those cases.

config PLATFORM_EC_USB_PD_CLEAR_HARD_RESET_STATUS
	bool "Clear PD hard reset status when PD setup completes"
	default y if SOC_SERIES_RISCV32_IT8XXX2
	help
	  Enabling this config will clear the Hard Reset event status
	  after the PD connection is finished initialization,
	  to avoid the AP getting a stale event notification.

	  The detection of a PD Hard Reset sets an status flag that
	  is then read by the AP in order to reset the USB muxes.
	  However by the time this is read, the connection may
	  have been re-initialized and is ready, but the AP may
	  process the hard reset as if it were still current,
	  causing the USB port to be incorrectly disabled.
	  The hard reset of the PD connection can be triggered
	  when the EC is detected as being initially powered on
	  (as opposed to being reset), to force clearing the connection.

	  This config is set by default for the IT8XXX2 EC, which
	  cannot distinguish between a reset and power-on, so a power-on
	  is assumed, which leads to the PD hard reset when the EC
	  undergoes a reset (such as when entering recovery mode).

config PLATFORM_EC_CONSOLE_CMD_PPC_DUMP
	bool "Console command: ppc_dump"
	depends on PLATFORM_EC_USBC_PPC
	default y
	help
	  Allows dumping of the Power Path Controller (PPC) state, which is
	  basically a list of registers and their values. The actual dump
	  function is driver-specific (the reg_dump member of ppc_drv). By
	  reference to the datasheet for the part this can help you figure out
	  what is going on.

config PLATFORM_EC_USBC_PPC_LOGGING
	bool "Enable PPC Related logging"
	depends on PLATFORM_EC_USBC_PPC
	default y
	help
	  PPC drivers use two print functions for logging error messages
	  (ppc_prints and ppc_err_prints). Setting this config adds the
	  CPRINTS call to both of these function which will enable PPC
	  related logging but increase EC image size.

config PLATFORM_EC_USB_PD_TCPM_DRIVER_IT83XX
	bool "Enable IT83XX driver"
	depends on PLATFORM_EC_USB_PD_TCPM_ITE_ON_CHIP
	help
	  Enable a driver for the ITE IT83XX on-chip UBB Type-C Port Manager.
	  This supports up to two USB Type-C ports with Dual Role function
	  (provider and consumer) and Fast Role Swap detection.

config PLATFORM_EC_USB_PD_TCPM_DRIVER_IT8XXX2
	bool "Enable IT8XXX2 driver"
	depends on PLATFORM_EC_USB_PD_TCPM_ITE_ON_CHIP
	help
	  Enable a driver for the ITE IT8XXX2 on-chip UBB Type-C Port Manager.
	  This supports up to two USB Type-C ports with Dual Role function
	  (provider and consumer) and Fast Role Swap detection.

config PLATFORM_EC_USB_PD_PULLUP
	int "Default source Rp value"
	default 1
	help
	  Default pull-up value on the USB-C ports when they are used as source.
	  Valid values are 0 (USB default current), 1 (1.5A), and 2 (3.0A). See
	  enum tcpc_rp_value.

config PLATFORM_EC_USB_PD_ONLY_FIXED_PDOS
	bool "Only support FIXED type PDOs"
	help
	  Ignore all non-fixed PDOs received from a src_caps message. Enable
	  this for boards (like servo_v4) which only support FIXED PDO types.

# Define power related settings here for now to allow projects to overwrite
# them. Ideally they would be defined in the devicetree.
config PLATFORM_EC_PD_OPERATING_POWER_MW
	int "PD operating power in milliwatt"
	default 15000
	help
	  Base configuration for PD power operating power value, which is used
	  in PD negotiation. The final PD parameter used in negotiation is
	  affected by PLATFORM_EC_PD_MAX_POWER_MW,
	  PLATFORM_EC_PD_MAX_CURRENT_MA, and PLATFORM_EC_PD_MAX_VOLTAGE_MV.
	  Increase this value is the system requires more than 15 watts to boot
	  without a battery.

config PLATFORM_EC_PD_MAX_POWER_MW
	int "PD maximum power in milliwatt"
	default 60000
	help
	  The maximum PD negotiated power for the system. The value should match
	  with configured PLATFORM_EC_PD_MAX_CURRENT_MA and
	  PLATFORM_EC_PD_MAX_VOLTAGE_MV.

config PLATFORM_EC_PD_MAX_CURRENT_MA
	int "PD maximum current in milliampere"
	default 3000
	help
	  The maximum PD negotiated current for the system. The value should
	  match with configured PLATFORM_EC_PD_MAX_POWER_MW and
	  PLATFORM_EC_PD_MAX_VOLTAGE_MV.

config PLATFORM_EC_PD_MAX_VOLTAGE_MV
	int "PD maximum voltage in millivolt"
	default 20000
	help
	  The maximum PD negotiated voltage for the system. The value should
	  match with configured PLATFORM_EC_PD_MAX_POWER_MW and
	  PLATFORM_EC_PD_MAX_CURRENT_MA.

config PLATFORM_EC_PD_POWER_SUPPLY_TURN_ON_DELAY
	int "Power supply turn on delay in us"
	default 30000
	help
	  Each platform could have different power sequencing and transition
	  timing for turning on the power on the PD port.

config PLATFORM_EC_PD_POWER_SUPPLY_TURN_OFF_DELAY
	int "Power supply turn off delay in us"
	default 30000
	help
	  Each platform could have different power sequencing and transition
	  timing for turning off the power on the PD port.

endif  # PLATFORM_EC_USBC