[RFC PATCH 13/15] usbcore: show port power policy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Let userspace determine the effective power policy of the port.  Reading
the power policy returns the effective idle state for the port.  If the
power policy is set to off this file effectively becomes the
power/runtime_status of an attached child device, otherwise it reflects
the state of pm_qos_no_power_off + connect_type + peer port constraints.

Signed-off-by: Dan Williams <dan.j.williams@xxxxxxxxx>
---
 drivers/usb/core/port.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 71fbedaf8a93..6073b4521d03 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -79,8 +79,21 @@ static ssize_t connect_type_store(struct device *dev, struct device_attribute *a
 
 static DEVICE_ATTR_RW(connect_type);
 
+static ssize_t power_policy_show(struct device *dev,
+				 struct device_attribute *attr, char *buf)
+{
+	struct usb_port *port_dev = to_usb_port(dev);
+
+	if (usb_port_power_enabled(port_dev))
+		return sprintf(buf, "on\n");
+	else
+		return sprintf(buf, "off\n");
+}
+static DEVICE_ATTR_RO(power_policy);
+
 static struct attribute *port_dev_attrs[] = {
 	&dev_attr_connect_type.attr,
+	&dev_attr_power_policy.attr,
 	NULL,
 };
 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux