summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorSaranya Gopal <saranya.gopal@intel.com>2023-02-14 17:15:43 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-02-15 19:03:47 +0100
commitc620f4d5b25bcbb851daa1f88edc764cf5f29cb6 (patch)
treea7dba1db8cee1bc4c77a1ee27827efd3dc5c07aa /drivers/usb
parente4e7b2dc27c4bb877d850eaff69d41410b2f4237 (diff)
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/typec/pd.c8
1 files changed, 8 insertions, 0 deletions
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
@@ -49,6 +49,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)
{
return sysfs_emit(buf, "%u\n", !!(to_pdo(dev)->pdo & PDO_FIXED_EXTPOWER));
@@ -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,