USB Type-C Connector class
Subsystems (3)
Heikki Krogerus
maintainerv8 cover USB Type-C Connector class
The USB Type-C class is meant to provide unified interface to the userspace to present the USB Type-C ports in a system.
Changes since v7:
- Removed "type" attribute from partners
- Added supports_usb_power_delivery attribute for partner and cable
Changes since v6:
- current_vconn_role attr renamed to vconn_source (no API changes)
- Small documentation improvements proposed by Vincent Palatin
Changes since v5:
- Only updating the roles based on driver notifications
- Added MODULE_ALIAS for the WhiskeyCove module
- Including the patch that creates the actual platform device for the WhiskeyCove Type-C PHY in this series.
Changes since v4:
- Remove the port lock completely
Changes since v3:
- Documentation cleanup as proposed by Roger Quadros
- Setting partner altmodes member to NULL on removal and fixing a warning, as proposed by Guenter Roeck
- Added the following attributes for partners and cables:
* supports_usb_power_delivery
* id_header_vdo
- "id_header_vdo" is visible only when the partner or cable supports USB Power Delivery communication.
- Partner attribute "accessory" is hidden when the partner type is not "Accessory".
Changes since v2:
- Notification on role and alternate mode changes
- cleanups
Changes since v1:
- Completely rewrote alternate mode support
- Patners, cables and cable plugs presented as devices.
Heikki Krogerus (2):
usb: USB Type-C connector class
usb: typec: add driver for Intel Whiskey Cove PMIC USB Type-C PHY
Documentation/ABI/testing/sysfs-class-typec | 219 ++++++ Documentation/usb/typec.txt | 103 +++ MAINTAINERS | 9 + drivers/usb/Kconfig | 2 + drivers/usb/Makefile | 2 + drivers/usb/typec/Kconfig | 21 + drivers/usb/typec/Makefile | 2 + drivers/usb/typec/typec.c | 1082 +++++++++++++++++++++++++++ drivers/usb/typec/typec_wcove.c | 368 +++++++++ include/linux/usb/typec.h | 249 ++++++ 10 files changed, 2057 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-typec create mode 100644 Documentation/usb/typec.txt create mode 100644 drivers/usb/typec/Kconfig create mode 100644 drivers/usb/typec/Makefile create mode 100644 drivers/usb/typec/typec.c create mode 100644 drivers/usb/typec/typec_wcove.c create mode 100644 include/linux/usb/typec.h
Signature · 1 line
2.9.3
Heikki Krogerus
maintainerPATCH v8 1/2 usb: USB Type-C connector class
The purpose of USB Type-C connector class is to provide unified interface for the user space to get the status and basic information about USB Type-C connectors on a system, control over data role swapping, and when the port supports USB Power Delivery, also control over power role swapping and Alternate Modes.
--- Documentation/ABI/testing/sysfs-class-typec | 219 ++++++ Documentation/usb/typec.txt | 103 +++ MAINTAINERS | 9 + drivers/usb/Kconfig | 2 + drivers/usb/Makefile | 2 + drivers/usb/typec/Kconfig | 7 + drivers/usb/typec/Makefile | 1 + drivers/usb/typec/typec.c | 1082 +++++++++++++++++++++++++++ include/linux/usb/typec.h | 249 ++++++ 9 files changed, 1674 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-typec create mode 100644 Documentation/usb/typec.txt create mode 100644 drivers/usb/typec/Kconfig create mode 100644 drivers/usb/typec/Makefile create mode 100644 drivers/usb/typec/typec.c create mode 100644 include/linux/usb/typec.h
Documentation/ABI/testing/sysfs-class-typec new file +219 -0
@@ -0,0 +1,219 @@ +USB Type-C port devices (eg. /sys/class/typec/usbc0/) + +What: /sys/class/typec/<port>/current_data_role +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + The current USB data role the port is operating in. This + attribute can be used for requesting data role swapping on the + port. Swapping is supported as synchronous operation, so + write(2) to the attribute will not return until the operation + has finished. The attribute is notified about role changes so + that poll(2) on the attribute wakes up. + + Valid values: + - host + - device + +What: /sys/class/typec/<port>/current_power_role +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + The current power role of the port. This attribute can be used + to request power role swap on the port when the port supports + USB Power Delivery. Swapping is supported as synchronous + operation, so write(2) to the attribute will not return until + the operation has finished. The attribute is notified about role + changes so that poll(2) on the attribute wakes up. + + Valid values: + - source + - sink + +What: /sys/class/typec/<port>/vconn_source +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Shows is the port VCONN Source. This attribute can be used to + request VCONN swap to change the VCONN Source during connection + when both the port and the partner support USB Power Delivery. + Swapping is supported as synchronous operation, so write(2) to + the attribute will not return until the operation has finished. + The attribute is notified about VCONN source changes so that + poll(2) on the attribute wakes up. + + Valid values are: + - 0 when the port is not the VCONN Source + - 1 when the port is the VCONN Source + +What: /sys/class/typec/<port>/power_operation_mode +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Shows the current power operational mode the port is in. + + Valid values: + - USB - Normal power levels defined in USB specifications + - BC1.2 - Power levels defined in Battery Charging Specification + v1.2 + - USB Type-C 1.5A - Higher 1.5A current defined in USB Type-C + specification. + - USB Type-C 3.0A - Higher 3A current defined in USB Type-C + specification. + - USB Power Delivery - The voltages and currents defined in USB + Power Delivery specification + +What: /sys/class/typec/<port>/preferred_role +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + The user space can notify the driver about the preferred role. + It should be handled as enabling of Try.SRC or Try.SNK, as + defined in USB Type-C specification, in the port drivers. By + default there is no preferred role. + + Valid values: + - host + - device + - For example "none" to remove preference (anything else except + "host" or "device") + +What: /sys/class/typec/<port>/supported_accessory_modes +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Lists the Accessory Modes, defined in the USB Type-C + specification, the port supports. + +What: /sys/class/typec/<port>/supported_data_roles +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Lists the USB data roles the port is capable of supporting. + + Valid values: + - device + - host + - device, host (DRD as defined in USB Type-C specification v1.2) + +What: /sys/class/typec/<port>/supported_power_roles +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Lists the power roles the port is capable of supporting. + + Valid values: + - source + - sink + - source, sink (DRP as defined in USB Type-C specification v1.2) + +What: /sys/class/typec/<port>/supports_usb_power_delivery +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Shows if the port supports USB Power Delivery. + - 1 if USB Power Delivery is supported + - 0 when it's not + + +USB Type-C partner devices (eg. /sys/class/typec/usbc0-partner/) + +What: /sys/class/typec/<port>-partner/accessory_mode +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Shows the Accessory Mode name, or "no" when the partner does not + support Accesory Modes. The Accessory Modes are defined in USB + Type-C Specification. + +What: /sys/class/typec/<port>-partner/supports_usb_power_delivery +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Shows if the partner supports USB Power Delivery: + - 0 when USB Power Delivery is not supported + - 1 when USB Power Delivery is supported + + +USB Type-C cable devices (eg. /sys/class/typec/usbc0-cable/) + +Note: Electronically Marked Cables will have a device also for one cable plug +(eg. /sys/class/typec/usbc0-plug0). If the cable is active and has also SOP +Double Prime controller (USB Power Deliver specification ch. 2.4) it will have +second device also for the other plug. Both plugs may have their alternate modes +as described in USB Type-C and USB Power Delivery specifications. + +What: /sys/class/typec/<port>-cable/active +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Shows if the cable is active or passive. + + Valid values: + - 0 when the cable is passive + - 1 when the cable is active + +What: /sys/class/typec/<port>-cable/plug_type +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Shows type of the plug on the cable: + - Type-A - Standard A + - Type-B - Standard B + - Type-C - USB Type-C + - Captive - Non-standard + +What: /sys/class/typec/<port>-cable/supports_usb_power_delivery +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Shows if the cable supports USB Power Delivery: + - 0 when USB Power Delivery is not supported + - 1 when USB Power Delivery is supported + + +Alternate Mode devices (For example, +/sys/class/typec/usbc0-partner/usbc0-partner.svid:xxxx/). The ports, partners +and cable plugs can have alternate modes. + +What: /sys/class/typec/<dev>/<dev>.svid:<svid>/<mode>/active +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Shows if the mode is active or not. The attribute can be used + for entering/exiting the mode with partners and cable plugs, and + with the port alternate modes it can be used for disabling + support for specific alternate modes. Entering/exiting modes is + supported as synchronous operation so write(2) to the attribute + does not return until the enter/exit mode operation has + finished. The attribute is notified when the mode is + entered/exited so poll(2) on the attribute wakes up. + + Valid values: + - 0 when the mode is deactive + - 1 when the mode is active + +What: /sys/class/typec/<dev>/<dev>.svid:<svid>/<mode>/description +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Shows description of the mode. The description is optional for + the drivers, just like with the Billboard Devices. + +What: /sys/class/typec/<dev>/<dev>.svid:<svid>/<mode>/vdo +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Shows the VDO in hexadecimal returned from the Discover Modes + command. + +What: /sys/class/typec/<port>/<port>.svid:<svid>/<mode>/supported_roles +Date: June 2016 +Contact: Heikki Krogerus <[email protected]> +Description: + Shows the roles, source or sink, the mode is supported with. + + This attribute is available for the devices describing the + alternate modes a port supports, and it will not be exposed with + the devices presenting the alternate modes the partners or cable + plugs support.
Documentation/usb/typec.txt new file +103 -0
103 lines not on this page · raw message
MAINTAINERS +9 -0
@@ -12370,6 +12370,15 @@ F: drivers/usb/ F: include/linux/usb.h F: include/linux/usb/ +USB TYPEC SUBSYSTEM +M: Heikki Krogerus <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/ABI/testing/sysfs-class-typec +F: Documentation/usb/typec.txt +F: drivers/usb/typec/ +F: include/linux/usb/typec.h + USB UHCI DRIVER M: Alan Stern <[email protected]> L: [email protected]
drivers/usb/Kconfig +2 -0
@@ -150,6 +150,8 @@ source "drivers/usb/phy/Kconfig" source "drivers/usb/gadget/Kconfig" +source "drivers/usb/typec/Kconfig" + config USB_LED_TRIG bool "USB LED Triggers" depends on LEDS_CLASS && USB_COMMON && LEDS_TRIGGERS
drivers/usb/Makefile +2 -0
@@ -61,3 +61,5 @@ obj-$(CONFIG_USB_GADGET) += gadget/ obj-$(CONFIG_USB_COMMON) += common/ obj-$(CONFIG_USBIP_CORE) += usbip/ + +obj-$(CONFIG_TYPEC) += typec/
drivers/usb/typec/Kconfig new file +7 -0
@@ -0,0 +1,7 @@ + +menu "USB PD and Type-C drivers" + +config TYPEC + tristate + +endmenu
drivers/usb/typec/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_TYPEC) += typec.o
drivers/usb/typec/typec.c new file +1082 -0
1,082 lines not on this page · raw message
include/linux/usb/typec.h new file +249 -0
249 lines not on this page · raw message
Signature · 1 line
2.9.3
Heikki Krogerus
maintainerPATCH v8 2/2 usb: typec: add driver for Intel Whiskey Cove PMIC USB Type-C PHY
In reply to Heikki KrogerusThis adds driver for the USB Type-C PHY on Intel WhiskeyCove PMIC which is available on some of the Intel Broxton SoC based platforms.
--- drivers/usb/typec/Kconfig | 14 ++ drivers/usb/typec/Makefile | 1 + drivers/usb/typec/typec_wcove.c | 368 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 383 insertions(+) create mode 100644 drivers/usb/typec/typec_wcove.c
drivers/usb/typec/Kconfig +14 -0
@@ -4,4 +4,18 @@ menu "USB PD and Type-C drivers" config TYPEC tristate +config TYPEC_WCOVE + tristate "Intel WhiskeyCove PMIC USB Type-C PHY driver" + depends on ACPI + depends on INTEL_SOC_PMIC + depends on INTEL_PMC_IPC + select TYPEC + help + This driver adds support for USB Type-C detection on Intel Broxton + platforms that have Intel Whiskey Cove PMIC. The driver can detect the + role and cable orientation. + + To compile this driver as module, choose M here: the module will be + called typec_wcove + endmenu
drivers/usb/typec/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_TYPEC) += typec.o +obj-$(CONFIG_TYPEC_WCOVE) += typec_wcove.o
drivers/usb/typec/typec_wcove.c new file +368 -0
368 lines not on this page · raw message
Signature · 1 line
2.9.3
Heikki,
Quoted 3 lines · Heikki Krogerus
The USB Type-C class is meant to provide unified interface to the userspace to present the USB Type-C ports in a system.
Thanks for the updated series. I'll be traveling for the next couple of days, so I'll only be able to look into it Tuesday or Wednesday next week.
Guenter
Quoted 62 lines
Changes since v7:
- Removed "type" attribute from partners
- Addedsupports_usb_power_deliveryattribute for partner and cableChanges since v6:
-current_vconn_roleattr renamed tovconn_source(no API changes)
- Small documentation improvements proposed by Vincent PalatinChanges since v5:
- Only updating the roles based on driver notifications
- AddedMODULE_ALIASfor the WhiskeyCove module
- Including the patch that creates the actual platform device for the WhiskeyCove Type-C PHY in this series.Changes since v4:
- Remove the port lock completelyChanges since v3:
- Documentation cleanup as proposed by Roger Quadros
- Setting partner altmodes member to NULL on removal and fixing a warning, as proposed by Guenter Roeck
- Added the following attributes for partners and cables:
*supports_usb_power_delivery
*id_header_vdo
- "id_header_vdo" is visible only when the partner or cable supports USB Power Delivery communication.
- Partner attribute "accessory" is hidden when the partner type is not "Accessory".Changes since v2:
- Notification on role and alternate mode changes
- cleanupsChanges since v1:
- Completely rewrote alternate mode support
- Patners, cables and cable plugs presented as devices.Heikki Krogerus (2):
usb: USB Type-C connector class
usb: typec: add driver for Intel Whiskey Cove PMIC USB Type-C PHYDocumentation/ABI/testing/sysfs-class-typec | 219 ++++++ Documentation/usb/typec.txt | 103 +++ MAINTAINERS | 9 + drivers/usb/Kconfig | 2 + drivers/usb/Makefile | 2 + drivers/usb/typec/Kconfig | 21 + drivers/usb/typec/Makefile | 2 + drivers/usb/typec/typec.c | 1082 +++++++++++++++++++++++++++ drivers/usb/typec/typec_wcove.c | 368 +++++++++ include/linux/usb/typec.h | 249 ++++++ 10 files changed, 2057 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-typec create mode 100644 Documentation/usb/typec.txt create mode 100644 drivers/usb/typec/Kconfig create mode 100644 drivers/usb/typec/Makefile create mode 100644 drivers/usb/typec/typec.c create mode 100644 drivers/usb/typec/typec_wcove.c create mode 100644 include/linux/usb/typec.h
Heikki Krogerus
maintainerQuoted 9 lines · Guenter Roeck
Heikki,
Quoted 3 lines · Heikki Krogerus
The USB Type-C class is meant to provide unified interface to the userspace to present the USB Type-C ports in a system.
Thanks for the updated series. I'll be traveling for the next couple of days, so I'll only be able to look into it Tuesday or Wednesday next week.
There are no other changes besides the diff that I send for the previous version.
Thanks,
Signature · 1 line
heikki