Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

/sys/class/typec

FieldValue
SubsystemUSB Type-C connector class, drivers/usb/typec/ (typec-y := class.o mux.o bus.o pd.o retimer.o mode_selection.o; obj-$(CONFIG_TYPEC) += typec.o, torvalds/linux master)
Config gateCONFIG_TYPEC (obj line verified against torvalds/linux master 2026)
ABI documentationDocumentation/ABI/testing/sysfs-class-typec (31 What entries); Documentation/ABI/obsolete/sysfs-class-typec (class alt-mode files deprecated in favor of sysfs-bus-typec)
SinceApril 2017 (core role/mode files); Feb 2020 (orientation); Nov 2020 (number_of_alternate_modes); Jan 2021 (partner/cable usb_power_delivery_revision); May 2022 (select_usb_power_delivery); Nov 2024 (usb_capability, partner usb_mode); Jul 2025 (alt-mode priority)
Live (5.10.134 host)class absent: no /sys/class/typec directory, no connector registered
Ledger IDSYSC-typec

What it represents

Three kinds of devices under one class: ports (port0), partners (port0-partner), and cables (port0-cable, with port0-plug0 for electronically marked cables). Ports expose role control: data_role (host/device), power_role (source/sink), port_type (source/sink/dual), and vconn_source, each with synchronous swap semantics – the ABI states write(2) does not return until the swap finished, poll(2) wakes on role changes, and changes raise KOBJ_CHANGE uevents. PD negotiation surfaces as power_operation_mode (default / 1.5A / 3.0A / usb_power_delivery), usb_power_delivery_revision, select_usb_power_delivery, and usb_capability (usb2/usb3/usb4). Partner and cable directories carry product-type discovery (type, accessory_mode, plug_type), the identity/ VDO directory from the Discover Identity command, and number_of_alternate_modes.

Relationship to the device model

The driver-api typec doc states every port is presented as its own device under /sys/class/typec/, and that the partner device’s parent is always its port (e.g. /sys/class/typec/port0/port0-partner/). Alternate-mode devices originally appeared under the class too, but the obsolete ABI header says those files are deprecated and “the same files are available under /sys/bus/typec” – sysfs-bus-typec documents the surviving svid/mode/vdo/active set there. The class coexists with usb_role (role switches for non-Type-C ports) and usb_power_delivery (PDO trees).

Attributes

AttributeR/WUnit/formatConditional?Source
port/data_roleRW[host] device style list; bracketed = current; write to swapalwaysABI testing sysfs-class-typec (Apr 2017)
port/power_roleRW[source] sink style list; write to swapalwaysABI testing sysfs-class-typec (Apr 2017)
port/port_typeRWsource / sink / dualalwaysABI testing sysfs-class-typec (May 2017)
port/vconn_sourceRWyes / noalwaysABI testing sysfs-class-typec (Apr 2017)
port/preferred_roleRWsource / sink / none (Try.SRC / Try.SNK hint)alwaysABI testing sysfs-class-typec (Apr 2017)
port/power_operation_modeROdefault, 1.5A, 3.0A, usb_power_deliveryalwaysABI testing sysfs-class-typec (Apr 2017)
port/usb_power_delivery_revisionRO“2.0”, “3.0”, “3.1”, or 0.0alwaysABI testing sysfs-class-typec (Apr 2017)
port/usb_typec_revisionROType-C spec revisionalwaysABI testing sysfs-class-typec (Apr 2017)
port/orientationROnormal / reverse / unknown (CC1/CC2)alwaysABI testing sysfs-class-typec (Feb 2020)
port/select_usb_power_deliveryRWPD capabilities list, bracketed = usedalwaysABI testing sysfs-class-typec (May 2022)
port/usb_capabilityRWusb2 / usb3 / usb4, bracketed = default Enter_USB modealwaysABI testing sysfs-class-typec (Nov 2024)
port/supported_accessory_modesROspace-separated accessory mode listalwaysABI testing sysfs-class-typec (Apr 2017)
partner/{supports_usb_power_delivery,type,accessory_mode,usb_mode,number_of_alternate_modes}ROyes/no; product type (hub, peripheral, psd, ama, host, power_brick, amc); usb2/usb3/usb4some hidden until PD discoveryABI testing sysfs-class-typec (2017-2024)
{partner,cable}/identity/{id_header,cert_stat,product,product_type_vdo1..3}ROVDO hex values; 0 until Discover Identity result available; pollabledir appears only if driver supports itABI testing sysfs-class-typec (2017-2020)
cable/type, cable/plug_typeROactive/passive/undefined; type-a/type-b/type-c/captiveif visible to driverABI testing sysfs-class-typec (Apr 2017)
<alt-mode>/supported_roles, <alt-mode>/priorityRO / RWsource/sink; integer 0-255, lower = higher priorityalt modes onlyABI testing sysfs-class-typec (2017, Jul 2025)
<dev>/mode<index>/{svid,description,vdo,active}mixedalt-mode VDO data; active enters/exits the modedeprecated under the class; live under /sys/bus/typecABI obsolete sysfs-class-typec; testing sysfs-bus-typec (Jul 2018)

Safety and writes

Role swaps, port_type changes, VCONN swaps, and mode enter/exit are synchronous hardware operations – a write blocks until the physical negotiation finishes, and can fail outright (the ABI documents errors for unsupported swaps via the poll/KOBJ_CHANGE contract). Writing select_usb_power_delivery, usb_capability, and priority re-negotiates what the port advertises. Reads are safe, including pollable identity VDOs. No capability requirements are stated; in practice writes need root or udev-granted rights.

References

  • Documentation/ABI/testing/sysfs-class-typec, Documentation/ABI/obsolete/sysfs-class-typec, Documentation/ABI/testing/sysfs-bus-typec (cached copies; online: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-typec)
  • Documentation/driver-api/usb/typec.rst (not in sparse cache; device-model statements cited from it)
  • drivers/usb/typec/Makefile (torvalds/linux master; fetched obj line)
  • Ledger row SYSC-typec; /sys/class/typec absent per source-cache/live-sys/class-list.txt
  • Sibling pages: usb_power_delivery, usb_role, udc