| From: |
| Andrei Kuchynski <akuchynski-AT-chromium.org> |
| To: |
| Heikki Krogerus <heikki.krogerus-AT-linux.intel.com>, Abhishek Pandit-Subedi <abhishekpandit-AT-chromium.org>, Benson Leung <bleung-AT-chromium.org>, Jameson Thies <jthies-AT-google.com>, Tzung-Bi Shih <tzungbi-AT-kernel.org>, linux-usb-AT-vger.kernel.org, chrome-platform-AT-lists.linux.dev |
| Subject: |
| [PATCH v4 0/4] USB Type-C alternate mode priorities |
| Date: |
| Fri, 12 Sep 2025 06:47:47 +0000 |
| Message-ID: |
| <20250912064751.1987850-1-akuchynski@chromium.org> |
| Cc: |
| Guenter Roeck <groeck-AT-chromium.org>, Greg Kroah-Hartman <gregkh-AT-linuxfoundation.org>, linux-kernel-AT-vger.kernel.org, Andrei Kuchynski <akuchynski-AT-chromium.org> |
| Archive-link: |
| Article |
This patch series introduces a mechanism for setting USB Type-C alternate
mode priorities. It allows the user to specify their preferred order for
mode selection, such as USB4, Thunderbolt, or DisplayPort.
A new sysfs attribute named 'priority' is exposed to provide user-space
control over the mode selection process.
This series was tested on a Android OS device running kernel 6.16.
Changes in v4:
- replaced sprintf with sysfs_emit
- changed priority to u8
- added an overflow check to typec_mode_set_priority(), now returning
-EOVERFLOW on failure
Andrei Kuchynski (4):
usb: typec: Add mode_control field to port property
platform/chrome: cros_ec_typec: Set no_mode_control flag
usb: typec: Implement alternate mode priority handling
usb: typec: Expose alternate mode priority via sysfs
Documentation/ABI/testing/sysfs-class-typec | 11 ++++
drivers/platform/chrome/cros_ec_typec.c | 1 +
drivers/usb/typec/Makefile | 2 +-
drivers/usb/typec/class.c | 46 +++++++++++++--
drivers/usb/typec/class.h | 1 +
drivers/usb/typec/mode_selection.c | 62 +++++++++++++++++++++
drivers/usb/typec/mode_selection.h | 5 ++
include/linux/usb/typec.h | 2 +
include/linux/usb/typec_altmode.h | 1 +
9 files changed, 126 insertions(+), 5 deletions(-)
create mode 100644 drivers/usb/typec/mode_selection.c
create mode 100644 drivers/usb/typec/mode_selection.h
--
2.51.0.384.g4c02a37b29-goog