Skip to content

usb: typec: USB Modes

Heikki Krogerus linux-usb 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 0 repliesNew
  2. v34 patches 10 repliesSuperseded
  3. v24 patches 2 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches4 repliesSuperseded

Changes in v4 from the cover letter

- Fixed the dates in the ABI documentation - Greg
- Now using sysfs_emit_at() everywhere - Greg

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4usb: typec: Add attribute file showing the supported USB modes of the portDocumentation/ABI/testing/sysfs-class-typec drivers/usb/typec/class.c drivers/usb/typec/class.h +1 more+112 -00 replies
2/4usb: typec: Add attribute file showing the USB Modes of the partnerDocumentation/ABI/testing/sysfs-class-typec drivers/usb/typec/class.c drivers/usb/typec/class.h +1 more+141 -40 replies
3/4usb: typec: ucsi: Supply the USB capabilities to the portsdrivers/usb/typec/ucsi/ucsi.c drivers/usb/typec/ucsi/ucsi.h+15 -00 replies
4/4usb: typec: ucsi: Add support for the partner USB Modesdrivers/usb/typec/ucsi/ucsi.c drivers/usb/typec/ucsi/ucsi.h+11 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/4] usb: typec: USB Modes

Hi,

Changed since v3:
- Fixed the dates in the ABI documentation - Greg
- Now using sysfs_emit_at() everywhere - Greg

Changed since v2:
- Renamed the callbacks - Abhishek

Changed since v1:
- Leaving the usb_mode file hidden if the usb capabilities are not known - Dmitriy
- Fixed kernel doc warning - kernel test robot

This was originally a proposal of mine that I posted back in 2019 as an RFC [1].

The goal is to expose the USB Mode - USB Mode as defined in the USB Type-C and USB Power Delivery specifications - to the user via sysfs.

With ports the mode will show the supported and the default USB Mode, which is the mode that is (or should be) used in the next Enter_USB Message.

With the partners the mode will show similarly the supported USB modes, and also the active mode. Changing the active mode should cause Data Reset (as described in the USB Power Delivery spec.). This should happen even if there is no active USB Mode (in Alternate Mode).

I've modified the original RFC patches based on comments I've received (offline). The major change is that I renamed the sysfs attribute file for the port from "usb_mode" to "usb_capability".

I'm taking the USB mode in use in the UCSI driver with these, but I did not add support for the "Set USB" UCSI command yet. I have no way of testing it. Also, I don't really like that we have to construct the Enter_USB Message from the abstracted information that UCSI supplies. The interface should supply the Enter_USB Message that was used as is.

[1] https://lore.kernel.org/linux-usb/[email protected]/

Heikki Krogerus (4):
usb: typec: Add attribute file showing the supported USB modes of the
port
usb: typec: Add attribute file showing the USB Modes of the partner
usb: typec: ucsi: Supply the USB capabilities to the ports
usb: typec: ucsi: Add support for the partner USB Modes

 Documentation/ABI/testing/sysfs-class-typec |  27 +++
 drivers/usb/typec/class.c                   | 205 +++++++++++++++++++-
 drivers/usb/typec/class.h                   |   3 +
 drivers/usb/typec/ucsi/ucsi.c               |  16 ++
 drivers/usb/typec/ucsi/ucsi.h               |  10 +
 include/linux/usb/typec.h                   |  22 +++
 6 files changed, 279 insertions(+), 4 deletions(-)
Signature · 1 line
2.45.2