Skip to contentSkip to conversation

usb: typec: Add driver for NVIDIA Alt Modes

PATCH Superseded Heikki Krogerus 2 participants 2 messages Apr 15, 2019

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Heikki Krogerus

author maintainer
#0 lore raw

PATCH v2 7/7 usb: typec: Add driver for NVIDIA Alt Modes

From: Ajay Gupta <[email protected]>

Latest NVIDIA GPUs support VirtualLink device. Since USBIF has not assigned a Standard ID (SID) for VirtualLink so using NVIDA VID 0x955 as SVID.

---
 drivers/usb/typec/altmodes/Kconfig  | 10 +++++++
 drivers/usb/typec/altmodes/Makefile |  2 ++
 drivers/usb/typec/altmodes/nvidia.c | 44 +++++++++++++++++++++++++++++
 drivers/usb/typec/ucsi/ucsi.c       |  4 ++-
 include/linux/usb/typec_dp.h        |  5 ++++
 5 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 drivers/usb/typec/altmodes/nvidia.c
drivers/usb/typec/altmodes/Kconfig +10 -0
index ef2226eb7a33..187690fd1a5b 100644
@@ -12,4 +12,14 @@ config TYPEC_DP_ALTMODE
 	  To compile this driver as a module, choose M here: the
 	  module will be called typec_displayport.
 
+config TYPEC_NVIDIA_ALTMODE
+	tristate "NVIDIA Alternate Mode driver"
+	depends on TYPEC_DP_ALTMODE
+	help
+	  Latest NVIDIA GPUs support VirtualLink devices. Select this
+	  to enable support for VirtualLink devices with NVIDIA GPUs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called typec_displayport.
+
 endmenu
drivers/usb/typec/altmodes/Makefile +2 -0
index eda8456f1c92..45717548b396 100644
@@ -2,3 +2,5 @@
 
 obj-$(CONFIG_TYPEC_DP_ALTMODE)		+= typec_displayport.o
 typec_displayport-y			:= displayport.o
+obj-$(CONFIG_TYPEC_NVIDIA_ALTMODE)	+= typec_nvidia.o
+typec_nvidia-y				:= nvidia.o
drivers/usb/typec/altmodes/nvidia.c new file +44 -0

44 lines not on this page · raw message

drivers/usb/typec/ucsi/ucsi.c +3 -1
index 22fb956687de..999ae50d6e49 100644
@@ -310,6 +310,7 @@ static int ucsi_register_altmode(struct ucsi_connector *con,
 
 		switch (desc->svid) {
 		case USB_TYPEC_DP_SID:
+		case USB_TYPEC_NVIDIA_VLINK_SID:
 			alt = ucsi_register_displayport(con, override, i, desc);
 			break;
 		default:
@@ -428,7 +429,8 @@ static void ucsi_unregister_altmodes(struct ucsi_connector *con, u8 recipient)
 
 	while (adev[i]) {
 		if (recipient == UCSI_RECIPIENT_SOP &&
-		    adev[i]->svid == USB_TYPEC_DP_SID) {
+		    (adev[i]->svid == USB_TYPEC_DP_SID ||
+			adev[i]->svid == USB_TYPEC_NVIDIA_VLINK_SID)) {
 			pdev = typec_altmode_get_partner(adev[i]);
 			ucsi_displayport_remove_partner((void *)pdev);
 		}
include/linux/usb/typec_dp.h +5 -0
index 7fa12ef8d09a..fc4c7edb2e8a 100644
@@ -5,6 +5,11 @@
 #include <linux/usb/typec_altmode.h>
 
 #define USB_TYPEC_DP_SID	0xff01
+/* USB IF has not assigned a Standard ID (SID) for VirtualLink,
+ * so the manufacturers of VirtualLink adapters use their Vendor
+ * IDs as the SVID.
+ */
+#define USB_TYPEC_NVIDIA_VLINK_SID	0x955	/* NVIDIA VirtualLink */
 #define USB_TYPEC_DP_MODE	1
 
 /*
#1 lore raw
I love your patch! Yet something to improve:

Hi Heikki,

I love your patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v5.1-rc5 next-20190415]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Heikki-Krogerus/usb-typec-Remaining-changes-for-v5-2/20190416-034644
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: x86_64-randconfig-u0-04160432 (attached as .config)
compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> drivers/usb/typec/altmodes/nvidia.c:10:25: fatal error: displayport.h: No such file or directory

compilation terminated.

vim +10 drivers/usb/typec/altmodes/nvidia.c

  > 10	#include "displayport.h"
    11	

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation