summaryrefslogtreecommitdiff
path: root/zephyr/Kconfig.usbc
blob: db1cc740bf83efa94f75e2d4f5377ceb29d96129 (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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
# 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.

# TODO(sjg): Not USB-C: perhaps we should have a 'power' thing at the top level?
config PLATFORM_EC_USB_A_PORT_COUNT
	int "Number of USB-A ports"
	default 0
	help
	  This sets the number of USB-A ports on the device. These ports do
	  not support USB Power Delivery features but can be used to power
	  external devices (according to the USB 3 spec, not the Battery Charger
	  standard) and to charge devices slowly if power is enabled to them.

config PLATFORM_EC_USB_PORT_POWER_DUMB
	bool "Simple control of power to USB-A ports"
	depends on PLATFORM_EC_USB_A_PORT_COUNT > 0
	default y
	help
	  Enable this to provide simple control of the power to USB ports
	  using GPIOs. To use this your board code must provide a
	  usb_port_enable[] array with the GPIOs to use for each port. This
	  implements the EC_CMD_USB_CHARGE_SET_MODE host command and provides
	  a 'usbchargemode' console command.

menuconfig PLATFORM_EC_USBC
	bool "USB Type-C"
	default y if PLATFORM_EC_BATTERY
	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_CHARGE_MANAGER
	bool "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"
	depends on PLATFORM_EC_CHARGE_MANAGER
	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

menuconfig PLATFORM_EC_BOOT_AP_POWER_REQUIREMENTS
	bool "Power requirements to boot AP"
	default y
	help
	  Power thresholds for AP boot.
	  If one of the following conditions is met, EC boots AP:
	   1. Battery charge >= CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON.
	   2. AC power >= CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON.
	   3. Battery charge >= CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC
	    and
	    AC power >= CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT.

if PLATFORM_EC_BOOT_AP_POWER_REQUIREMENTS

config PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON
	int "Minimal battery level to boot AP without AC"
	depends on PLATFORM_EC_BATTERY
	default 3
	help
	  Sets the minimum battery capacity, as a percentage, needed to boot
	  the AP when AC power is not supplied.

config PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC
	int "Minimal battery level to boot AP with AC"
	depends on PLATFORM_EC_BATTERY && PLATFORM_EC_CHARGE_MANAGER
	default 1
	help
	  Sets the minimum battery capacity, as a percentage, needed to boot
	  the AP when AC power is supplied. The AC power supplied must also
	  be greater than CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT.

config PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT
	int "Minimal AC power to boot AP with battery"
	depends on PLATFORM_EC_BATTERY && PLATFORM_EC_CHARGE_MANAGER
	default 15000
	help
	  Sets the minimum power, in milliwatts, supplied by an external
	  charger required to boot the AP when the battery capacity is also
	  above CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC.

config PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON
	int "Minimal AC power to boot AP without battery"
	depends on PLATFORM_EC_CHARGE_MANAGER
	default 15000
	help
	  Sets the minimum power, in milliwatts, supplied by an external
	  charger requires to boot the AP when no battery is present or
	  under dead battery conditions. If the AP requires greater than
	  15W to boot, check the
	  CONFIG_PLATFORM_EC_CHARGER_LIMIT_POWER_THRESH_CHG_MW setting.

endif # PLATFORM_EC_BOOT_AP_POWER_REQUIREMENTS

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"
	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_USBC_RETIMER_INTEL_BB
	bool "Support Intel Burnside Bridge retimer"
	help
	  Enable this to support the Intel Burnside Bridge Thunderbolt / USB /
	  DisplayPort retimer.

	  Intel Burnside Bridge is a Type-C multi-protocol retimer to be used
	  in on-board applications. Burnside Bridge offers the ability to latch
	  protocol signals into on-chip memory before retransmitting them
	  onwards. It can be used to extend the physical length of the system
	  without increasing high-frequency jitter.

	  Burnside Bridge supports spec compliant retimer of following
	  protocols:

	    - Display Port: four unidirectional DP lanes
	    - USB3.1 Gen1/2: one bi-directional USB lane
	    - Thunderbolt: two bi-directional CIO lanes
	    - Multifunction Display (MFD): two unidirectional lanes of DP and
	      one bidirectional lane of USB3.1 Gen1/2

config PLATFORM_EC_USBC_RETIMER_INTEL_BB_RUNTIME_CONFIG
	bool "Use runtime configuration of Intel Burnside Bridge"
	depends on PLATFORM_EC_USBC_RETIMER_INTEL_BB
	default y
	help
	  Enable this to allow run-time configuration of the Burnside Bridge
	  driver structure. This makes the bb_controls[] array writable, i.e.
	  not const. It should be declared as such in the board config.

	  This is useful when the board has runtime information that changes
	  the configuration, such as Chromium OS Board Info (CBI set in the
	  factory. Without this, multiple EC images would need to be installed
	  depending on the board.

menuconfig PLATFORM_EC_USB_POWER_DELIVERY
	bool "USB Type-C Power Delivery (PD)"
	default y
	select HAS_TASK_PD_C0
	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_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?

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.

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_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.

config PLATFORM_EC_USB_PD_FRS
	bool "Support Fast Role Swap protocol"
	help
	  Enables the protocol side of Fast Role Swap (FRS). This allows the
	  device to switch from a SNK to a SRC (or vice versa) based on
	  communication with the partner device.

	  For this to work the trigger must be implemented in either the
	  Type-C Port Controller (TCPC) or Power Path Controller (PPC).

	  FRS differs from the traditional power-role swap in that FRS
	  guarantees there is no interruption of power nor disruption of data
	  communication to any downstream devices (such as devices connected
	  to a USB-C hub or dock).

if PLATFORM_EC_USB_PD_FRS

choice "Trigger implementation"
	prompt "Select where the trigger is implemented"
	help
	  The Fast Role Swap (protocol requires that a trigger be implemented to
	  initiate the swap. Use this option to select which of the available
	  options should be used.

config PLATFORM_EC_USB_PD_FRS_PPC
	bool "PPC"
	depends on PLATFORM_EC_USBC_PPC
	help
	  Enable this if the Fast Role Swap trigger is implemented in the
	  Power Path Controller (PPC).

config PLATFORM_EC_USB_PD_FRS_TCPC
	bool "TCPC"
	depends on PLATFORM_EC_USBC_TCPC
	help
	  Enable this if the Fast Role Swap trigger is implemented in the
	  Type-C Port Controller (TCPC).

endchoice # Trigger implementation

endif # PLATFORM_EC_USB_PD_FRS

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

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_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 cable of operating as an USB3.2 device"
	default y
	help
	  Enable this if the board's USB Power Delivery Downward Facing Port is
	  able to support the USB3.2 standard. This is advertised to the
	  other end so that it can potentially take advantage of the additional
	  features available.

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 "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.

menuconfig PLATFORM_EC_USB_PD_CONSOLE_CMD
	bool "Enable USB PD console commands"
	default y if PLATFORM_EC_USB_PD_ALT_MODE_DFP
	help
	  Enables various USB-C PD related console commands.

if PLATFORM_EC_USB_PD_CONSOLE_CMD

config PLATFORM_EC_CONSOLE_CMD_USB_PD_PE
	bool "Console command: pe"
	default y
	help
	  This command dumps information about the USB PD alternate mode options
	  discovered from the partner device. It can be useful for debugging.

	  Example: pe 1 dump
	     IDENT SOP:

	             [ID Header] 2c000bda :: AMA, VID:0bda
	             [Cert Stat] 00000000
	             [2] 00000209    [3] 11000f09
	     IDENT SOP':
	             [ID Header] 1c000489 :: PCable, VID:0489
	             [Cert Stat] 000001c6
	             [2] f6810000    [3] 11082051
	     SVID[0]: ff01 MODES: [1] 000c0045
	     MODE[1]: svid:ff01 caps:000c0045

config PLATFORM_EC_CONSOLE_CMD_USB_PD_CABLE
	bool "Console command: pdcable"
	default y
	help
	  This commands shows the USB cable charactistics as detected from the
	  device. It can be useful for debugging problems with cables and the
	  device's response to them.

	  Example: pdcable 1
	     Cable Type: Passive
	     Cable Rev: 1.0
	     Connector Type: 2
	     Cable Current: 5A
	     USB Superspeed Signaling support: 1
	     Rounded support: No
	     Optical cable: No
	     Retimer support: No
	     Link training: Bi-directional
	     Thunderbolt cable type: Passive

endif  # PLATFORM_EC_USB_PD_CONSOLE_CMD

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

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 y
	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 y
	help
	  Enable this to allow entering into Thunderbolt-compatible mode between
	  two port partners. This does not require that USB4 mode be enabled.

endif  # PLATFORM_EC_USB_POWER_DELIVERY

menuconfig PLATFORM_EC_USBC_PPC
	bool "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_POLARITY
	bool
	help
	  Enable this if a Power Path Controller needs to be informed of
	  the polarity of the Configuration Channel (CC) pins. This can change
	  depending on which way up the USB-C cable is inserted into the
	  device.

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

config PLATFORM_EC_USBC_PPC_SBU
	bool
	help
	  Enable this if a Power Path Controller is capable of gating the
	  Sideband Use (SBU) lines. If so, the USB mux will use this feature
	  to isolate the lines before entering into alternate mode.

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

config PLATFORM_EC_USBC_PPC_VCONN
	bool
	depends on PLATFORM_EC_USBC_VCONN
	help
	  Enable this if a Power Path Controller is capable of providing
	  VCONN. If so, the USB stack will enable / disable VCONN as needed.

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

	  Note: This may not be true, as there may be scenarios where the board
	  might need to disable this feature (for instance when both the PPC and
	  TCPC can supply VCONN). We can cross that bridge when we come to it.

config PLATFORM_EC_USBC_PPC_SN5S330
	bool "TI SN5S330 PD 3.0 power mux"
	select PLATFORM_EC_USBC_OCP
	select PLATFORM_EC_USBC_PPC_POLARITY
	select PLATFORM_EC_USBC_PPC_SBU
	select PLATFORM_EC_USBC_PPC_VCONN if PLATFORM_EC_USBC_VCONN
	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 "SYV682X which is a Power Mux for USB PD"
	select PLATFORM_EC_USBC_OCP
	select PLATFORM_EC_USBC_PPC_POLARITY
	select PLATFORM_EC_USBC_PPC_VCONN if PLATFORM_EC_USBC_VCONN
	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_USBC_PPC_DEDICATED_INT
	bool "Power Power Controller has a dedicated interrupt pin"
	help
	  Enable this if the Power Power Controller (PPC) has level interrupts
	  (as opposed to edge) and a dedicated interrupt pin to check the
	  current state.

	  If this is enabled the USB Power Delivery (PD) stack will call
	  ppc_get_alert_status() to find out he interrupt status for a port.
	  This function should be provided by the board code.

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
	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.

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_RAA489000
#  CONFIG_USB_PD_TCPM_FUSB307
#  CONFIG_USB_PD_TCPM_STM32GX

endchoice  # Type-C Port Manager (TCPM)

menuconfig PLATFORM_EC_USB_MUX
	bool "USB muxes"
	default y
	help
	  Enables support for USB muxes. These allow multiplexing

if PLATFORM_EC_USB_MUX

config PLATFORM_EC_USB_MUX_RUNTIME_CONFIG
	bool "USB mux runtime config"
	default y
	help
	  Allows the configuration of the USB mux to be set up at runtime. This
	  makes the usb_muxes[] array writable, i.e. not const. It should be
	  declared as such in the board config.

	  This is useful when the board has runtime information that changes
	  the configuration, such as Chromium OS Board Info (CBI set in the
	  factory. Without this, multiple EC images would need to be installed
	  depending on the board.

config PLATFORM_EC_USBC_SS_MUX
	bool "SuperSpeed mux"
	default y
	help
	  Enable this to support the USB Type-C SuperSpeed Mux. If enabled,
	  the USB stack will call usb_mux_set() to change the mux settings.
	  The board must provide a driver in usb_muxes[] for each port so
	  that this can work.

config PLATFORM_EC_USB_MUX_VIRTUAL
	bool "USB Mux is virtual"
	depends on PLATFORM_EC_USBC_SS_MUX
	help
	  Enable this if a virtual USB mux is supported on the EC, which is
	  actually handled by the AP. In this case the AP gets an interrupt
	  and is is informed when status changes, via the
	  EC_CMD_USB_PD_MUX_INFO host command.

config PLATFORM_EC_USBC_RETIMER_FW_UPDATE
	bool "Support firmware update of USB Type-C retimers"
	default y
	depends on PLATFORM_EC_USBC_SS_MUX
	help
	   Enable this to support USB Type-C retimer firmware update. Each
	   Type-C retimer indicates its capability of supporting firmware update
	   independently in its usb_mux_driver.

	   During AP boot-up, the AP scans each PD port for retimers but only
	   if there are no Type-C devices attached to the port. The firmware
	   update can only be performed on retimers which show up in the AP
	   thunderbolt device entries.

endif  # PLATFORM_EC_USB_MUX

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.

if PLATFORM_EC_USB_PD_TCPM_TCPCI

config PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG
	bool "Type-C Port Controller runtime config"
	default y
	help
	  Allows the configuration of the TCPC to be set up at runtime. This
	  makes the tcpc_config[] array writable, i.e. not const. It should be
	  declared as such in the board config.

	  This is useful when the board has runtime information that sets
	  the configuration, such as Chromium OS Board Info (CBI set in the
	  factory. Without this, multiple EC images would need to be installed
	  depending on the board.

config PLATFORM_EC_USB_PD_TCPM_PS8815
	bool "Parade PS8815 USB-C Gen 2 Type-C Port Controller"
	select PLATFORM_EC_USB_PD_TCPM_MUX
	help
	  The Parade Technologies PS8815 is an active retiming/redriving
	  (respectively for USB 3.1 Gen 2 / DisplayPort 1.4a HBR3) integrated
	  with a USB Type-C Port Controller (TCPC) for USB Type-C Host and
	  DisplayPort applications. It supports Power Delivery and the
	  DisplayPort Alt Mode.

config PLATFORM_EC_USB_PD_TCPM_RT1715
	bool "Ricktek RT1715 Type-C Port Controller"
	help
	  The RT1715 is a USB Type-C controller, integrating a complete Type-C
	  Transceiver including the Rp and Rd resistors. It does the USB Type-C
	  detection including attach and orientation. The RT1715 integrates the
	  physical layer of the USB BMC power delivery protocol to allow up to
	  100W of power and role swap. The BMC PD block enables full support
	  for alternative interfaces of the Type-C specification.

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

config PLATFORM_EC_USB_PD_TCPM_MUX
	bool "Support optional register 18h steer the high-speed muxes"
	help
	  Enable this option if the TCPC port controller supports the optional
	  register 18h CONFIG_STANDARD_OUTPUT to steer the high-speed muxes.

	  See section 4.4.4 (CONFIGURE STANDARD OUTPUT) of the USB Type-C Port
	  Controller Interface Specification, Revision 2.0, Version 1.2 for more
	  information.

config PLATFORM_EC_USB_MUX_RUNTIME_CONFIG
	bool "USB mux runtime config"
	default y
	help
	  Allows the configuration of the USB mux to be set up at runtime. This
	  makes the usb_muxes[] array writable, i.e. not const. It should be
	  declared as such in the board config.

	  This is useful when the board has runtime information that changes
	  the configuration, such as Chromium OS Board Info (CBI set in the
	  factory. Without this, multiple EC images would need to be installed
	  depending on the board.

config PLATFORM_EC_CONSOLE_CMD_TCPC_DUMP
	bool "Console command: tcpc_dump"
	# anx7447 also supports this command, but is not yet enabled
	default y
	help
	  Allows dumping of the Type-C Port Controller (TCPC) state, which is
	  basically a list of registers and their values. By reference to the
	  Universal Serial Bus Type-C Port Controller Interface Specification
	  this can help you figure out what is going on.

endif  # PLATFORM_EC_USB_PD_TCPM_TCPCI

endif  # PLATFORM_EC_USBC_PPC

config PLATFORM_EC_USB_CHARGER
	bool "Support charging from a USB-C port"
	default y
	select HAS_TASK_USB_CHG_P0
	help
	  This enables common BC1.2 (Battery-Charging Specification Rev1.2)
	  charger-detection routines. With this is possible to negotiate a
	  power contract with an attached battery charger and use this to
	  charge the device's battery.

if PLATFORM_EC_USB_CHARGER

config PLATFORM_EC_BC12_DETECT_PI3USB9201
	bool "Enable support for Pericom PI3USB9201"
	help
	  This is a Dual-Role USB Charging-Type Detector. It can operate in
	  host or client mode. It supports Battery Charging Specification, rev
	  1.2 (BC1.2) with Standard/Charging/Dedicated downstream port
	  (SDP/CDP/DCP) advertisement when in host mode. In client mode it
	  starts BC1.2 detection to detect the attached host type. It provides
	  an I2C interface to report detection results.

endif  # PLATFORM_EC_USB_CHARGER

endif  # PLATFORM_EC_USBC