usb: typec: Separate USB PD from USB Type-C
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest3 patches 1 replyIn review
- v33 patches 6 repliesSuperseded
- v23 patches 2 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 3 patches | 7 replies | Superseded |
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | usb: typec: Separate USB Power Delivery from USB Type-CDocumentation/ drivers/ drivers/ +3 more | +1027 | 0 replies | |
| 2/3 | usb: typec: USB Power Delivery helpers for ports and partnersDocumentation/ drivers/ drivers/ +1 more | +174 | 0 replies | |
| 3/3 | usb: typec: tcpm: Register USB Power Delivery Capabilitiesdrivers/ | +141 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.
Cover letter [PATCH v4 0/3] usb: typec: Separate USB PD from USB Type-C
Hi,
The data structures are now named "usb_power_deliver*" and the kobject attributes are now device attributes.
v3 cover letter:
Now everything is a device. There are now other changes.
v2 cover letter:
In this version the USB Power Delivery support is now completely separated into its own little subsystem. The USB Power Delivery objects are not devices, but they are also no longer tied to any device by default. This change makes it possible to share the USB PD objects between multiple devices on top of being able to select the objects that we want the device to use.
The USB Power Delivery objects are now placed under /sys/kernel/usb_power_delivery directory. As an example:
/sys/kernel/usb_power_delivery/pd0
So now that pd0 can be linked to a device, or devices, that want (or can) use it to negotiate the USB PD contract with. An example where two devices share the PD:
/sys/class/typec/port0/usb_power_delivery -> ../../../../../../../kernel/usb_power_delivery/pd0
/sys/class/typec/port1/usb_power_delivery -> ../../../../../../../kernel/usb_power_delivery/pd0I did not change the directory hierarchy at all, because I'm assuming that it is not a problem anymore:
pd0/<message>/<object>/<field>
On top of that change, I also switched to tcpm.c from ucsi.c as the first user of this thing.
v1 cover letter:
Ideally after this there should be no need to add any new USB Power Delivery specific attribute files directly to the USB Type-C devices in sysfs. They now have their own directory.
The idea of the series is that any device (so not just USB Type-C connectors and the partners attached to them) that supports USB Power Delivery can have this separate sub-directory "usb_power_delivery" in sysfs, and that sub-directory will have all the USB Power Delivery objects and all the other USB Power Delivery details.
There are already ways that allow us to read the USB Power Delivery capabilities from potentially any USB PD capable USB device attached to the bus - one way is defined in the USB Type-C Bridge Specification.
Initially the Capability Messages (i.e. PDOs) are exposed.
This is an example (tree view) of the capabilities that the ports on a normal x86 system advertise to the partner. First you have the message directory (source_capabilities and sink_capabilities), and that will have a sub-directory for each PDO that capability message has. The PDO sub-directories are named by their type. The number in front of the name is the object position of the PDO:
/sys/class/typec/port0/usb_power_delivery
|-- revision
|-- sink_capabilities/
| |-- 1:fixed_supply/
| | |-- dual_role_data
| | |-- dual_role_power
| | |-- fast_role_swap_current
| | |-- operational_current
| | |-- unchunked_extended_messages_supported
| | |-- unconstrained_power
| | |-- usb_communication_capable
| | |-- usb_suspend_supported
| | `-- voltage
| |-- 2:variable_supply/
| | |-- maximum_voltage
| | |-- minimum_voltage
| | `-- operational_current
| `-- 3:battery/
| |-- maximum_voltage
| |-- minimum_voltage
| `-- operational_power
`-- source_capabilities/
`-- 1:fixed_supply/
|-- dual_role_data
|-- dual_role_power
|-- maximum_current
|-- unchunked_extended_messages_supported
|-- unconstrained_power
|-- usb_communication_capable
|-- usb_suspend_supported
`-- voltageAnd these are the capabilities of my Thunderbolt3 dock:
/sys/class/typec/port0-partner/usb_power_delivery
|-- revision
|-- sink_capabilities/
| `-- 1:fixed_supply/
| |-- dual_role_data
| |-- dual_role_power
| |-- fast_role_swap_current
| |-- operational_current
| |-- unchunked_extended_messages_supported
| |-- unconstrained_power
| |-- usb_communication_capable
| |-- usb_suspend_supported
| `-- voltage
`-- source_capabilities/
|-- 1:fixed_supply/
| |-- dual_role_data
| |-- dual_role_power
| |-- maximum_current
| |-- unchunked_extended_messages_supported
| |-- unconstrained_power
| |-- usb_communication_capable
| |-- usb_suspend_supported
| `-- voltage
|-- 2:fixed_supply/
| |-- maximum_current
| `-- voltage
|-- 3:fixed_supply/
| |-- maximum_current
| `-- voltage
|-- 4:fixed_supply/
| |-- maximum_current
| `-- voltage
`-- 5:fixed_supply/
|-- maximum_current
`-- voltageHeikki Krogerus (3):
usb: typec: Separate USB Power Delivery from USB Type-C
usb: typec: USB Power Delivery helpers for ports and partners
usb: typec: tcpm: Register USB Power Delivery Capabilities
Documentation/ABI/testing/sysfs-class-typec | 8 + .../testing/sysfs-class-usb_power_delivery | 240 ++++++ drivers/usb/typec/Makefile | 2 +- drivers/usb/typec/class.c | 149 ++++ drivers/usb/typec/class.h | 4 + drivers/usb/typec/pd.c | 708 ++++++++++++++++++ drivers/usb/typec/pd.h | 30 + drivers/usb/typec/tcpm/tcpm.c | 142 +++- include/linux/usb/pd.h | 38 + include/linux/usb/typec.h | 23 + 10 files changed, 1342 insertions(+), 2 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-class-usb_power_delivery create mode 100644 drivers/usb/typec/pd.c create mode 100644 drivers/usb/typec/pd.h
Signature · 1 line
2.35.1