Skip to content

Commit c620f4d

Browse files
saranyagopal1gregkh
authored andcommitted
usb: typec: pd: Add higher capability sysfs for sink PDO
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> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20230214114543.205103-2-saranya.gopal@intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e4e7b2d commit c620f4d

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

Documentation/ABI/testing/sysfs-class-usb_power_delivery

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Description:
6969
This file contains boolean value that tells does the device
7070
support both source and sink power roles.
7171

72-
What: /sys/class/usb_power_delivery/.../<capability>/1:fixed_supply/usb_suspend_supported
72+
What: /sys/class/usb_power_delivery/.../source-capabilities/1:fixed_supply/usb_suspend_supported
7373
Date: May 2022
7474
Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
7575
Description:
@@ -78,6 +78,15 @@ Description:
7878
will follow the USB 2.0 and USB 3.2 rules for suspend and
7979
resume.
8080

81+
What: /sys/class/usb_power_delivery/.../sink-capabilities/1:fixed_supply/higher_capability
82+
Date: February 2023
83+
Contact: Saranya Gopal <saranya.gopal@linux.intel.com>
84+
Description:
85+
This file shows the value of the Higher capability bit in
86+
vsafe5V Fixed Supply Object. If the bit is set, then the sink
87+
needs more than vsafe5V(eg. 12 V) to provide full functionality.
88+
Valid values: 0, 1
89+
8190
What: /sys/class/usb_power_delivery/.../<capability>/1:fixed_supply/unconstrained_power
8291
Date: May 2022
8392
Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>

drivers/usb/typec/pd.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ usb_suspend_supported_show(struct device *dev, struct device_attribute *attr, ch
4848
}
4949
static DEVICE_ATTR_RO(usb_suspend_supported);
5050

51+
static ssize_t
52+
higher_capability_show(struct device *dev, struct device_attribute *attr, char *buf)
53+
{
54+
return sysfs_emit(buf, "%u\n", !!(to_pdo(dev)->pdo & PDO_FIXED_HIGHER_CAP));
55+
}
56+
static DEVICE_ATTR_RO(higher_capability);
57+
5158
static ssize_t
5259
unconstrained_power_show(struct device *dev, struct device_attribute *attr, char *buf)
5360
{
@@ -161,6 +168,7 @@ static struct device_type source_fixed_supply_type = {
161168

162169
static struct attribute *sink_fixed_supply_attrs[] = {
163170
&dev_attr_dual_role_power.attr,
171+
&dev_attr_higher_capability.attr,
164172
&dev_attr_unconstrained_power.attr,
165173
&dev_attr_usb_communication_capable.attr,
166174
&dev_attr_dual_role_data.attr,

0 commit comments

Comments
 (0)