aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/ABI/obsolete/sysfs-class-typec48
-rw-r--r--Documentation/ABI/testing/sysfs-bus-typec51
-rw-r--r--Documentation/ABI/testing/sysfs-class-typec62
-rw-r--r--Documentation/driver-api/usb/typec_bus.rst136
-rw-r--r--MAINTAINERS11
-rw-r--r--drivers/usb/typec/Makefile2
-rw-r--r--drivers/usb/typec/bus.c401
-rw-r--r--drivers/usb/typec/bus.h38
-rw-r--r--drivers/usb/typec/class.c366
-rw-r--r--include/linux/mod_devicetable.h15
-rw-r--r--include/linux/usb/typec.h14
-rw-r--r--include/linux/usb/typec_altmode.h160
-rw-r--r--scripts/mod/devicetable-offsets.c4
-rw-r--r--scripts/mod/file2alias.c13
14 files changed, 1174 insertions, 147 deletions
diff --git a/Documentation/ABI/obsolete/sysfs-class-typec b/Documentation/ABI/obsolete/sysfs-class-typec
new file mode 100644
index 000000000000..32623514ee87
--- /dev/null
+++ b/Documentation/ABI/obsolete/sysfs-class-typec
@@ -0,0 +1,48 @@
1These files are deprecated and will be removed. The same files are available
2under /sys/bus/typec (see Documentation/ABI/testing/sysfs-bus-typec).
3
4What: /sys/class/typec/<port|partner|cable>/<dev>/svid
5Date: April 2017
6Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
7Description:
8 The SVID (Standard or Vendor ID) assigned by USB-IF for this
9 alternate mode.
10
11What: /sys/class/typec/<port|partner|cable>/<dev>/mode<index>/
12Date: April 2017
13Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
14Description:
15 Every supported mode will have its own directory. The name of
16 a mode will be "mode<index>" (for example mode1), where <index>
17 is the actual index to the mode VDO returned by Discover Modes
18 USB power delivery command.
19
20What: /sys/class/typec/<port|partner|cable>/<dev>/mode<index>/description
21Date: April 2017
22Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
23Description:
24 Shows description of the mode. The description is optional for
25 the drivers, just like with the Billboard Devices.
26
27What: /sys/class/typec/<port|partner|cable>/<dev>/mode<index>/vdo
28Date: April 2017
29Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
30Description:
31 Shows the VDO in hexadecimal returned by Discover Modes command
32 for this mode.
33
34What: /sys/class/typec/<port|partner|cable>/<dev>/mode<index>/active
35Date: April 2017
36Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
37Description:
38 Shows if the mode is active or not. The attribute can be used
39 for entering/exiting the mode with partners and cable plugs, and
40 with the port alternate modes it can be used for disabling
41 support for specific alternate modes. Entering/exiting modes is
42 supported as synchronous operation so write(2) to the attribute
43 does not return until the enter/exit mode operation has
44 finished. The attribute is notified when the mode is
45 entered/exited so poll(2) on the attribute wakes up.
46 Entering/exiting a mode will also generate uevent KOBJ_CHANGE.
47
48 Valid values: yes, no
diff --git a/Documentation/ABI/testing/sysfs-bus-typec b/Documentation/ABI/testing/sysfs-bus-typec
new file mode 100644
index 000000000000..205d9c91e2e1
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-bus-typec
@@ -0,0 +1,51 @@
1What: /sys/bus/typec/devices/.../active
2Date: July 2018
3Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
4Description:
5 Shows if the mode is active or not. The attribute can be used
6 for entering/exiting the mode. Entering/exiting modes is
7 supported as synchronous operation so write(2) to the attribute
8 does not return until the enter/exit mode operation has
9 finished. The attribute is notified when the mode is
10 entered/exited so poll(2) on the attribute wakes up.
11 Entering/exiting a mode will also generate uevent KOBJ_CHANGE.
12
13 Valid values are boolean.
14
15What: /sys/bus/typec/devices/.../description
16Date: July 2018
17Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
18Description:
19 Shows description of the mode. The description is optional for
20 the drivers, just like with the Billboard Devices.
21
22What: /sys/bus/typec/devices/.../mode
23Date: July 2018
24Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
25Description:
26 The index number of the mode returned by Discover Modes USB
27 Power Delivery command. Depending on the alternate mode, the
28 mode index may be significant.
29
30 With some alternate modes (SVIDs), the mode index is assigned
31 for specific functionality in the specification for that
32 alternate mode.
33
34 With other alternate modes, the mode index values are not
35 assigned, and can not be therefore used for identification. When
36 the mode index is not assigned, identifying the alternate mode
37 must be done with either mode VDO or the description.
38
39What: /sys/bus/typec/devices/.../svid
40Date: July 2018
41Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
42Description:
43 The Standard or Vendor ID (SVID) assigned by USB-IF for this
44 alternate mode.
45
46What: /sys/bus/typec/devices/.../vdo
47Date: July 2018
48Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
49Description:
50 Shows the VDO in hexadecimal returned by Discover Modes command
51 for this mode.
diff --git a/Documentation/ABI/testing/sysfs-class-typec b/Documentation/ABI/testing/sysfs-class-typec
index 5be552e255e9..d7647b258c3c 100644
--- a/Documentation/ABI/testing/sysfs-class-typec
+++ b/Documentation/ABI/testing/sysfs-class-typec
@@ -222,70 +222,12 @@ Description:
222 available. The value can be polled. 222 available. The value can be polled.
223 223
224 224
225Alternate Mode devices. 225USB Type-C port alternate mode devices.
226 226
227The alternate modes will have Standard or Vendor ID (SVID) assigned by USB-IF. 227What: /sys/class/typec/<port>/<alt mode>/supported_roles
228The ports, partners and cable plugs can have alternate modes. A supported SVID
229will consist of a set of modes. Every SVID a port/partner/plug supports will
230have a device created for it, and every supported mode for a supported SVID will
231have its own directory under that device. Below <dev> refers to the device for
232the alternate mode.
233
234What: /sys/class/typec/<port|partner|cable>/<dev>/svid
235Date: April 2017
236Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
237Description:
238 The SVID (Standard or Vendor ID) assigned by USB-IF for this
239 alternate mode.
240
241What: /sys/class/typec/<port|partner|cable>/<dev>/mode<index>/
242Date: April 2017
243Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
244Description:
245 Every supported mode will have its own directory. The name of
246 a mode will be "mode<index>" (for example mode1), where <index>
247 is the actual index to the mode VDO returned by Discover Modes
248 USB power delivery command.
249
250What: /sys/class/typec/<port|partner|cable>/<dev>/mode<index>/description
251Date: April 2017
252Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
253Description:
254 Shows description of the mode. The description is optional for
255 the drivers, just like with the Billboard Devices.
256
257What: /sys/class/typec/<port|partner|cable>/<dev>/mode<index>/vdo
258Date: April 2017
259Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
260Description:
261 Shows the VDO in hexadecimal returned by Discover Modes command
262 for this mode.
263
264What: /sys/class/typec/<port|partner|cable>/<dev>/mode<index>/active
265Date: April 2017
266Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
267Description:
268 Shows if the mode is active or not. The attribute can be used
269 for entering/exiting the mode with partners and cable plugs, and
270 with the port alternate modes it can be used for disabling
271 support for specific alternate modes. Entering/exiting modes is
272 supported as synchronous operation so write(2) to the attribute
273 does not return until the enter/exit mode operation has
274 finished. The attribute is notified when the mode is
275 entered/exited so poll(2) on the attribute wakes up.
276 Entering/exiting a mode will also generate uevent KOBJ_CHANGE.
277
278 Valid values: yes, no
279
280What: /sys/class/typec/<port>/<dev>/mode<index>/supported_roles
281Date: April 2017 228Date: April 2017
282Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com> 229Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
283Description: 230Description:
284 Space separated list of the supported roles. 231 Space separated list of the supported roles.
285 232