Skip to contentSkip to conversation

usb: typec: ucsi: register DP only for NVIDIA DP VDO

PATCH In review Ajay Gupta 2 participants 3 messages Jan 23, 2020 – Feb 10, 2020

Subsystems (2)
lore
Share & tools
lore

Ajay Gupta

author
#0 lore raw

PATCH v2 1/2 usb: typec: ucsi: register DP only for NVIDIA DP VDO

From: Ajay Gupta <[email protected]>

NVIDIA VirtualLink (svid 0x955) has two altmode, vdo=0x1 for VirtualLink DP mode and vdo=0x3 for NVIDIA test mode. Register display altmode driver only for vdo=0x1

---
Changes from v1->v2:
Moved defines from typec_dp.h to ucsi.h based on comments from Heikki.

 drivers/usb/typec/ucsi/ucsi.c | 12 ++++++++++--
 drivers/usb/typec/ucsi/ucsi.h |  7 +++++++
 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/usb/typec/ucsi/ucsi.c +10 -2
index d5a6aac86327..eca9d598a42f 100644
@@ -270,9 +270,16 @@ 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;
+		case USB_TYPEC_NVIDIA_VLINK_SID:
+			if (desc->vdo == USB_TYPEC_NVIDIA_VLINK_DBG_VDO)
+				alt = typec_port_register_altmode(con->port,
+								  desc);
+			else
+				alt = ucsi_register_displayport(con, override,
+								i, desc);
+			break;
 		default:
 			alt = typec_port_register_altmode(con->port, desc);
 			break;
@@ -475,7 +482,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_NVIDIA_VLINK_SID)) {
+			(adev[i]->svid == USB_TYPEC_NVIDIA_VLINK_SID &&
+			adev[i]->vdo != USB_TYPEC_NVIDIA_VLINK_DBG_VDO))) {
 			pdev = typec_altmode_get_partner(adev[i]);
 			ucsi_displayport_remove_partner((void *)pdev);
 		}
drivers/usb/typec/ucsi/ucsi.h +7 -0
index e434b9c9a9eb..a89112b69cd5 100644
@@ -340,4 +340,11 @@ static inline void
 ucsi_displayport_remove_partner(struct typec_altmode *adev) { }
 #endif /* CONFIG_TYPEC_DP_ALTMODE */
 
+/*
+ * NVIDIA VirtualLink (svid 0x955) has two altmode. VirtualLink
+ * DP mode with vdo=0x1 and NVIDIA test mode with vdo=0x3
+ */
+#define USB_TYPEC_NVIDIA_VLINK_DP_VDO	0x1
+#define USB_TYPEC_NVIDIA_VLINK_DBG_VDO	0x3
+
 #endif /* __DRIVER_USB_TYPEC_UCSI_H */
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v2 2/2 usb: ucsi: ccg: disable runtime pm during fw flashing

From: Ajay Gupta <[email protected]>

Ucsi ppm is unregistered during fw flashing so disable runtime pm also and reenable after fw flashing is completed and ppm is re-registered.

---
Change from v1->v2: None

 drivers/usb/typec/ucsi/ucsi_ccg.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/typec/ucsi/ucsi_ccg.c +2 -0
index a5b8530490db..2658cda5da11 100644
@@ -1219,6 +1219,7 @@ static int ccg_restart(struct ucsi_ccg *uc)
 		return status;
 	}
 
+	pm_runtime_enable(uc->dev);
 	return 0;
 }
 
@@ -1234,6 +1235,7 @@ static void ccg_update_firmware(struct work_struct *work)
 
 	if (flash_mode != FLASH_NOT_NEEDED) {
 		ucsi_unregister(uc->ucsi);
+		pm_runtime_disable(uc->dev);
 		free_irq(uc->irq, uc);
 
 		ccg_fw_update(uc, flash_mode);
Signature · 1 line
2.17.1