summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt
diff options
context:
space:
mode:
authorChristian Kellner <christian@kellner.me>2019-10-03 19:32:40 +0200
committerMika Westerberg <mika.westerberg@linux.intel.com>2019-10-09 13:03:25 +0300
commitb406357c572b29cdcf05f717c69ae0018fa6a146 (patch)
tree5abb9937af6e8cc2cbcac23840cc3a555e7aebfe /drivers/thunderbolt
parentda0c9ea146cbe92b832f1b0f694840ea8eb33cce (diff)
downloadlinux-b406357c572b29cdcf05f717c69ae0018fa6a146.tar.bz2
thunderbolt: Add 'generation' attribute for devices
The Thunderbolt standard went through several major iterations, here called generation. USB4, which will be based on Thunderbolt, will be generation 4. Let userspace know the generation of the controller in the devices in order to distinguish between Thunderbolt and USB4, so it can be shown in various user interfaces. Signed-off-by: Christian Kellner <christian@kellner.me> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt')
-rw-r--r--drivers/thunderbolt/switch.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 410bf1bceeee..ac9fa2740800 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -1120,6 +1120,15 @@ device_name_show(struct device *dev, struct device_attribute *attr, char *buf)
}
static DEVICE_ATTR_RO(device_name);
+static ssize_t
+generation_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct tb_switch *sw = tb_to_switch(dev);
+
+ return sprintf(buf, "%u\n", sw->generation);
+}
+static DEVICE_ATTR_RO(generation);
+
static ssize_t key_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
@@ -1325,6 +1334,7 @@ static struct attribute *switch_attrs[] = {
&dev_attr_boot.attr,
&dev_attr_device.attr,
&dev_attr_device_name.attr,
+ &dev_attr_generation.attr,
&dev_attr_key.attr,
&dev_attr_nvm_authenticate.attr,
&dev_attr_nvm_version.attr,