@@ -61,7 +61,7 @@ Registering the ports
61
61
The port drivers will describe every Type-C port they control with struct
62
62
typec_capability data structure, and register them with the following API:
63
63
64
- .. kernel-doc :: drivers/usb/typec/typec .c
64
+ .. kernel-doc :: drivers/usb/typec/class .c
65
65
:functions: typec_register_port typec_unregister_port
66
66
67
67
When registering the ports, the prefer_role member in struct typec_capability
@@ -80,7 +80,7 @@ typec_partner_desc. The class copies the details of the partner during
80
80
registration. The class offers the following API for registering/unregistering
81
81
partners.
82
82
83
- .. kernel-doc :: drivers/usb/typec/typec .c
83
+ .. kernel-doc :: drivers/usb/typec/class .c
84
84
:functions: typec_register_partner typec_unregister_partner
85
85
86
86
The class will provide a handle to struct typec_partner if the registration was
@@ -92,7 +92,7 @@ should include handle to struct usb_pd_identity instance. The class will then
92
92
create a sysfs directory for the identity under the partner device. The result
93
93
of Discover Identity command can then be reported with the following API:
94
94
95
- .. kernel-doc :: drivers/usb/typec/typec .c
95
+ .. kernel-doc :: drivers/usb/typec/class .c
96
96
:functions: typec_partner_set_identity
97
97
98
98
Registering Cables
@@ -113,7 +113,7 @@ typec_cable_desc and about a plug in struct typec_plug_desc. The class copies
113
113
the details during registration. The class offers the following API for
114
114
registering/unregistering cables and their plugs:
115
115
116
- .. kernel-doc :: drivers/usb/typec/typec .c
116
+ .. kernel-doc :: drivers/usb/typec/class .c
117
117
:functions: typec_register_cable typec_unregister_cable typec_register_plug typec_unregister_plug
118
118
119
119
The class will provide a handle to struct typec_cable and struct typec_plug if
@@ -125,7 +125,7 @@ include handle to struct usb_pd_identity instance. The class will then create a
125
125
sysfs directory for the identity under the cable device. The result of Discover
126
126
Identity command can then be reported with the following API:
127
127
128
- .. kernel-doc :: drivers/usb/typec/typec .c
128
+ .. kernel-doc :: drivers/usb/typec/class .c
129
129
:functions: typec_cable_set_identity
130
130
131
131
Notifications
@@ -135,7 +135,7 @@ When the partner has executed a role change, or when the default roles change
135
135
during connection of a partner or cable, the port driver must use the following
136
136
APIs to report it to the class:
137
137
138
- .. kernel-doc :: drivers/usb/typec/typec .c
138
+ .. kernel-doc :: drivers/usb/typec/class .c
139
139
:functions: typec_set_data_role typec_set_pwr_role typec_set_vconn_role typec_set_pwr_opmode
140
140
141
141
Alternate Modes
@@ -150,7 +150,7 @@ and struct typec_altmode_desc which is a container for all the supported modes.
150
150
Ports that support Alternate Modes need to register each SVID they support with
151
151
the following API:
152
152
153
- .. kernel-doc :: drivers/usb/typec/typec .c
153
+ .. kernel-doc :: drivers/usb/typec/class .c
154
154
:functions: typec_port_register_altmode
155
155
156
156
If a partner or cable plug provides a list of SVIDs as response to USB Power
@@ -159,24 +159,75 @@ registered.
159
159
160
160
API for the partners:
161
161
162
- .. kernel-doc :: drivers/usb/typec/typec .c
162
+ .. kernel-doc :: drivers/usb/typec/class .c
163
163
:functions: typec_partner_register_altmode
164
164
165
165
API for the Cable Plugs:
166
166
167
- .. kernel-doc :: drivers/usb/typec/typec .c
167
+ .. kernel-doc :: drivers/usb/typec/class .c
168
168
:functions: typec_plug_register_altmode
169
169
170
170
So ports, partners and cable plugs will register the alternate modes with their
171
171
own functions, but the registration will always return a handle to struct
172
172
typec_altmode on success, or NULL. The unregistration will happen with the same
173
173
function:
174
174
175
- .. kernel-doc :: drivers/usb/typec/typec .c
175
+ .. kernel-doc :: drivers/usb/typec/class .c
176
176
:functions: typec_unregister_altmode
177
177
178
178
If a partner or cable plug enters or exits a mode, the port driver needs to
179
179
notify the class with the following API:
180
180
181
- .. kernel-doc :: drivers/usb/typec/typec .c
181
+ .. kernel-doc :: drivers/usb/typec/class .c
182
182
:functions: typec_altmode_update_active
183
+
184
+ Multiplexer/DeMultiplexer Switches
185
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
186
+
187
+ USB Type-C connectors may have one or more mux/demux switches behind them. Since
188
+ the plugs can be inserted right-side-up or upside-down, a switch is needed to
189
+ route the correct data pairs from the connector to the USB controllers. If
190
+ Alternate or Accessory Modes are supported, another switch is needed that can
191
+ route the pins on the connector to some other component besides USB. USB Type-C
192
+ Connector Class supplies an API for registering those switches.
193
+
194
+ .. kernel-doc :: drivers/usb/typec/mux.c
195
+ :functions: typec_switch_register typec_switch_unregister typec_mux_register typec_mux_unregister
196
+
197
+ In most cases the same physical mux will handle both the orientation and mode.
198
+ However, as the port drivers will be responsible for the orientation, and the
199
+ alternate mode drivers for the mode, the two are always separated into their
200
+ own logical components: "mux" for the mode and "switch" for the orientation.
201
+
202
+ When a port is registered, USB Type-C Connector Class requests both the mux and
203
+ the switch for the port. The drivers can then use the following API for
204
+ controlling them:
205
+
206
+ .. kernel-doc :: drivers/usb/typec/class.c
207
+ :functions: typec_set_orientation typec_set_mode
208
+
209
+ If the connector is dual-role capable, there may also be a switch for the data
210
+ role. USB Type-C Connector Class does not supply separate API for them. The
211
+ port drivers can use USB Role Class API with those.
212
+
213
+ Illustration of the muxes behind a connector that supports an alternate mode:
214
+
215
+ ------------------------
216
+ | Connector |
217
+ ------------------------
218
+ | |
219
+ ------------------------
220
+ \ Orientation /
221
+ --------------------
222
+ |
223
+ --------------------
224
+ / Mode \
225
+ ------------------------
226
+ / \
227
+ ------------------------ --------------------
228
+ | Alt Mode | / USB Role \
229
+ ------------------------ ------------------------
230
+ / \
231
+ ------------------------ ------------------------
232
+ | USB Host | | USB Device |
233
+ ------------------------ ------------------------
0 commit comments