1USB Type-C port devices (eg. /sys/class/typec/port0/)
2
3What:		/sys/class/typec/<port>/data_role
4Date:		April 2017
5Contact:	Heikki Krogerus <[email protected]>
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 <[email protected]>
21Description:
22		The supported power roles. This attribute can be used to request
23		power role swap on the port when the port supports USB Power
24		Delivery. Swapping is supported as synchronous operation, so
25		write(2) to the attribute will not return until the operation
26		has finished. The attribute is notified about role changes so
27		that poll(2) on the attribute wakes up. Change on the role will
28		also generate uevent KOBJ_CHANGE. The current role is show in
29		brackets, for example "[source] sink" when in source mode.
30
31		Valid values: source, sink
32
33What:		/sys/class/typec/<port>/vconn_source
34Date:		April 2017
35Contact:	Heikki Krogerus <[email protected]>
36Description:
37		Shows is the port VCONN Source. This attribute can be used to
38		request VCONN swap to change the VCONN Source during connection
39		when both the port and the partner support USB Power Delivery.
40		Swapping is supported as synchronous operation, so write(2) to
41		the attribute will not return until the operation has finished.
42		The attribute is notified about VCONN source changes so that
43		poll(2) on the attribute wakes up. Change on VCONN source also
44		generates uevent KOBJ_CHANGE.
45
46		Valid values:
47		- "no" when the port is not the VCONN Source
48		- "yes" when the port is the VCONN Source
49
50What:		/sys/class/typec/<port>/power_operation_mode
51Date:		April 2017
52Contact:	Heikki Krogerus <[email protected]>
53Description:
54		Shows the current power operational mode the port is in. The
55		power operation mode means current level for VBUS. In case USB
56		Power Delivery communication is used for negotiating the levels,
57		power operation mode should show "usb_power_delivery".
58
59		Valid values:
60		- default
61		- 1.5A
62		- 3.0A
63		- usb_power_delivery
64
65What:		/sys/class/typec/<port>/preferred_role
66Date:		April 2017
67Contact:	Heikki Krogerus <[email protected]>
68Description:
69		The user space can notify the driver about the preferred role.
70		It should be handled as enabling of Try.SRC or Try.SNK, as
71		defined in USB Type-C specification, in the port drivers. By
72		default the preferred role should come from the platform.
73
74		Valid values: source, sink, none (to remove preference)
75
76What:		/sys/class/typec/<port>/supported_accessory_modes
77Date:		April 2017
78Contact:	Heikki Krogerus <[email protected]>
79Description:
80		Space separated list of accessory modes, defined in the USB
81		Type-C specification, the port supports.
82
83What:		/sys/class/typec/<port>/usb_power_delivery_revision
84Date:		April 2017
85Contact:	Heikki Krogerus <[email protected]>
86Description:
87		Revision number of the supported USB Power Delivery
88		specification, or 0 when USB Power Delivery is not supported.
89
90What:		/sys/class/typec/<port>/usb_typec_revision
91Date:		April 2017
92Contact:	Heikki Krogerus <[email protected]>
93Description:
94		Revision number of the supported USB Type-C specification.
95
96
97USB Type-C partner devices (eg. /sys/class/typec/port0-partner/)
98
99What:		/sys/class/typec/<port>-partner/accessory_mode
100Date:		April 2017
101Contact:	Heikki Krogerus <[email protected]>
102Description:
103		Shows the Accessory Mode name when the partner is an Accessory.
104		The Accessory Modes are defined in USB Type-C Specification.
105
106What:		/sys/class/typec/<port>-partner/supports_usb_power_delivery
107Date:		April 2017
108Contact:	Heikki Krogerus <[email protected]>
109Description:
110		Shows if the partner supports USB Power Delivery communication:
111		Valid values: yes, no
112
113What:		/sys/class/typec/<port>-partner>/identity/
114Date:		April 2017
115Contact:	Heikki Krogerus <[email protected]>
116Description:
117		This directory appears only if the port device driver is capable
118		of showing the result of Discover Identity USB power delivery
119		command. That will not always be possible even when USB power
120		delivery is supported, for example when USB power delivery
121		communication for the port is mostly handled in firmware. If the
122		directory exists, it will have an attribute file for every VDO
123		in Discover Identity command result.
124
125What:		/sys/class/typec/<port>-partner/identity/id_header
126Date:		April 2017
127Contact:	Heikki Krogerus <[email protected]>
128Description:
129		ID Header VDO part of Discover Identity command result. The
130		value will show 0 until Discover Identity command result becomes
131		available. The value can be polled.
132
133What:		/sys/class/typec/<port>-partner/identity/cert_stat
134Date:		April 2017
135Contact:	Heikki Krogerus <[email protected]>
136Description:
137		Cert Stat VDO part of Discover Identity command result. The
138		value will show 0 until Discover Identity command result becomes
139		available. The value can be polled.
140
141What:		/sys/class/typec/<port>-partner/identity/product
142Date:		April 2017
143Contact:	Heikki Krogerus <[email protected]>
144Description:
145		Product VDO part of Discover Identity command result. The value
146		will show 0 until Discover Identity command result becomes
147		available. The value can be polled.
148
149
150USB Type-C cable devices (eg. /sys/class/typec/port0-cable/)
151
152Note: Electronically Marked Cables will have a device also for one cable plug
153(eg. /sys/class/typec/port0-plug0). If the cable is active and has also SOP
154Double Prime controller (USB Power Deliver specification ch. 2.4) it will have
155second device also for the other plug. Both plugs may have alternate modes as
156described in USB Type-C and USB Power Delivery specifications.
157
158What:		/sys/class/typec/<port>-cable/type
159Date:		April 2017
160Contact:	Heikki Krogerus <[email protected]>
161Description:
162		Shows if the cable is active.
163		Valid values: active, passive
164
165What:		/sys/class/typec/<port>-cable/plug_type
166Date:		April 2017
167Contact:	Heikki Krogerus <[email protected]>
168Description:
169		Shows type of the plug on the cable:
170		- type-a - Standard A
171		- type-b - Standard B
172		- type-c
173		- captive
174
175What:		/sys/class/typec/<port>-cable/identity/
176Date:		April 2017
177Contact:	Heikki Krogerus <[email protected]>
178Description:
179		This directory appears only if the port device driver is capable
180		of showing the result of Discover Identity USB power delivery
181		command. That will not always be possible even when USB power
182		delivery is supported. If the directory exists, it will have an
183		attribute for every VDO returned by Discover Identity command.
184
185What:		/sys/class/typec/<port>-cable/identity/id_header
186Date:		April 2017
187Contact:	Heikki Krogerus <[email protected]>
188Description:
189		ID Header VDO part of Discover Identity command result. The
190		value will show 0 until Discover Identity command result becomes
191		available. The value can be polled.
192
193What:		/sys/class/typec/<port>-cable/identity/cert_stat
194Date:		April 2017
195Contact:	Heikki Krogerus <[email protected]>
196Description:
197		Cert Stat VDO part of Discover Identity command result. The
198		value will show 0 until Discover Identity command result becomes
199		available. The value can be polled.
200
201What:		/sys/class/typec/<port>-cable/identity/product
202Date:		April 2017
203Contact:	Heikki Krogerus <[email protected]>
204Description:
205		Product VDO part of Discover Identity command result. The value
206		will show 0 until Discover Identity command result becomes
207		available. The value can be polled.
208
209
210Alternate Mode devices.
211
212The alternate modes will have Standard or Vendor ID (SVID) assigned by USB-IF.
213The ports, partners and cable plugs can have alternate modes. A supported SVID
214will consist of a set of modes. Every SVID a port/partner/plug supports will
215have a device created for it, and every supported mode for a supported SVID will
216have its own directory under that device. Below <dev> refers to the device for
217the alternate mode.
218
219What:		/sys/class/typec/<port|partner|cable>/<dev>/svid
220Date:		April 2017
221Contact:	Heikki Krogerus <[email protected]>
222Description:
223		The SVID (Standard or Vendor ID) assigned by USB-IF for this
224		alternate mode.
225
226What:		/sys/class/typec/<port|partner|cable>/<dev>/mode<index>/
227Date:		April 2017
228Contact:	Heikki Krogerus <[email protected]>
229Description:
230		Every supported mode will have its own directory. The name of
231		a mode will be "mode<index>" (for example mode1), where <index>
232		is the actual index to the mode VDO returned by Discover Modes
233		USB power delivery command.
234
235What:		/sys/class/typec/<port|partner|cable>/<dev>/mode<index>/description
236Date:		April 2017
237Contact:	Heikki Krogerus <[email protected]>
238Description:
239		Shows description of the mode. The description is optional for
240		the drivers, just like with the Billboard Devices.
241
242What:		/sys/class/typec/<port|partner|cable>/<dev>/mode<index>/vdo
243Date:		April 2017
244Contact:	Heikki Krogerus <[email protected]>
245Description:
246		Shows the VDO in hexadecimal returned by Discover Modes command
247		for this mode.
248
249What:		/sys/class/typec/<port|partner|cable>/<dev>/mode<index>/active
250Date:		April 2017
251Contact:	Heikki Krogerus <[email protected]>
252Description:
253		Shows if the mode is active or not. The attribute can be used
254		for entering/exiting the mode with partners and cable plugs, and
255		with the port alternate modes it can be used for disabling
256		support for specific alternate modes. Entering/exiting modes is
257		supported as synchronous operation so write(2) to the attribute
258		does not return until the enter/exit mode operation has
259		finished. The attribute is notified when the mode is
260		entered/exited so poll(2) on the attribute wakes up.
261		Entering/exiting a mode will also generate uevent KOBJ_CHANGE.
262
263		Valid values: yes, no
264
265What:		/sys/class/typec/<port>/<dev>/mode<index>/supported_roles
266Date:		April 2017
267Contact:	Heikki Krogerus <[email protected]>
268Description:
269		Space separated list of the supported roles.
270
271		This attribute is available for the devices describing the
272		alternate modes a port supports, and it will not be exposed with
273		the devices presenting the alternate modes the partners or cable
274		plugs support.
275
276		Valid values: source, sink
277