diff options
author | Mathias Nyman <mathias.nyman@linux.intel.com> | 2018-04-19 19:05:54 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-22 17:19:26 +0300 |
commit | 460fd21618bf95a16b30500eb4b5452dab04e023 (patch) | |
tree | c38c299fbd9def4d8e27d7d871835d1f0186bd18 /drivers/usb/core | |
parent | 45455e4d7a6b767497f282bbd0146e838862291f (diff) | |
download | linux-460fd21618bf95a16b30500eb4b5452dab04e023.tar.xz |
USB: USB 3.2 Add sysfs entries for a usb device rx_lanes and tx_lanes
Add rx_lanes and tx_lanes lane count sysfs entries for a usb device
struct usb_devuce rx_lanes and tx_lanes variables.
Shows number of lanes used by the usb device
Data rate of a device is the lane speed * lane count, for example
USB 3.2 Gen 2x2 device uses 10Gbps signaling per lane, and has dual-lane
support 10Gbps * 2 = 20Gbps
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/sysfs.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 27bb34043053..ea18284dfa9a 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -175,6 +175,26 @@ static ssize_t speed_show(struct device *dev, struct device_attribute *attr, } static DEVICE_ATTR_RO(speed); +static ssize_t rx_lanes_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct usb_device *udev; + + udev = to_usb_device(dev); + return sprintf(buf, "%d\n", udev->rx_lanes); +} +static DEVICE_ATTR_RO(rx_lanes); + +static ssize_t tx_lanes_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct usb_device *udev; + + udev = to_usb_device(dev); + return sprintf(buf, "%d\n", udev->tx_lanes); +} +static DEVICE_ATTR_RO(tx_lanes); + static ssize_t busnum_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -790,6 +810,8 @@ static struct attribute *dev_attrs[] = { &dev_attr_bNumConfigurations.attr, &dev_attr_bMaxPacketSize0.attr, &dev_attr_speed.attr, + &dev_attr_rx_lanes.attr, + &dev_attr_tx_lanes.attr, &dev_attr_busnum.attr, &dev_attr_devnum.attr, &dev_attr_devpath.attr, |