All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/10] USB Type-C mode selection
@ 2025-08-04  9:03 Andrei Kuchynski
  2025-08-04  9:03 ` [PATCH v3 01/10] usb: typec: Add alt_mode_override field to port property Andrei Kuchynski
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: Andrei Kuchynski @ 2025-08-04  9:03 UTC (permalink / raw)
  To: Heikki Krogerus, Abhishek Pandit-Subedi, Benson Leung,
	Jameson Thies, Tzung-Bi Shih, linux-usb, chrome-platform
  Cc: Guenter Roeck, Greg Kroah-Hartman, Dmitry Baryshkov,
	Christian A. Ehrhardt, Venkat Jayaraman, linux-kernel,
	Andrei Kuchynski

This patch series introduces a flexible mechanism for USB Type-C mode
selection, enabling into USB4 mode, Thunderbolt alternate mode, or
DisplayPort alternate mode.

New sysfs attributes are exposed to provide user control over mode
selection:
`priority`, `usb4_priority`: Allows users to define their preferred order
for attempting mode entry.
`mode_priorities`: Lists the modes supported by the port, ordered by
priority.
`mode_selection`: Lists modes supported by the partner and triggers an
automatic mode negotiation.
`entry_result`, `usb4_entry_result`: Reports the status of the last mode
selection attempt.

The mode selection logic attempts to enter prioritized modes sequentially.
A mode is considered successfully negotiated only when its alternate mode
driver explicitly reports a positive status. Alternate mode drivers are
required to report their mode entry status (either successful or failed).
If the driver does not report its status within a defined timeout period,
the system automatically proceeds to attempt entry into the next preferred
mode.

This series was tested on a ChromeOS Brya device running kernel 6.6, and on
an Android OS device with kernel 6.16.

Changes in v3:
- The mode_priorities sysfs attribute has been made read-only.
- The mode_selection attribute now exclusively lists partner-supported
modes, with mode entry results reported via separate attributes.
- The driver returns mode entry results instead of error codes.
- Constant values are used in place of module parameters.

Andrei Kuchynski (10):
  usb: typec: Add alt_mode_override field to port property
  platform/chrome: cros_ec_typec: Set alt_mode_override flag
  usb: typec: ucsi: Set alt_mode_override flag
  usb: typec: Expose mode priorities via sysfs
  usb: typec: Implement automated mode selection
  usb: typec: Report altmode entry status via callback
  usb: typec: ucsi: displayport: Propagate DP altmode entry result
  platform/chrome: cros_ec_typec: Propagate altmode entry result
  platform/chrome: cros_ec_typec: Report USB4 entry status via callback
  platform/chrome: cros_ec_typec: Add default_usb_mode_set support

 Documentation/ABI/testing/sysfs-class-typec  |  72 +++
 drivers/platform/chrome/cros_ec_typec.c      |  17 +
 drivers/platform/chrome/cros_typec_altmode.c |  32 +-
 drivers/platform/chrome/cros_typec_altmode.h |   6 +
 drivers/usb/typec/Makefile                   |   2 +-
 drivers/usb/typec/altmodes/displayport.c     |  17 +-
 drivers/usb/typec/altmodes/thunderbolt.c     |   8 +
 drivers/usb/typec/class.c                    | 212 ++++++-
 drivers/usb/typec/class.h                    |  15 +
 drivers/usb/typec/mode_selection.c           | 575 +++++++++++++++++++
 drivers/usb/typec/mode_selection.h           |  54 ++
 drivers/usb/typec/ucsi/displayport.c         |  10 +-
 drivers/usb/typec/ucsi/ucsi.c                |   2 +
 include/linux/usb/pd_vdo.h                   |   2 +
 include/linux/usb/typec.h                    |   1 +
 include/linux/usb/typec_altmode.h            |  12 +
 include/linux/usb/typec_dp.h                 |   2 +
 include/linux/usb/typec_tbt.h                |   3 +
 18 files changed, 1024 insertions(+), 18 deletions(-)
 create mode 100644 drivers/usb/typec/mode_selection.c
 create mode 100644 drivers/usb/typec/mode_selection.h

-- 
2.50.1.565.gc32cd1483b-goog


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-08-14  8:28 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-04  9:03 [PATCH v3 00/10] USB Type-C mode selection Andrei Kuchynski
2025-08-04  9:03 ` [PATCH v3 01/10] usb: typec: Add alt_mode_override field to port property Andrei Kuchynski
2025-08-04  9:03 ` [PATCH v3 02/10] platform/chrome: cros_ec_typec: Set alt_mode_override flag Andrei Kuchynski
2025-08-04  9:03 ` [PATCH v3 03/10] usb: typec: ucsi: " Andrei Kuchynski
2025-08-04  9:03 ` [PATCH v3 04/10] usb: typec: Expose mode priorities via sysfs Andrei Kuchynski
2025-08-11 14:25   ` Heikki Krogerus
2025-08-11 18:22     ` Abhishek Pandit-Subedi
2025-08-12 11:40       ` Heikki Krogerus
2025-08-12 20:33         ` Abhishek Pandit-Subedi
2025-08-14  8:22           ` Andrei Kuchynski
2025-08-04  9:03 ` [PATCH v3 05/10] usb: typec: Implement automated mode selection Andrei Kuchynski
2025-08-04 13:00   ` kernel test robot
2025-08-11 15:31   ` Heikki Krogerus
2025-08-04  9:03 ` [PATCH v3 06/10] usb: typec: Report altmode entry status via callback Andrei Kuchynski
2025-08-04  9:03 ` [PATCH v3 07/10] usb: typec: ucsi: displayport: Propagate DP altmode entry result Andrei Kuchynski
2025-08-04  9:03 ` [PATCH v3 08/10] platform/chrome: cros_ec_typec: Propagate " Andrei Kuchynski
2025-08-04  9:03 ` [PATCH v3 09/10] platform/chrome: cros_ec_typec: Report USB4 entry status via callback Andrei Kuchynski
2025-08-04  9:03 ` [PATCH v3 10/10] platform/chrome: cros_ec_typec: Add default_usb_mode_set support Andrei Kuchynski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.