drivers/usb/roles

USB Role Switch class and Intel xHCI OTG role switch

A small in-kernel framework that flips a USB port between host and device roles, used by USB Type-C dual-role connectors on modern laptops, phones, and tablets. It includes one concrete implementation for Intel SoCs whose xHCI controllers expose an on-the-go role-switch register, and is what decides whether a Type-C port acts as host or device when a cable is plugged in.

keep conf=0.87 deploy=medium replacement=none subsystem=usb category=bus-usb
87%

recommendation

It should stay because this is core plumbing for modern USB Type-C dual-role ports, deciding whether a port acts as host or device when something is plugged in. The generic role-switch class is referenced by current Type-C documentation, the Intel xHCI variant is still shipped in mainline kernels, and the directory was still receiving upstream bug fixes as recently as early 2026 with no sign of removal work.

repository signals

4 files
696 source lines
19 commits, 5y
+114 / −44 lines added / removed, 5y
15 authors, 5y
monthly commits · 2021-04-21 → 2026-04-21 · 19 total · active in 14/61 months
2021 2022 2023 2024 2025 2026 2021-04: 0 commits · +0 −0 2021-05: 1 commit · +9 −0 2021-06: 0 commits · +0 −0 2021-07: 0 commits · +0 −0 2021-08: 0 commits · +0 −0 2021-09: 0 commits · +0 −0 2021-10: 0 commits · +0 −0 2021-11: 0 commits · +0 −0 2021-12: 0 commits · +0 −0 2022-01: 0 commits · +0 −0 2022-02: 0 commits · +0 −0 2022-03: 0 commits · +0 −0 2022-04: 0 commits · +0 −0 2022-05: 0 commits · +0 −0 2022-06: 0 commits · +0 −0 2022-07: 0 commits · +0 −0 2022-08: 0 commits · +0 −0 2022-09: 0 commits · +0 −0 2022-10: 1 commit · +1 −1 2022-11: 1 commit · +4 −1 2022-12: 0 commits · +0 −0 2023-01: 1 commit · +1 −2 2023-02: 0 commits · +0 −0 2023-03: 1 commit · +1 −1 2023-04: 0 commits · +0 −0 2023-05: 2 commits · +4 −4 2023-06: 2 commits · +9 −10 2023-07: 0 commits · +0 −0 2023-08: 0 commits · +0 −0 2023-09: 0 commits · +0 −0 2023-10: 0 commits · +0 −0 2023-11: 0 commits · +0 −0 2023-12: 0 commits · +0 −0 2024-01: 2 commits · +21 −8 2024-02: 1 commit · +38 −2 2024-03: 0 commits · +0 −0 2024-04: 0 commits · +0 −0 2024-05: 0 commits · +0 −0 2024-06: 0 commits · +0 −0 2024-07: 0 commits · +0 −0 2024-08: 1 commit · +9 −0 2024-09: 2 commits · +6 −10 2024-10: 0 commits · +0 −0 2024-11: 0 commits · +0 −0 2024-12: 0 commits · +0 −0 2025-01: 0 commits · +0 −0 2025-02: 1 commit · +3 −2 2025-03: 0 commits · +0 −0 2025-04: 0 commits · +0 −0 2025-05: 0 commits · +0 −0 2025-06: 0 commits · +0 −0 2025-07: 0 commits · +0 −0 2025-08: 0 commits · +0 −0 2025-09: 0 commits · +0 −0 2025-10: 0 commits · +0 −0 2025-11: 0 commits · +0 −0 2025-12: 0 commits · +0 −0 2026-01: 0 commits · +0 −0 2026-02: 2 commits · +2 −2 2026-03: 1 commit · +6 −1 2026-04: 0 commits · +0 −0

sources

  1. spinics.net

    March 23, 2026 stable review patch for "usb: roles" shows the directory is still receiving upstream bug-fix traffic rather than removal work.

  2. cateee.net

    LKDDb shows CONFIG_USB_ROLES_INTEL_XHCI is still present through 7.0-rc+HEAD and documents the Intel xHCI role-switch hardware covered by this directory.

  3. docs.kernel.org

    Kernel documentation states dual-role capable Type-C ports may use the USB Role Class API, indicating the generic role-switch code remains relevant to modern Type-C designs.

codex reasoning notes (technical)

Local file inspection (shell `sed`) showed this directory contains both a generic usb_role_switch class implementation and one concrete Intel xHCI platform driver, so it is a real driver directory, not just docs/helpers. Local git history (shell `git log`) shows substantive touches through 2026-03-11 with many authors over the last 5 years, matching ongoing maintenance. The spinics stable URL was obtained via web search and used as lore-adjacent evidence of current upstream maintenance activity; I found no removal/deprecation thread in those searches. The LKDDb URL was obtained via web search and supports that the Intel-specific driver is still upstream in current kernels. The docs.kernel.org URL was obtained via web search and supports ongoing relevance of the generic USB role-switch class for modern dual-role USB Type-C hardware. Overall this looks active and still useful for current deployments, so keep rather than deprecate/remove.