linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thunderbolt: Add 'generation' attribute for devices
@ 2019-10-03 17:32 Christian Kellner
  2019-10-09 10:10 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Kellner @ 2019-10-03 17:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mario Limonciello, Christian Kellner, Andreas Noever,
	Michael Jamet, Mika Westerberg, Yehezkel Bernat

From: Christian Kellner <christian@kellner.me>

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>
---
 Documentation/ABI/testing/sysfs-bus-thunderbolt |  8 ++++++++
 drivers/thunderbolt/switch.c                    | 10 ++++++++++
 2 files changed, 18 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-thunderbolt b/Documentation/ABI/testing/sysfs-bus-thunderbolt
index b21fba14689b..630e51344f1c 100644
--- a/Documentation/ABI/testing/sysfs-bus-thunderbolt
+++ b/Documentation/ABI/testing/sysfs-bus-thunderbolt
@@ -80,6 +80,14 @@ Contact:	thunderbolt-software@lists.01.org
 Description:	This attribute contains 1 if Thunderbolt device was already
 		authorized on boot and 0 otherwise.
 
+What: /sys/bus/thunderbolt/devices/.../generation
+Date:		Aug 2019
+KernelVersion:	5.5
+Contact:	Christian Kellner <christian@kellner.me>
+Description:	This attribute contains the generation of the Thunderbolt
+		controller associated with the device. It will contain 4
+		for USB4.
+
 What: /sys/bus/thunderbolt/devices/.../key
 Date:		Sep 2017
 KernelVersion:	4.13
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,
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] thunderbolt: Add 'generation' attribute for devices
  2019-10-03 17:32 [PATCH] thunderbolt: Add 'generation' attribute for devices Christian Kellner
@ 2019-10-09 10:10 ` Mika Westerberg
  0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2019-10-09 10:10 UTC (permalink / raw)
  To: Christian Kellner
  Cc: linux-kernel, Mario Limonciello, Christian Kellner,
	Andreas Noever, Michael Jamet, Yehezkel Bernat

On Thu, Oct 03, 2019 at 07:32:40PM +0200, Christian Kellner wrote:
> From: Christian Kellner <christian@kellner.me>
> 
> 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>
> ---
>  Documentation/ABI/testing/sysfs-bus-thunderbolt |  8 ++++++++
>  drivers/thunderbolt/switch.c                    | 10 ++++++++++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-bus-thunderbolt b/Documentation/ABI/testing/sysfs-bus-thunderbolt
> index b21fba14689b..630e51344f1c 100644
> --- a/Documentation/ABI/testing/sysfs-bus-thunderbolt
> +++ b/Documentation/ABI/testing/sysfs-bus-thunderbolt
> @@ -80,6 +80,14 @@ Contact:	thunderbolt-software@lists.01.org
>  Description:	This attribute contains 1 if Thunderbolt device was already
>  		authorized on boot and 0 otherwise.
>  
> +What: /sys/bus/thunderbolt/devices/.../generation
> +Date:		Aug 2019

I updated this to be Jan 2020, which is estimated release date of v5.5
according to http://phb-crystal-ball.org/, and queued it for v5.5.

Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-09 10:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-03 17:32 [PATCH] thunderbolt: Add 'generation' attribute for devices Christian Kellner
2019-10-09 10:10 ` Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).