Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp125055ybp; Thu, 3 Oct 2019 11:07:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoGjDb4zy0s6im2CSsdTRp/6f9X3Vg/XQR9D2QuLmdZxeI+YM3LQ8xx/nVjqzy4edvcN8j X-Received: by 2002:a17:906:4bc3:: with SMTP id x3mr8764809ejv.200.1570126039279; Thu, 03 Oct 2019 11:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570126039; cv=none; d=google.com; s=arc-20160816; b=h7dCxno3lBPRcy2iVrP1YbY+hHXp2wQ4DPzD+BUUhy9P4cGcwMvva15AZssCC3Tkrz cegSWhUE95peTSKMMVmC6j2e6JiqhZ/1gXhBysPTn7+L140cjgMTbtTM1ZkwRoCz1zZF 76+T+BhoH1KAVTXkZY7Xr2TUd5gIcokjCs6iaz4POLmgTcqbqynGpv/qC8pYdiAdh5b5 qzmA4gLoZhQRa1LPePRYR4sC822hvR1sntqxK/YDI9fZPa6ZSNt8lgXkvm8h6gyWpr5s pt7kQ5BkC812MER7TWMIsVaDRK2H5IImnS4OMguQcFQ3bvr7S7B+D113a93LNnN5bxIs KKig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=tyc8Mk8DJcaipG9TZO3g0pE+sD22mtd1Wvj7+XFS8Vs=; b=je75MxmVX5iFKWsIROV7KX/Br3om5SFjlGH5aurGOjCZcB4VdiYk0SEMFjtRMtwlvJ SvfrIMKFNQOopi6vIUByWqOG4RygTYtZnvqHWPIiDirtv11UDxLf9P1UaNkrjToDoQoj fOUTqZqi5j6egCCEPtBN2l+0Ag9dqS0abMSxXTZTPr2I8+j/l2BVv2HJNUNRDRPJmx22 r1iE/pCeU7GOY4oTGKwBi9l5ah0ZSV0DgkU0P1gqKsqqP4XLbz7r9xsuTLk08WOfap3/ 07x51ADCtjDRcg/qpGQfI0Aas6qnu5MkHkrnDaRLEo25bxY3S65ZA4Jg79xkYlIX/NZw e5CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FlUxtkoz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o22si1560255ejb.285.2019.10.03.11.06.53; Thu, 03 Oct 2019 11:07:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FlUxtkoz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731333AbfJCRc7 (ORCPT + 99 others); Thu, 3 Oct 2019 13:32:59 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:56582 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730823AbfJCRcy (ORCPT ); Thu, 3 Oct 2019 13:32:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1570123973; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tyc8Mk8DJcaipG9TZO3g0pE+sD22mtd1Wvj7+XFS8Vs=; b=FlUxtkozk3qE3W5q3py1FalZj1ZbbYvZguu6n0GvwV/RnYXRP5/GospIXMgZwslApnzkeR Ar2ZoLPwOA+YSOYK7t/88TSR4f9emWGmqLlzOFThhSE3InYcvFjHY3TuZdJGyVvA1QtHfo eSW2ejI2qgt/EgDWzSBERNyvrvm4AB4= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-1-68CYGk9-OmG4rKzj9u8jpg-1; Thu, 03 Oct 2019 13:32:50 -0400 Received: by mail-wm1-f71.google.com with SMTP id o8so1416288wmc.2 for ; Thu, 03 Oct 2019 10:32:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2ef7N0ePuxn3Ta7g1ODhoz4GZ5kwOIoAGHMitlSYrcw=; b=BhBQ7L4HtoBaDbGyd/3Mdk+2qKzSVrFSP1EMSb8qF6GsK7498Z4iAVR6J0GB1EG3c3 b3V85lt2fgNNupIWZpTnJpRTVb2Ck3jXl+fZxzJWS4qL35qz6mxcUvNX8431wjrB54OF g7vop/yVCtY4nbpTndWcPac7hySbnCfqbY76XzqMUmgo9KB4yGGm0cG7n8gwgURfTc3J Yt93jEkRQmvbJL2LsuAU2ljUkBibkHO3jAy9RftzNkZBIRIYmONppc69cVxKA9hgYreu qqv/HWzE4bZWSTo1hTVO1yv1YwHeluZJcfEo1U6TDuM2w9BGXj2eRqG1jzGRo8sxO6yW QxVQ== X-Gm-Message-State: APjAAAW633+w54eQqS7W3dPEKK9/YgByOS8JdVsNg/sA+JycpxCMVTCK QDDYP3Ik8184vxo/ncT0tm2Z9hTzTDHf0r03qDEupakIAA13UXOQW6qyFY7Z7VTpvLcRDLYGqmX 8LtWE6vafLj2sHsgBjreX6X5k X-Received: by 2002:a7b:c156:: with SMTP id z22mr8133040wmi.142.1570123969574; Thu, 03 Oct 2019 10:32:49 -0700 (PDT) X-Received: by 2002:a7b:c156:: with SMTP id z22mr8133017wmi.142.1570123969238; Thu, 03 Oct 2019 10:32:49 -0700 (PDT) Received: from localhost (pD95EF0F7.dip0.t-ipconnect.de. [217.94.240.247]) by smtp.gmail.com with ESMTPSA id 90sm4908448wrr.1.2019.10.03.10.32.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2019 10:32:48 -0700 (PDT) From: Christian Kellner To: linux-kernel@vger.kernel.org Cc: Mario Limonciello , Christian Kellner , Andreas Noever , Michael Jamet , Mika Westerberg , Yehezkel Bernat Subject: [PATCH] thunderbolt: Add 'generation' attribute for devices Date: Thu, 3 Oct 2019 19:32:40 +0200 Message-Id: <20191003173242.80938-1-ckellner@redhat.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-MC-Unique: 68CYGk9-OmG4rKzj9u8jpg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian Kellner 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 --- 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/Documentatio= n/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:=09thunderbolt-software@lists.01.org Description:=09This attribute contains 1 if Thunderbolt device was already =09=09authorized on boot and 0 otherwise. =20 +What: /sys/bus/thunderbolt/devices/.../generation +Date:=09=09Aug 2019 +KernelVersion:=095.5 +Contact:=09Christian Kellner +Description:=09This attribute contains the generation of the Thunderbolt +=09=09controller associated with the device. It will contain 4 +=09=09for USB4. + What: /sys/bus/thunderbolt/devices/.../key Date:=09=09Sep 2017 KernelVersion:=094.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_a= ttribute *attr, char *buf) } static DEVICE_ATTR_RO(device_name); =20 +static ssize_t +generation_show(struct device *dev, struct device_attribute *attr, char *b= uf) +{ +=09struct tb_switch *sw =3D tb_to_switch(dev); + +=09return sprintf(buf, "%u\n", sw->generation); +} +static DEVICE_ATTR_RO(generation); + static ssize_t key_show(struct device *dev, struct device_attribute *attr, =09=09=09char *buf) { @@ -1325,6 +1334,7 @@ static struct attribute *switch_attrs[] =3D { =09&dev_attr_boot.attr, =09&dev_attr_device.attr, =09&dev_attr_device_name.attr, +=09&dev_attr_generation.attr, =09&dev_attr_key.attr, =09&dev_attr_nvm_authenticate.attr, =09&dev_attr_nvm_version.attr, --=20 2.23.0