xref: /linux/Documentation/ABI/testing/sysfs-class-typec (revision 60675d4ca1ef0857e44eba5849b74a3a998d0c0f)
1USB Type-C port devices (eg. /sys/class/typec/port0/)
2
3What:		/sys/class/typec/<port>/data_role
4Date:		April 2017
5Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
6Description:
7		The supported USB data roles. This attribute can be used for
8		requesting data role swapping on the port. Swapping is supported
9		as synchronous operation, so write(2) to the attribute will not
10		return until the operation has finished. The attribute is
11		notified about role changes so that poll(2) on the attribute
12		wakes up. Change on the role will also generate uevent
13		KOBJ_CHANGE on the port. The current role is show in brackets,
14		for example "[host] device" when DRP port is in host mode.
15
16		Valid values: host, device
17
18What:		/sys/class/typec/<port>/power_role
19Date:		April 2017
20Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
21Description:
22		The supported power roles. This attribute can be used to request
23		power role swap on the port. Swapping is supported as
24		synchronous operation, so write(2) to the attribute will not
25		return until the operation has finished. The attribute is
26		notified about role changes so that poll(2) on the attribute
27		wakes up. Change on the role will also generate uevent
28		KOBJ_CHANGE. The current role is show in brackets, for example
29		"[source] sink" when in source mode.
30
31		Valid values: source, sink
32
33What:           /sys/class/typec/<port>/port_type
34Date:           May 2017
35Contact:	Badhri Jagan Sridharan <Badhri@google.com>
36Description:
37		Indicates the type of the port. This attribute can be used for
38		requesting a change in the port type. Port type change is
39		supported as a synchronous operation, so write(2) to the
40		attribute will not return until the operation has finished.
41
42		Valid values:
43
44		======  ==============================================
45		source  (The port will behave as source only DFP port)
46		sink    (The port will behave as sink only UFP port)
47		dual    (The port will behave as dual-role-data and
48			dual-role-power port)
49		======  ==============================================
50
51What:		/sys/class/typec/<port>/vconn_source
52Date:		April 2017
53Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
54Description:
55		Shows is the port VCONN Source. This attribute can be used to
56		request VCONN swap to change the VCONN Source during connection
57		when both the port and the partner support USB Power Delivery.
58		Swapping is supported as synchronous operation, so write(2) to
59		the attribute will not return until the operation has finished.
60		The attribute is notified about VCONN source changes so that
61		poll(2) on the attribute wakes up. Change on VCONN source also
62		generates uevent KOBJ_CHANGE.
63
64		Valid values:
65
66		- "no" when the port is not the VCONN Source
67		- "yes" when the port is the VCONN Source
68
69What:		/sys/class/typec/<port>/power_operation_mode
70Date:		April 2017
71Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
72Description:
73		Shows the current power operational mode the port is in. The
74		power operation mode means current level for VBUS. In case USB
75		Power Delivery communication is used for negotiating the levels,
76		power operation mode should show "usb_power_delivery".
77
78		Valid values:
79
80		- default
81		- 1.5A
82		- 3.0A
83		- usb_power_delivery
84
85What:		/sys/class/typec/<port>/preferred_role
86Date:		April 2017
87Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
88Description:
89		The user space can notify the driver about the preferred role.
90		It should be handled as enabling of Try.SRC or Try.SNK, as
91		defined in USB Type-C specification, in the port drivers. By
92		default the preferred role should come from the platform.
93
94		Valid values: source, sink, none (to remove preference)
95
96What:		/sys/class/typec/<port>/supported_accessory_modes
97Date:		April 2017
98Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
99Description:
100		Space separated list of accessory modes, defined in the USB
101		Type-C specification, the port supports.
102
103What:		/sys/class/typec/<port>/usb_power_delivery_revision
104Date:		April 2017
105Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
106Description:
107		Revision number of the supported USB Power Delivery
108		specification, or 0.0 when USB Power Delivery is not supported.
109
110		Example values:
111		- "2.0": USB Power Delivery Release 2.0
112		- "3.0": USB Power Delivery Release 3.0
113		- "3.1": USB Power Delivery Release 3.1
114
115What:		/sys/class/typec/<port>-{partner|cable}/usb_power_delivery_revision
116Date:		January 2021
117Contact:	Benson Leung <bleung@chromium.org>
118Description:
119		Revision number of the supported USB Power Delivery
120		specification of the port partner or cable, or 0.0 when USB
121		Power Delivery is not supported.
122
123		Example values:
124		- "2.0": USB Power Delivery Release 2.0
125		- "3.0": USB Power Delivery Release 3.0
126		- "3.1": USB Power Delivery Release 3.1
127
128What:		/sys/class/typec/<port>/usb_typec_revision
129Date:		April 2017
130Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
131Description:
132		Revision number of the supported USB Type-C specification.
133
134What:		/sys/class/typec/<port>/orientation
135Date:		February 2020
136Contact:	Badhri Jagan Sridharan <badhri@google.com>
137Description:
138		Indicates the active orientation of the Type-C connector.
139		Valid values:
140		- "normal": CC1 orientation
141		- "reverse": CC2 orientation
142		- "unknown": Orientation cannot be determined.
143
144What:		/sys/class/typec/<port>/select_usb_power_delivery
145Date:		May 2022
146Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
147Description:
148		Lists the USB Power Delivery Capabilities that the port can
149		advertise to the partner. The currently used capabilities are in
150		brackets. Selection happens by writing to the file.
151
152What:		/sys/class/typec/<port>/usb_capability
153Date:		November 2024
154Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
155Description:	Lists the supported USB Modes. The default USB mode that is used
156		next time with the Enter_USB Message is in brackets. The default
157		mode can be changed by writing to the file when supported by the
158		driver.
159
160		Valid values:
161		- usb2 (USB 2.0)
162		- usb3 (USB 3.2)
163		- usb4 (USB4)
164
165USB Type-C partner devices (eg. /sys/class/typec/port0-partner/)
166
167What:		/sys/class/typec/<port>-partner/accessory_mode
168Date:		April 2017
169Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
170Description:
171		Shows the Accessory Mode name when the partner is an Accessory.
172		The Accessory Modes are defined in USB Type-C Specification.
173
174What:		/sys/class/typec/<port>-partner/supports_usb_power_delivery
175Date:		April 2017
176Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
177Description:
178		Shows if the partner supports USB Power Delivery communication:
179		Valid values: yes, no
180
181What:		/sys/class/typec/<port>-partner/number_of_alternate_modes
182Date:		November 2020
183Contact:	Prashant Malani <pmalani@chromium.org>
184Description:
185		Shows the number of alternate modes which are advertised by the partner
186		during Power Delivery discovery. This file remains hidden until a value
187		greater than or equal to 0 is set by Type C port driver.
188
189What:		/sys/class/typec/<port>-partner/type
190Date:		December 2020
191Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
192Description:	USB Power Delivery Specification defines a set of product types
193		for the partner devices. This file will show the product type of
194		the partner if it is known. Dual-role capable partners will have
195		both UFP and DFP product types defined, but only one that
196		matches the current role will be active at the time. If the
197		product type of the partner is not visible to the device driver,
198		this file will not exist.
199
200		When the partner product type is detected, or changed with role
201		swap, uvevent is also raised that contains PRODUCT_TYPE=<product
202		type> (for example PRODUCT_TYPE=hub).
203
204		Valid values:
205
206		UFP / device role
207		======================  ==========================
208		undefined		-
209		hub			PDUSB Hub
210		peripheral		PDUSB Peripheral
211		psd			Power Bank
212		ama			Alternate Mode Adapter
213		======================  ==========================
214
215		DFP / host role
216		======================  ==========================
217		undefined		-
218		hub			PDUSB Hub
219		host			PDUSB Host
220		power_brick		Power Brick
221		amc			Alternate Mode Controller
222		======================  ==========================
223
224What:		/sys/class/typec/<port>-partner/identity/
225Date:		April 2017
226Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
227Description:
228		This directory appears only if the port device driver is capable
229		of showing the result of Discover Identity USB power delivery
230		command. That will not always be possible even when USB power
231		delivery is supported, for example when USB power delivery
232		communication for the port is mostly handled in firmware. If the
233		directory exists, it will have an attribute file for every VDO
234		in Discover Identity command result.
235
236What:		/sys/class/typec/<port>-partner/usb_mode
237Date:		November 2024
238Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
239Description:	The USB Modes that the partner device supports. The active mode
240		is displayed in brackets. The active USB mode can be changed by
241		writing to this file when the port driver is able to send Data
242		Reset Message to the partner. That requires USB Power Delivery
243		contract between the partner and the port.
244
245		Valid values:
246		- usb2 (USB 2.0)
247		- usb3 (USB 3.2)
248		- usb4 (USB4)
249
250USB Type-C cable devices (eg. /sys/class/typec/port0-cable/)
251
252Note: Electronically Marked Cables will have a device also for one cable plug
253(eg. /sys/class/typec/port0-plug0). If the cable is active and has also SOP
254Double Prime controller (USB Power Deliver specification ch. 2.4) it will have
255second device also for the other plug. Both plugs may have alternate modes as
256described in USB Type-C and USB Power Delivery specifications.
257
258What:		/sys/class/typec/<port>-cable/type
259Date:		April 2017
260Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
261Description:	USB Power Delivery Specification defines a set of product types
262		for the cables. This file will show the product type of the
263		cable if it is known. If the product type of the cable is not
264		visible to the device driver, this file will not exist.
265
266		When the cable product type is detected, uvevent is also raised
267		with PRODUCT_TYPE showing the product type of the cable.
268
269		Valid values:
270
271		======================  ==========================
272		undefined		-
273		active			Active Cable
274		passive			Passive Cable
275		======================  ==========================
276
277What:		/sys/class/typec/<port>-cable/plug_type
278Date:		April 2017
279Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
280Description:
281		Shows type of the plug on the cable:
282
283		- type-a - Standard A
284		- type-b - Standard B
285		- type-c
286		- captive
287
288What:		/sys/class/typec/<port>-<plug>/number_of_alternate_modes
289Date:		November 2020
290Contact:	Prashant Malani <pmalani@chromium.org>
291Description:
292		Shows the number of alternate modes which are advertised by the plug
293		associated with a particular cable during Power Delivery discovery.
294		This file remains hidden until a value greater than or equal to 0
295		is set by Type C port driver.
296
297
298USB Type-C partner/cable Power Delivery Identity objects
299
300NOTE: The following attributes will be applicable to both
301partner (e.g /sys/class/typec/port0-partner/) and
302cable (e.g /sys/class/typec/port0-cable/) devices. Consequently, the example file
303paths below are prefixed with "/sys/class/typec/<port>-{partner|cable}/" to
304reflect this.
305
306What:		/sys/class/typec/<port>-{partner|cable}/identity/
307Date:		April 2017
308Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
309Description:
310		This directory appears only if the port device driver is capable
311		of showing the result of Discover Identity USB power delivery
312		command. That will not always be possible even when USB power
313		delivery is supported, for example when USB power delivery
314		communication for the port is mostly handled in firmware. If the
315		directory exists, it will have an attribute file for every VDO
316		in Discover Identity command result.
317
318What:		/sys/class/typec/<port>-{partner|cable}/identity/id_header
319Date:		April 2017
320Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
321Description:
322		ID Header VDO part of Discover Identity command result. The
323		value will show 0 until Discover Identity command result becomes
324		available. The value can be polled.
325
326What:		/sys/class/typec/<port>-{partner|cable}/identity/cert_stat
327Date:		April 2017
328Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
329Description:
330		Cert Stat VDO part of Discover Identity command result. The
331		value will show 0 until Discover Identity command result becomes
332		available. The value can be polled.
333
334What:		/sys/class/typec/<port>-{partner|cable}/identity/product
335Date:		April 2017
336Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
337Description:
338		Product VDO part of Discover Identity command result. The value
339		will show 0 until Discover Identity command result becomes
340		available. The value can be polled.
341
342What:		/sys/class/typec/<port>-{partner|cable}/identity/product_type_vdo1
343Date:		October 2020
344Contact:	Prashant Malani <pmalani@chromium.org>
345Description:
346		1st Product Type VDO of Discover Identity command result.
347		The value will show 0 until Discover Identity command result becomes
348		available and a valid Product Type VDO is returned.
349
350What:		/sys/class/typec/<port>-{partner|cable}/identity/product_type_vdo2
351Date:		October 2020
352Contact:	Prashant Malani <pmalani@chromium.org>
353Description:
354		2nd Product Type VDO of Discover Identity command result.
355		The value will show 0 until Discover Identity command result becomes
356		available and a valid Product Type VDO is returned.
357
358What:		/sys/class/typec/<port>-{partner|cable}/identity/product_type_vdo3
359Date:		October 2020
360Contact:	Prashant Malani <pmalani@chromium.org>
361Description:
362		3rd Product Type VDO of Discover Identity command result.
363		The value will show 0 until Discover Identity command result becomes
364		available and a valid Product Type VDO is returned.
365
366
367USB Type-C port alternate mode devices.
368
369What:		/sys/class/typec/<port>/<alt mode>/supported_roles
370Date:		April 2017
371Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
372Description:
373		Space separated list of the supported roles.
374
375		Valid values: source, sink
376