Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
config.h
1#ifndef USB_PD_CONFIG
2#define USB_PD_CONFIG
3
4// 1 - 3. 0 is disabled
5#define PD_DEBUG_LEVEL 0
6
7/*
8 * Provide common runtime layer code (tasks, hooks ...)
9 * You want this unless you are doing a really tiny firmware.
10 */
11#undef CONFIG_COMMON_RUNTIME
12
13// automatically select highest power profile
14// TODO most of the implementation is commented out
15#define CONFIG_CHARGE_MANAGER
16
17/* Support v1.1 type-C connection state machine */
18#define CONFIG_USBC_BACKWARDS_COMPATIBLE_DFP
19
20/* Support for USB type-c vconn. Not needed for captive cables. */
21// our hardware does not support it.
22#undef CONFIG_USBC_VCONN
23
24/* Support VCONN swap */
25#undef CONFIG_USBC_VCONN_SWAP
26
27/* Support for USB PD alternate mode */
28#undef CONFIG_USB_PD_ALT_MODE
29
30/* Define if this board can act as a dual-role PD port (source and sink) */
31#define CONFIG_USB_PD_DUAL_ROLE
32
33/* Define if this board can used TCPC-controlled DRP toggle */
34#undef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
35
36/* Simple DFP, such as power adapter, will not send discovery VDM on connect */
37#undef CONFIG_USB_PD_SIMPLE_DFP
38
39/*
40 * Choose one of the following TCPMs (type-C port manager) to manage TCPC. The
41 * TCPM stub is used to make direct function calls to TCPC when TCPC is on
42 * the same MCU. The TCPCI TCPM uses the standard TCPCI i2c interface to TCPC.
43 */
44#undef CONFIG_USB_PD_TCPM_STUB
45#undef CONFIG_USB_PD_TCPM_TCPCI
46#define CONFIG_USB_PD_TCPM_FUSB302 // the chip we use
47#undef CONFIG_USB_PD_TCPM_ITE_ON_CHIP
48#undef CONFIG_USB_PD_TCPM_ANX3429
49#undef CONFIG_USB_PD_TCPM_ANX740X
50#undef CONFIG_USB_PD_TCPM_ANX741X
51#undef CONFIG_USB_PD_TCPM_ANX7447
52#undef CONFIG_USB_PD_TCPM_ANX7688
53#undef CONFIG_USB_PD_TCPM_NCT38XX
54#undef CONFIG_USB_PD_TCPM_MT6370
55#undef CONFIG_USB_PD_TCPM_TUSB422
56#undef CONFIG_USB_PD_TCPM_RAA489000
57#undef CONFIG_USB_PD_TCPM_RT1715
58#undef CONFIG_USB_PD_TCPM_FUSB307
59#undef CONFIG_USB_PD_TCPM_STM32GX
60
61// Enable to prefer higher voltage profiles in case of power profile tie
62#define PD_PREFER_HIGH_VOLTAGE
63#undef PD_PREFER_LOW_VOLTAGE
64/*
65 * Override the pull-up value when only zero or one port is actively sourcing
66 * current and we can advertise more current than what is defined by
67 * `CONFIG_USB_PD_PULLUP`.
68 * Should be defined with one of the tcpc_rp_value.
69 */
70#undef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
71
72/* Support for USB type-c superspeed mux */
73#undef CONFIG_USBC_SS_MUX
74
75/* Use this option to enable Try.SRC mode for Dual Role devices */
76#undef CONFIG_USB_PD_TRY_SRC
77
78/* Set the default minimum battery percentage for Try.Src to be enabled */
79#define CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC 5
80
81/*
82 * The TCPM must know whether VBUS is present in order to make proper state
83 * transitions. In addition, charge_manager must know about VBUS presence in
84 * order to make charging decisions. VBUS state can be determined by various
85 * methods:
86 * - Some TCPCs can detect and report the presence of VBUS.
87 * - In some configurations, charger ICs can report the presence of VBUS.
88 * - On some boards, dedicated VBUS interrupt pins are available.
89 * - Some power path controllers (PPC) can report the presence of VBUS.
90 *
91 * Exactly one of these should be defined for all boards that run the PD
92 * state machine.
93 */
94#define CONFIG_USB_PD_VBUS_DETECT_TCPC
95#undef CONFIG_USB_PD_VBUS_DETECT_CHARGER
96#undef CONFIG_USB_PD_VBUS_DETECT_GPIO
97#undef CONFIG_USB_PD_VBUS_DETECT_PPC
98#undef CONFIG_USB_PD_VBUS_DETECT_NONE
99
100/*
101 * PD Rev2.0 functionality is enabled by default. Defining this macro
102 * enables PD Rev3.0 functionality.
103 */
104#undef CONFIG_USB_PD_REV30
105
106/* Default pull-up value on the USB-C ports when they are used as source. */
107#define CONFIG_USB_PD_PULLUP TYPEC_RP_1A5
108
109/* Initial DRP / toggle policy */
110#define CONFIG_USB_PD_INITIAL_DRP_STATE PD_DRP_TOGGLE_OFF
111
112/*
113 * USB Product ID. Each platform (e.g. baseboard set) should have a single
114 * VID/PID combination. If there is a big enough change within a platform,
115 * then we can differentiate USB topologies by varying the HW version field
116 * in the Sink and Source Capabilities Extended messages.
117 *
118 * To reserve a new PID, use go/usb.
119 */
120#define CONFIG_USB_PID 0x1209 // here, default
121
122/* Use TCPC module (type-C port controller) */
123#undef CONFIG_USB_PD_TCPC
124
125/* Board provides specific TCPC init function */
126#undef CONFIG_USB_PD_TCPC_BOARD_INIT
127
128/* Enable TCPC to enter low power mode */
129#undef CONFIG_USB_PD_TCPC_LOW_POWER
130
131/* Save power by waking up on VBUS rather than polling CC */
132#undef CONFIG_USB_PD_LOW_POWER
133
134/* Define if this board, operating as a sink, can give power back to a source */
135#undef CONFIG_USB_PD_GIVE_BACK
136
137/* Dynamic USB PD source capability */
138#undef CONFIG_USB_PD_DYNAMIC_SRC_CAP
139
140/*****************************************************************************/
141/*
142 * Define CONFIG_USB_PD_VBUS_MEASURE_TCPC if the tcpc on the board supports
143 * VBUS measurement.
144 */
145#if defined(CONFIG_USB_PD_TCPM_FUSB302)
146// vbus measurment
147#define CONFIG_USB_PD_VBUS_MEASURE_TCPC
148// only support 2.0
149#undef CONFIG_USB_PD_REV30
150#endif
151
152/* Override PD_ROLE_DEFAULT in usb_pd.h */
153#define PD_ROLE_DEFAULT() (PD_ROLE_SINK)
154
155#endif