Lamp-Da
0.1
A compact lantern project
Loading...
Searching...
No Matches
src
system
bsp
pd
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
/* board CC hardware gate (LMBD_USBC_HAS_BOARD_CC_RD) */
107
#include "../../driver/pd/cc_thresholds.h"
108
109
/*
110
* Default pull-up value on the USB-C ports when they are used as source.
111
*/
112
#if LMBD_USBC_HAS_BOARD_CC_RD
113
/*
114
* 3A on purpose, with a 5V 1.5A source PDO: the board permanent 5.1k Rd on the CC lines halves the CC voltage, so a
115
* sink reads it as a 1.5A Rp (1.5A Rp would read as USB default, 500mA).
116
* The stronger current source also hides the board Rd from a dual role partner in its source toggle phase: with a 1.5A
117
* Rp, it would see an Rd and wait forever for VBUS to drop (issue #357)
118
*/
119
#define CONFIG_USB_PD_PULLUP TYPEC_RP_3A0
120
#else
121
/* matches the 5V 1.5A source PDO */
122
#define CONFIG_USB_PD_PULLUP TYPEC_RP_1A5
123
#endif
124
125
/* Initial DRP / toggle policy */
126
#define CONFIG_USB_PD_INITIAL_DRP_STATE PD_DRP_TOGGLE_OFF
127
128
/*
129
* USB Product ID. Each platform (e.g. baseboard set) should have a single
130
* VID/PID combination. If there is a big enough change within a platform,
131
* then we can differentiate USB topologies by varying the HW version field
132
* in the Sink and Source Capabilities Extended messages.
133
*
134
* To reserve a new PID, use go/usb.
135
*/
136
#define CONFIG_USB_PID 0x1209
// here, default
137
138
/* Use TCPC module (type-C port controller) */
139
#undef CONFIG_USB_PD_TCPC
140
141
/* Board provides specific TCPC init function */
142
#undef CONFIG_USB_PD_TCPC_BOARD_INIT
143
144
/* Enable TCPC to enter low power mode */
145
#undef CONFIG_USB_PD_TCPC_LOW_POWER
146
147
/* Save power by waking up on VBUS rather than polling CC */
148
#undef CONFIG_USB_PD_LOW_POWER
149
150
/* Define if this board, operating as a sink, can give power back to a source */
151
#undef CONFIG_USB_PD_GIVE_BACK
152
153
/* Dynamic USB PD source capability */
154
#undef CONFIG_USB_PD_DYNAMIC_SRC_CAP
155
156
/*****************************************************************************/
157
/*
158
* Define CONFIG_USB_PD_VBUS_MEASURE_TCPC if the tcpc on the board supports
159
* VBUS measurement.
160
*/
161
#if defined(CONFIG_USB_PD_TCPM_FUSB302)
162
// vbus measurment
163
#define CONFIG_USB_PD_VBUS_MEASURE_TCPC
164
// only support 2.0
165
#undef CONFIG_USB_PD_REV30
166
#endif
167
168
/* Override PD_ROLE_DEFAULT in usb_pd.h */
169
#define PD_ROLE_DEFAULT() (PD_ROLE_SINK)
170
171
#endif
Generated by
1.9.6