From: Saranya Gopal <saranya.gopal@intel.com>
To: linux-usb@vger.kernel.org
Cc: heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org,
rajaram.regupathy@intel.com,
Saranya Gopal <saranya.gopal@intel.com>
Subject: [PATCH v3 2/2] usb: typec: pd: Add higher capability sysfs for sink PDO
Date: Tue, 14 Feb 2023 17:15:43 +0530 [thread overview]
Message-ID: <20230214114543.205103-2-saranya.gopal@intel.com> (raw)
In-Reply-To: <20230214114543.205103-1-saranya.gopal@intel.com>
28th bit of fixed supply sink PDO represents higher capability.
When this bit is set, the sink device needs more than vsafe5V
(eg: 12 V) to provide full functionality. This patch adds
this higher capability sysfs interface for sink PDO.
28th bit of fixed supply source PDO represents usb_suspend_supported
attribute. This usb_suspend_supported sysfs is already exposed for
source PDOs. This patch adds 'source-capabilities' in
usb_suspend_supported sysfs documentation for additional clarity.
Signed-off-by: Saranya Gopal <saranya.gopal@intel.com>
---
Changes from v2:
- Patch was split into 2 and this one adds new sysfs for sink PDO
Changes from v1:
- Wrapped the description within 80 characters
- Added valid values for the new sysfs
.../ABI/testing/sysfs-class-usb_power_delivery | 11 ++++++++++-
drivers/usb/typec/pd.c | 8 ++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/Documentation/ABI/testing/sysfs-class-usb_power_delivery b/Documentation/ABI/testing/sysfs-class-usb_power_delivery
index ce2b1b563cb3..1bf9d1d7902c 100644
--- a/Documentation/ABI/testing/sysfs-class-usb_power_delivery
+++ b/Documentation/ABI/testing/sysfs-class-usb_power_delivery
@@ -69,7 +69,7 @@ Description:
This file contains boolean value that tells does the device
support both source and sink power roles.
-What: /sys/class/usb_power_delivery/.../<capability>/1:fixed_supply/usb_suspend_supported
+What: /sys/class/usb_power_delivery/.../source-capabilities/1:fixed_supply/usb_suspend_supported
Date: May 2022
Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Description:
@@ -78,6 +78,15 @@ Description:
will follow the USB 2.0 and USB 3.2 rules for suspend and
resume.
+What: /sys/class/usb_power_delivery/.../sink-capabilities/1:fixed_supply/higher_capability
+Date: February 2023
+Contact: Saranya Gopal <saranya.gopal@linux.intel.com>
+Description:
+ This file shows the value of the Higher capability bit in
+ vsafe5V Fixed Supply Object. If the bit is set, then the sink
+ needs more than vsafe5V(eg. 12 V) to provide full functionality.
+ Valid values: 0, 1
+
What: /sys/class/usb_power_delivery/.../<capability>/1:fixed_supply/unconstrained_power
Date: May 2022
Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c
index b5ab26422c34..59c537a5e600 100644
--- a/drivers/usb/typec/pd.c
+++ b/drivers/usb/typec/pd.c
@@ -48,6 +48,13 @@ usb_suspend_supported_show(struct device *dev, struct device_attribute *attr, ch
}
static DEVICE_ATTR_RO(usb_suspend_supported);
+static ssize_t
+higher_capability_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ return sysfs_emit(buf, "%u\n", !!(to_pdo(dev)->pdo & PDO_FIXED_HIGHER_CAP));
+}
+static DEVICE_ATTR_RO(higher_capability);
+
static ssize_t
unconstrained_power_show(struct device *dev, struct device_attribute *attr, char *buf)
{
@@ -161,6 +168,7 @@ static struct device_type source_fixed_supply_type = {
static struct attribute *sink_fixed_supply_attrs[] = {
&dev_attr_dual_role_power.attr,
+ &dev_attr_higher_capability.attr,
&dev_attr_unconstrained_power.attr,
&dev_attr_usb_communication_capable.attr,
&dev_attr_dual_role_data.attr,
--
2.25.1
next prev parent reply other threads:[~2023-02-14 11:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-14 11:45 [PATCH v3 1/2] usb: typec: pd: Remove usb_suspend_supported sysfs from sink PDO Saranya Gopal
2023-02-14 11:45 ` Saranya Gopal [this message]
2023-02-14 15:19 ` [PATCH v3 2/2] usb: typec: pd: Add higher capability sysfs for " Heikki Krogerus
2023-02-14 13:30 ` [PATCH v3 1/2] usb: typec: pd: Remove usb_suspend_supported sysfs from " Heikki Krogerus
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=20230214114543.205103-2-saranya.gopal@intel.com \
--to=saranya.gopal@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-usb@vger.kernel.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