mbox series

[RFC,0/3] usb: typec: New attribute files for USB mode

Message ID 20191230152857.43917-1-heikki.krogerus@linux.intel.com (mailing list archive)
Headers show
Series usb: typec: New attribute files for USB mode | expand

Message

Heikki Krogerus Dec. 30, 2019, 3:28 p.m. UTC
Hi Guenter,

These patches introduce the new sysfs attribute files that allow the
user to see and also control the USB mode. The last patch just adds
driver for the TBT3 alt mode. The series is made on top of:
https://lore.kernel.org/linux-usb/20191230142611.24921-1-heikki.krogerus@linux.intel.com/

What I'm proposing is that we introduce a new sysfs attribute file
named "usb_mode" for both the port and partner devices. The file
displays the supported USB modes (usb2, usb3, usb4) when read in with
both types of devices.

If the user writes to the port attribute file a mode, that mode will
be used as the value for the "USB mode" field in the Enter_USB message
next time there is a connection. Changing the active mode of the port
does not affect the current connection. However, if the user writes to
the partner attribute file a mode, Data Reset message is expected to
be send to the partner, and the new mode is to be used with the
Enter_USB message that follows (as defined in the latest USB Power
Delivery spec.).

So the attribute file is the same for both port and partner, but
writing to it has different behaviour.

The new attribute files should work, but I want to make sure that the
approach is acceptable?

thanks,

Heikki Krogerus (3):
  usb: typec: Add attribute file showing the USB mode of the port
  usb: typec: Add attribute file showing the USB mode of the partner
  usb: typec: Add driver for Thunderbolt 3 Alternate Mode

 Documentation/ABI/testing/sysfs-class-typec |  34 +++
 drivers/usb/typec/altmodes/Kconfig          |   9 +
 drivers/usb/typec/altmodes/Makefile         |   2 +
 drivers/usb/typec/altmodes/thunderbolt.c    | 309 ++++++++++++++++++++
 drivers/usb/typec/class.c                   | 133 ++++++++-
 include/linux/usb/typec.h                   |  11 +
 6 files changed, 497 insertions(+), 1 deletion(-)
 create mode 100644 drivers/usb/typec/altmodes/thunderbolt.c