From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Guenter Roeck <linux@roeck-us.net>,
Benson Leung <bleung@google.com>,
Prashant Malani <pmalani@chromium.org>,
Jameson Thies <jthies@google.com>,
"Regupathy, Rajaram" <rajaram.regupathy@intel.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v1 0/3] usb: typec: Separate sysfs directory for all USB PD objects
Date: Thu, 3 Feb 2022 17:46:54 +0300 [thread overview]
Message-ID: <20220203144657.16527-1-heikki.krogerus@linux.intel.com> (raw)
Hi,
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
`-- voltage
And 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
`-- voltage
thanks,
Heikki Krogerus (3):
usb: typec: Separate USB Power Delivery from USB Type-C
usb: typec: Functions for USB PD capabilities registration
usb: typec: ucsi: Register USB Power Delivery Capabilities
Documentation/ABI/testing/sysfs-class-typec | 22 +
.../testing/sysfs-devices-usb_power_delivery | 273 ++++++++
drivers/usb/typec/Makefile | 2 +-
drivers/usb/typec/class.c | 328 +++++++++
drivers/usb/typec/class.h | 8 +
drivers/usb/typec/pd.c | 651 ++++++++++++++++++
drivers/usb/typec/pd.h | 39 ++
drivers/usb/typec/ucsi/ucsi.c | 128 +++-
drivers/usb/typec/ucsi/ucsi.h | 8 +
include/linux/usb/pd.h | 30 +
include/linux/usb/typec.h | 25 +
11 files changed, 1502 insertions(+), 12 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-devices-usb_power_delivery
create mode 100644 drivers/usb/typec/pd.c
create mode 100644 drivers/usb/typec/pd.h
--
2.34.1
next reply other threads:[~2022-02-03 14:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-03 14:46 Heikki Krogerus [this message]
2022-02-03 14:46 ` [PATCH v1 1/3] usb: typec: Separate USB Power Delivery from USB Type-C Heikki Krogerus
2022-02-03 14:55 ` Greg Kroah-Hartman
2022-02-04 10:04 ` Heikki Krogerus
2022-02-04 13:59 ` Greg Kroah-Hartman
2022-02-04 15:07 ` Heikki Krogerus
2022-02-03 14:46 ` [PATCH v1 2/3] usb: typec: Functions for USB PD capabilities registration Heikki Krogerus
2022-02-03 14:46 ` [PATCH v1 3/3] usb: typec: ucsi: Register USB Power Delivery Capabilities Heikki Krogerus
2022-02-10 7:56 ` Jack Pham
2022-02-15 12:33 ` Heikki Krogerus
2022-02-17 6:55 ` Jack Pham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220203144657.16527-1-heikki.krogerus@linux.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=bleung@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jthies@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=pmalani@chromium.org \
--cc=rajaram.regupathy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).