Skip to contentSkip to conversation

Displayport Alternate Mode 2.1 Support

PATCH Applied Utkarsh Patel 4 participants 14 messages Sep 20, 2023 – Nov 13, 2023

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v4 cover Displayport Alternate Mode 2.1 Support

This series enabels cable identification flow required for Displayport Alternate Mode 2.1 support.

Please add this series to usb-next.

Changes in v4:
- Added [PATCH 3/5] back in this series with Reviewed-by tag from Heikki.

Changes in v3:
- Removed [PATCH 3/5] usb: pd: Add helper macro to get Type C cable speed instead added the helper function in [PATCH 3/4].
- In [PATCH 3/4] Removed use of variable cable_speed.

Changes in v2:
- Added two new patches [PATCH 2/5] and [PATCH 3/5] in to this series.
- Removed [PATCH 2/4] platform/chrome: cros_ec: Add Displayport Alternatemode 2.1 feature flag
- In [PATCH 4/5] Removed feature flag and separate function for DP2.1.
- In [PATCH 4/5] used cable vdos instead of host commands to get cable details.

Utkarsh Patel (5):
usb: typec: Add Displayport Alternate Mode 2.1 Support
usb: typec: Add Active or Passive cable defination to cable discover
mode VDO
usb: pd: Add helper macro to get Type C cable speed platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1
Support
usb: typec: intel_pmc_mux: Configure Displayport Alternate mode 2.1

 drivers/platform/chrome/cros_ec_typec.c  | 28 ++++++++++++++++++++++++
 drivers/usb/typec/altmodes/displayport.c |  5 ++++-
 drivers/usb/typec/mux/intel_pmc_mux.c    | 24 ++++++++++++++++++++
 drivers/usb/typec/ucsi/displayport.c     |  2 +-
 drivers/usb/typec/ucsi/ucsi_ccg.c        |  4 ++--
 include/linux/usb/pd_vdo.h               |  1 +
 include/linux/usb/typec_dp.h             | 28 ++++++++++++++++++++----
 include/linux/usb/typec_tbt.h            |  1 +
 8 files changed, 85 insertions(+), 8 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/5 usb: typec: Add Displayport Alternate Mode 2.1 Support

Displayport Alternate mode 2.1 requires configuration for additional cable details such as signalling for cable, UHBR13.5 Support, Cable type and DPAM version.
These details can be used with mux drivers to configure SOP DP configuration for Displayport Alternate mode 2.1.
This change also includes pertinent cable signalling support in displayport alternate mode.

---
Changes in v4:
- No change

Changes in v3:
- No change.

Changes in v2:
- No change.

 drivers/usb/typec/altmodes/displayport.c |  5 ++++-
 drivers/usb/typec/ucsi/displayport.c     |  2 +-
 drivers/usb/typec/ucsi/ucsi_ccg.c        |  4 ++--
 include/linux/usb/typec_dp.h             | 28 ++++++++++++++++++++----
 4 files changed, 31 insertions(+), 8 deletions(-)
drivers/usb/typec/altmodes/displayport.c +4 -1
index 426c88a516e5..f503cb4cd721 100644
@@ -86,8 +86,11 @@ static int dp_altmode_notify(struct dp_altmode *dp)
 
 static int dp_altmode_configure(struct dp_altmode *dp, u8 con)
 {
-	u32 conf = DP_CONF_SIGNALING_DP; /* Only DP signaling supported */
 	u8 pin_assign = 0;
+	u32 conf;
+
+	/* DP Signalling */
+	conf = (dp->data.conf & DP_CONF_SIGNALLING_MASK) >> DP_CONF_SIGNALLING_SHIFT;
 
 	switch (con) {
 	case DP_STATUS_CON_DISABLED:
drivers/usb/typec/ucsi/displayport.c +1 -1
index 73cd5bf35047..d9d3c91125ca 100644
@@ -315,7 +315,7 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
 	struct ucsi_dp *dp;
 
 	/* We can't rely on the firmware with the capabilities. */
-	desc->vdo |= DP_CAP_DP_SIGNALING | DP_CAP_RECEPTACLE;
+	desc->vdo |= DP_CAP_DP_SIGNALLING(0) | DP_CAP_RECEPTACLE;
 
 	/* Claiming that we support all pin assignments */
 	desc->vdo |= all_assignments << 8;
drivers/usb/typec/ucsi/ucsi_ccg.c +2 -2
index 607061a37eca..449c125f6f87 100644
@@ -501,8 +501,8 @@ static void ucsi_ccg_nvidia_altmode(struct ucsi_ccg *uc,
 	case NVIDIA_FTB_DP_OFFSET:
 		if (alt[0].mid == USB_TYPEC_NVIDIA_VLINK_DBG_VDO)
 			alt[0].mid = USB_TYPEC_NVIDIA_VLINK_DP_VDO |
-				DP_CAP_DP_SIGNALING | DP_CAP_USB |
-				DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_E));
+				     DP_CAP_DP_SIGNALLING(0) | DP_CAP_USB |
+				     DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_E));
 		break;
 	case NVIDIA_FTB_DBG_OFFSET:
 		if (alt[0].mid == USB_TYPEC_NVIDIA_VLINK_DP_VDO)
include/linux/usb/typec_dp.h +24 -4
index 8d09c2f0a9b8..1f358098522d 100644
@@ -67,8 +67,10 @@ enum {
 #define   DP_CAP_UFP_D			1
 #define   DP_CAP_DFP_D			2
 #define   DP_CAP_DFP_D_AND_UFP_D	3
-#define DP_CAP_DP_SIGNALING		BIT(2) /* Always set */
-#define DP_CAP_GEN2			BIT(3) /* Reserved after v1.0b */
+#define DP_CAP_DP_SIGNALLING(_cap_)	(((_cap_) & GENMASK(5, 2)) >> 2)
+#define   DP_CAP_SIGNALLING_HBR3	1
+#define   DP_CAP_SIGNALLING_UHBR10	2
+#define   DP_CAP_SIGNALLING_UHBR20	3
 #define DP_CAP_RECEPTACLE		BIT(6)
 #define DP_CAP_USB			BIT(7)
 #define DP_CAP_DFP_D_PIN_ASSIGN(_cap_)	(((_cap_) & GENMASK(15, 8)) >> 8)
@@ -78,6 +80,13 @@ enum {
 			DP_CAP_UFP_D_PIN_ASSIGN(_cap_) : DP_CAP_DFP_D_PIN_ASSIGN(_cap_))
 #define DP_CAP_PIN_ASSIGN_DFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \
 			DP_CAP_DFP_D_PIN_ASSIGN(_cap_) : DP_CAP_UFP_D_PIN_ASSIGN(_cap_))
+#define DP_CAP_UHBR_13_5_SUPPORT	BIT(26)
+#define DP_CAP_CABLE_TYPE(_cap_)	(((_cap_) & GENMASK(29, 28)) >> 28)
+#define   DP_CAP_CABLE_TYPE_PASSIVE	0
+#define   DP_CAP_CABLE_TYPE_RE_TIMER	1
+#define   DP_CAP_CABLE_TYPE_RE_DRIVER	2
+#define   DP_CAP_CABLE_TYPE_OPTICAL	3
+#define DP_CAP_DPAM_VERSION		BIT(30)
 
 /* DisplayPort Status Update VDO bits */
 #define DP_STATUS_CONNECTION(_status_)	((_status_) & 3)
@@ -97,13 +106,24 @@ enum {
 #define DP_CONF_CURRENTLY(_conf_)	((_conf_) & 3)
 #define DP_CONF_UFP_U_AS_DFP_D		BIT(0)
 #define DP_CONF_UFP_U_AS_UFP_D		BIT(1)
-#define DP_CONF_SIGNALING_DP		BIT(2)
-#define DP_CONF_SIGNALING_GEN_2		BIT(3) /* Reserved after v1.0b */
+#define DP_CONF_SIGNALLING_MASK		GENMASK(5, 2)
+#define DP_CONF_SIGNALLING_SHIFT	2
+#define   DP_CONF_SIGNALLING_HBR3	1
+#define   DP_CONF_SIGNALLING_UHBR10	2
+#define   DP_CONF_SIGNALLING_UHBR20	3
 #define DP_CONF_PIN_ASSIGNEMENT_SHIFT	8
 #define DP_CONF_PIN_ASSIGNEMENT_MASK	GENMASK(15, 8)
 
 /* Helper for setting/getting the pin assignment value to the configuration */
 #define DP_CONF_SET_PIN_ASSIGN(_a_)	((_a_) << 8)
 #define DP_CONF_GET_PIN_ASSIGN(_conf_)	(((_conf_) & GENMASK(15, 8)) >> 8)
+#define DP_CONF_UHBR13_5_SUPPORT	BIT(26)
+#define DP_CONF_CABLE_TYPE_MASK		GENMASK(29, 28)
+#define DP_CONF_CABLE_TYPE_SHIFT	28
+#define   DP_CONF_CABLE_TYPE_PASSIVE	0
+#define   DP_CONF_CABLE_TYPE_RE_TIMER	1
+#define   DP_CONF_CABLE_TYPE_RE_DRIVER	2
+#define   DP_CONF_CABLE_TYPE_OPTICAL	3
+#define DP_CONF_DPAM_VERSION		BIT(30)
 
 #endif /* __USB_TYPEC_DP_H */
Signature · 1 line
2.25.1
#2 lore raw

PATCH v4 2/5 usb: typec: Add Active or Passive cable defination to cable discover mode VDO

In reply to Utkarsh Patel

As per USB Type-C Connector specification v2.2 section F.2.6, BIT25 represents Active or Passive cable. Added BIT25 defination to the Thunderbolt 3 cable discover mode VDO.

---
Changes in v4:
- No change.

Changes in v3:
- Reviewed-by tag from Heikki is added.

Changes in v2:
- This change is being added as new patch in this series.

 include/linux/usb/typec_tbt.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/usb/typec_tbt.h +1 -0
index 63dd44b72e0c..c7a2153bd6f5 100644
@@ -46,6 +46,7 @@ struct typec_thunderbolt_data {
 #define TBT_CABLE_OPTICAL		BIT(21)
 #define TBT_CABLE_RETIMER		BIT(22)
 #define TBT_CABLE_LINK_TRAINING		BIT(23)
+#define TBT_CABLE_ACTIVE_PASSIVE	BIT(25)
 
 #define TBT_SET_CABLE_SPEED(_s_)	(((_s_) & GENMASK(2, 0)) << 16)
 #define TBT_SET_CABLE_ROUNDED(_g_)	(((_g_) & GENMASK(1, 0)) << 19)
Signature · 1 line
2.25.1
#3 lore raw

PATCH v4 3/5 usb: pd: Add helper macro to get Type C cable speed

In reply to Utkarsh Patel

Added a helper macro to get the Type C cable speed when provided the cable VDO.

---
Changes in v4:
- Added this patch back in this series with Reviewed-by tag from Heikki.

Changes in v2:
- This change is being added as new patch in this series.

 include/linux/usb/pd_vdo.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/usb/pd_vdo.h +1 -0
index b057250704e8..3a747938cdab 100644
@@ -376,6 +376,7 @@
 	 | ((vbm) & 0x3) << 9 | (sbu) << 8 | (sbut) << 7 | ((cur) & 0x3) << 5	\
 	 | (vbt) << 4 | (sopp) << 3 | ((spd) & 0x7))
 
+#define VDO_TYPEC_CABLE_SPEED(vdo)	((vdo) & 0x7)
 #define VDO_TYPEC_CABLE_TYPE(vdo)	(((vdo) >> 18) & 0x3)
 
 /*
Signature · 1 line
2.25.1
#4 lore raw

PATCH v4 4/5 platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1 Support

In reply to Utkarsh Patel

Displayport Alternatemode 2.1 requires cable capabilities such as cable signalling, cable type, DPAM version which then will be used by mux driver for displayport configuration. These capabilities can be derived from the Cable VDO.

---
Changes in v4:
- Removed helper macro changes from this patch as [PATCH 3/5] is added back.
- Added Acked-by tag from Prashant.

Changes in v3:
- Removed use of variable cable_seepd.
- Added helper macro of pd_vdo.h in this patch as cros_ec_typec is the user.

Changes in v2:
- Remvoed feature flag specifice to DP2.1.
- Remvoed seperate function for DP2.1.
- Removed use of EC host coammnd to get cable details.
- TBT cable VDO is used to get cable details.
- Using VDO_CABLE_SPEED macro to get passive cable speed.

 drivers/platform/chrome/cros_ec_typec.c | 28 +++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
drivers/platform/chrome/cros_ec_typec.c +28 -0
index d0b4d3fc40ed..cca913400b39 100644
@@ -492,6 +492,8 @@ static int cros_typec_enable_dp(struct cros_typec_data *typec,
 {
 	struct cros_typec_port *port = typec->ports[port_num];
 	struct typec_displayport_data dp_data;
+	u32 cable_tbt_vdo;
+	u32 cable_dp_vdo;
 	int ret;
 
 	if (typec->pd_ctrl_ver < 2) {
@@ -524,6 +526,32 @@ static int cros_typec_enable_dp(struct cros_typec_data *typec,
 	port->state.data = &dp_data;
 	port->state.mode = TYPEC_MODAL_STATE(ffs(pd_ctrl->dp_mode));
 
+	/* Get cable VDO for cables with DPSID to check DPAM2.1 is supported */
+	cable_dp_vdo = cros_typec_get_cable_vdo(port, USB_TYPEC_DP_SID);
+
+	/**
+	 * Get cable VDO for thunderbolt cables and cables with DPSID but does not
+	 * support DPAM2.1.
+	 */
+	cable_tbt_vdo = cros_typec_get_cable_vdo(port, USB_TYPEC_TBT_SID);
+
+	if (cable_dp_vdo & DP_CAP_DPAM_VERSION) {
+		dp_data.conf |= cable_dp_vdo;
+	} else if (cable_tbt_vdo) {
+		dp_data.conf |=  TBT_CABLE_SPEED(cable_tbt_vdo) << DP_CONF_SIGNALLING_SHIFT;
+
+		/* Cable Type */
+		if (cable_tbt_vdo & TBT_CABLE_OPTICAL)
+			dp_data.conf |= DP_CONF_CABLE_TYPE_OPTICAL << DP_CONF_CABLE_TYPE_SHIFT;
+		else if (cable_tbt_vdo & TBT_CABLE_RETIMER)
+			dp_data.conf |= DP_CONF_CABLE_TYPE_RE_TIMER << DP_CONF_CABLE_TYPE_SHIFT;
+		else if (cable_tbt_vdo & TBT_CABLE_ACTIVE_PASSIVE)
+			dp_data.conf |= DP_CONF_CABLE_TYPE_RE_DRIVER << DP_CONF_CABLE_TYPE_SHIFT;
+	} else if (PD_IDH_PTYPE(port->c_identity.id_header) == IDH_PTYPE_PCABLE) {
+		dp_data.conf |= VDO_TYPEC_CABLE_SPEED(port->c_identity.vdo[0]) <<
+				DP_CONF_SIGNALLING_SHIFT;
+	}
+
 	ret = cros_typec_retimer_set(port->retimer, port->state);
 	if (!ret)
 		ret = typec_mux_set(port->mux, &port->state);
Signature · 1 line
2.25.1
#5 lore raw

Re: [PATCH v4 4/5] platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1 Support

Quoted 4 lines · Utkarsh Patel

Displayport Alternatemode 2.1 requires cable capabilities such as cable signalling, cable type, DPAM version which then will be used by mux driver for displayport configuration. These capabilities can be derived from the Cable VDO.

...

drivers/platform/chrome/cros_ec_typec.c static int cros_typec_enable_dp(struct cros_typec_data *typec, · line 532

Quoted 1 line
drivers/platform/chrome/cros_ec_typec.c +1 -0
+	/**

Are you sure?

Quoted 3 lines
drivers/platform/chrome/cros_ec_typec.c +3 -0
+	 * Get cable VDO for thunderbolt cables and cables with DPSID but does not
+	 * support DPAM2.1.
+	 */

...

Quoted 6 lines
drivers/platform/chrome/cros_ec_typec.c +6 -0
+	if (cable_dp_vdo & DP_CAP_DPAM_VERSION) {
+		dp_data.conf |= cable_dp_vdo;
+	} else if (cable_tbt_vdo) {
+		dp_data.conf |=  TBT_CABLE_SPEED(cable_tbt_vdo) << DP_CONF_SIGNALLING_SHIFT;
+
+		/* Cable Type */

drivers/platform/chrome/cros_ec_typec.c static int cros_typec_enable_dp(struct cros_typec_data *typec, · line 553

Quoted 10 lines
drivers/platform/chrome/cros_ec_typec.c +10 -0
+		if (cable_tbt_vdo & TBT_CABLE_OPTICAL)
+			dp_data.conf |= DP_CONF_CABLE_TYPE_OPTICAL << DP_CONF_CABLE_TYPE_SHIFT;
+		else if (cable_tbt_vdo & TBT_CABLE_RETIMER)
+			dp_data.conf |= DP_CONF_CABLE_TYPE_RE_TIMER << DP_CONF_CABLE_TYPE_SHIFT;
+		else if (cable_tbt_vdo & TBT_CABLE_ACTIVE_PASSIVE)
+			dp_data.conf |= DP_CONF_CABLE_TYPE_RE_DRIVER << DP_CONF_CABLE_TYPE_SHIFT;
+	} else if (PD_IDH_PTYPE(port->c_identity.id_header) == IDH_PTYPE_PCABLE) {
+		dp_data.conf |= VDO_TYPEC_CABLE_SPEED(port->c_identity.vdo[0]) <<
+				DP_CONF_SIGNALLING_SHIFT;
+	}

You can also make it a bit more readable with (use better names if you think it's needed)

	u32 signalling = 0;
	u32 cable_type = 0;

	...

	if (cable_dp_vdo & DP_CAP_DPAM_VERSION) {
		dp_data.conf |= cable_dp_vdo;
	} else if (cable_tbt_vdo) {
		signalling = TBT_CABLE_SPEED(cable_tbt_vdo);

		/* Cable Type */
		if (cable_tbt_vdo & TBT_CABLE_OPTICAL)
			cable_type = DP_CONF_CABLE_TYPE_OPTICAL;
		else if (cable_tbt_vdo & TBT_CABLE_RETIMER)
			cable_type = DP_CONF_CABLE_TYPE_RE_TIMER;
		else if (cable_tbt_vdo & TBT_CABLE_ACTIVE_PASSIVE)
			cable_type = DP_CONF_CABLE_TYPE_RE_DRIVER;
	} else if (PD_IDH_PTYPE(port->c_identity.id_header) == IDH_PTYPE_PCABLE) {
		signalling = VDO_TYPEC_CABLE_SPEED(port->c_identity.vdo[0]);
	}

	dp_data.conf |= signalling << DP_CONF_SIGNALLING_SHIFT;
	dp_data.conf |= cable_type << DP_CONF_CABLE_TYPE_SHIFT;
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw

RE: [PATCH v4 4/5] platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1 Support

Hi Andy,

Thank you for the review.

Quoted 7 lines

...

drivers/platform/chrome/cros_ec_typec.c static int cros_typec_enable_dp(struct cros_typec_data *typec, · line 532

Quoted 1 line
drivers/platform/chrome/cros_ec_typec.c +1 -0
+	/**

Are you sure?

Quoted 6 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	 * Get cable VDO for thunderbolt cables and cables with DPSID but

does not

Quoted 2 lines
drivers/platform/chrome/cros_ec_typec.c +2 -0
+	 * support DPAM2.1.
+	 */

...

Yes, there are TBT3 cables which advertise DPSID but does not provide any DP capabilities in the DP discover mode VDO but does support UHBR. In that case, need to use TBTSID and use capabilities from TBT discover mode VDO.

Quoted 27 lines

drivers/platform/chrome/cros_ec_typec.c static int cros_typec_enable_dp(struct cros_typec_data *typec,

Quoted 10 lines
drivers/platform/chrome/cros_ec_typec.c +9 -0
+	if (cable_dp_vdo & DP_CAP_DPAM_VERSION) {
+		dp_data.conf |= cable_dp_vdo;
+	} else if (cable_tbt_vdo) {
+		dp_data.conf |=  TBT_CABLE_SPEED(cable_tbt_vdo) <<
+DP_CONF_SIGNALLING_SHIFT;
+
+		/* Cable Type */
+		if (cable_tbt_vdo & TBT_CABLE_OPTICAL)
+			dp_data.conf |= DP_CONF_CABLE_TYPE_OPTICAL <<

DP_CONF_CABLE_TYPE_SHIFT;

Review

Quoted 2 lines
(quoted diff) +2 -0
+		else if (cable_tbt_vdo & TBT_CABLE_RETIMER)
+			dp_data.conf |= DP_CONF_CABLE_TYPE_RE_TIMER <<

DP_CONF_CABLE_TYPE_SHIFT;

Review

Quoted 2 lines
(quoted diff) +2 -0
+		else if (cable_tbt_vdo & TBT_CABLE_ACTIVE_PASSIVE)
+			dp_data.conf |= DP_CONF_CABLE_TYPE_RE_DRIVER

<< DP_CONF_CABLE_TYPE_SHIFT;

Review

Quoted 1 line
(quoted diff) +1 -0
+	} else if (PD_IDH_PTYPE(port->c_identity.id_header) ==

IDH_PTYPE_PCABLE) {

drivers/platform/chrome/cros_ec_typec.c static int cros_typec_enable_dp(struct cros_typec_data *typec, · line 553

Quoted 4 lines
(quoted diff) +1 -0
+		dp_data.conf |= VDO_TYPEC_CABLE_SPEED(port-

c_identity.vdo[0]) <<

drivers/platform/chrome/cros_ec_typec.c +2 -0
+				DP_CONF_SIGNALLING_SHIFT;
+	}

You can also make it a bit more readable with (use better names if you think it's needed)

Quoted 2 lines
	u32 signalling = 0;
	u32 cable_type = 0;

In v2 version of this patch I had them but there was feedback to remove extra variables and use them inline.

Sincerely,
Utkarsh Patel.

#7 lore raw

Re: [PATCH v4 4/5] platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1 Support

On Mon, Sep 25, 2023 at 03:54:40PM +0000, Patel, Utkarsh H wrote:

...

Quoted 4 lines
Quoted 4 lines

drivers/platform/chrome/cros_ec_typec.c static int cros_typec_enable_dp(struct cros_typec_data *typec, · line 532

Quoted 1 line
drivers/platform/chrome/cros_ec_typec.c +1 -0
+	/**

Are you sure?

Quoted 8 lines
Quoted 5 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	 * Get cable VDO for thunderbolt cables and cables with DPSID but

does not

drivers/platform/chrome/cros_ec_typec.c static int cros_typec_enable_dp(struct cros_typec_data *typec, · line 535

Quoted 2 lines
drivers/platform/chrome/cros_ec_typec.c +2 -0
+	 * support DPAM2.1.
+	 */

Yes, there are TBT3 cables which advertise DPSID but does not provide any DP capabilities in the DP discover mode VDO but does support UHBR. In that case, need to use TBTSID and use capabilities from TBT discover mode VDO.

My comment was against the style of the comment, not about content.

...

Quoted 8 lines
Quoted 5 lines

You can also make it a bit more readable with (use better names if you think it's needed)

	u32 signalling = 0;
	u32 cable_type = 0;

In v2 version of this patch I had them but there was feedback to remove extra variables and use them inline.

OK!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#8 lore raw

RE: [PATCH v4 4/5] platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1 Support

Quoted 15 lines · Utkarsh H

...

Quoted 10 lines
Quoted 10 lines

drivers/platform/chrome/cros_ec_typec.c static int cros_typec_enable_dp(struct cros_typec_data *typec, · line 532

Quoted 1 line
drivers/platform/chrome/cros_ec_typec.c +1 -0
+	/**

Are you sure?

Review

Quoted 2 lines
(quoted diff) +2 -0
+	 * Get cable VDO for thunderbolt cables and cables with DPSID
+but

does not

Quoted 2 lines
drivers/platform/chrome/cros_ec_typec.c +2 -0
+	 * support DPAM2.1.
+	 */
Quoted 7 lines
Quoted 3 lines

Yes, there are TBT3 cables which advertise DPSID but does not provide any DP capabilities in the DP discover mode VDO but does support UHBR. In that case, need to use TBTSID and use capabilities from TBT discover mode

VDO.

My comment was against the style of the comment, not about content.

Ahh, Okay. Thank you for clarifying.

Sincerely,
Utkarsh Patel.

#9 lore raw

PATCH v4 5/5 usb: typec: intel_pmc_mux: Configure Displayport Alternate mode 2.1

In reply to Utkarsh Patel

Mux agent driver can configure cable details such as cable type and cable speed received as a part of displayport configuration to support Displayport Alternate mode 2.1.

---
Changes in v4:
- No change.

Changes in v3:
- No change.

Changes in v2:
- No change.

 drivers/usb/typec/mux/intel_pmc_mux.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/usb/typec/mux/intel_pmc_mux.c +24 -0
index 60ed1f809130..233958084b43 100644
@@ -191,6 +191,12 @@ static int hsl_orientation(struct pmc_usb_port *port)
 	return port->orientation - 1;
 }
 
+static bool is_pmc_mux_tbt(struct acpi_device *adev)
+{
+	return acpi_dev_hid_uid_match(adev, "INTC1072", NULL) ||
+	       acpi_dev_hid_uid_match(adev, "INTC1079", NULL);
+}
+
 static int pmc_usb_send_command(struct intel_scu_ipc_dev *ipc, u8 *msg, u32 len)
 {
 	u8 response[4];
@@ -293,6 +299,24 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state)
 	req.mode_data |= (state->mode - TYPEC_STATE_MODAL) <<
 			 PMC_USB_ALTMODE_DP_MODE_SHIFT;
 
+	if (!is_pmc_mux_tbt(port->pmc->iom_adev)) {
+		u8 cable_speed = (data->conf & DP_CONF_SIGNALLING_MASK) >>
+				  DP_CONF_SIGNALLING_SHIFT;
+
+		u8 cable_type = (data->conf & DP_CONF_CABLE_TYPE_MASK) >>
+				 DP_CONF_CABLE_TYPE_SHIFT;
+
+		req.mode_data |= PMC_USB_ALTMODE_CABLE_SPD(cable_speed);
+
+		if (cable_type == DP_CONF_CABLE_TYPE_OPTICAL)
+			req.mode_data |= PMC_USB_ALTMODE_CABLE_TYPE;
+		else if (cable_type == DP_CONF_CABLE_TYPE_RE_TIMER)
+			req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE |
+					 PMC_USB_ALTMODE_RETIMER_CABLE;
+		else if (cable_type == DP_CONF_CABLE_TYPE_RE_DRIVER)
+			req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE;
+	}
+
 	ret = pmc_usb_command(port, (void *)&req, sizeof(req));
 	if (ret)
 		return ret;
Signature · 1 line
2.25.1
#10 lore raw

Re: [PATCH v4 5/5] usb: typec: intel_pmc_mux: Configure Displayport Alternate mode 2.1

Quoted 24 lines · Utkarsh Patel

Mux agent driver can configure cable details such as cable type and cable speed received as a part of displayport configuration to support Displayport Alternate mode 2.1.

---
Changes in v4:
- No change.

Changes in v3:
- No change.

Changes in v2:
- No change.

 drivers/usb/typec/mux/intel_pmc_mux.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/usb/typec/mux/intel_pmc_mux.c +0 -0
index 60ed1f809130..233958084b43 100644

[...]

Quoted 10 lines
drivers/usb/typec/mux/intel_pmc_mux.c +6 -0
@@ -293,6 +299,24 @@ pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state)
 	req.mode_data |= (state->mode - TYPEC_STATE_MODAL) <<
 			 PMC_USB_ALTMODE_DP_MODE_SHIFT;
 
+	if (!is_pmc_mux_tbt(port->pmc->iom_adev)) {
+		u8 cable_speed = (data->conf & DP_CONF_SIGNALLING_MASK) >>
+				  DP_CONF_SIGNALLING_SHIFT;
+
+		u8 cable_type = (data->conf & DP_CONF_CABLE_TYPE_MASK) >>
+				 DP_CONF_CABLE_TYPE_SHIFT;

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) · line 317

Quoted 10 lines
drivers/usb/typec/mux/intel_pmc_mux.c +10 -0
+
+		req.mode_data |= PMC_USB_ALTMODE_CABLE_SPD(cable_speed);
+
+		if (cable_type == DP_CONF_CABLE_TYPE_OPTICAL)
+			req.mode_data |= PMC_USB_ALTMODE_CABLE_TYPE;
+		else if (cable_type == DP_CONF_CABLE_TYPE_RE_TIMER)
+			req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE |
+					 PMC_USB_ALTMODE_RETIMER_CABLE;
+		else if (cable_type == DP_CONF_CABLE_TYPE_RE_DRIVER)
+			req.mode_data |= PMC_USB_ALTMODE_ACTIVE_CABLE;

Why not *switch* instead of string of *if*s?

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state) · line 322

Quoted 5 lines
drivers/usb/typec/mux/intel_pmc_mux.c +2 -0
+	}
+
 	ret = pmc_usb_command(port, (void *)&req, sizeof(req));
 	if (ret)
 		return ret;

MBR, Sergey

#11 lore raw

RE: [PATCH v4 5/5] usb: typec: intel_pmc_mux: Configure Displayport Alternate mode 2.1

Hi Sergei,

Thank you for the review.

Quoted 62 lines

-----Original Message-----
From: Sergei Shtylyov <[email protected]>
Sent: Wednesday, September 20, 2023 2:10 AM
To: Patel, Utkarsh H <[email protected]>; linux- [email protected]; [email protected]
Cc: [email protected]; [email protected]; chrome- [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v4 5/5] usb: typec: intel_pmc_mux: Configure Displayport Alternate mode 2.1

Quoted 11 lines · Utkarsh Patel

Mux agent driver can configure cable details such as cable type and cable speed received as a part of displayport configuration to support Displayport Alternate mode 2.1.

---
Changes in v4:
- No change.

Quoted 7 lines

Changes in v3:
- No change.

Changes in v2:
- No change.

 drivers/usb/typec/mux/intel_pmc_mux.c | 24

++++++++++++++++++++++++

Quoted 7 lines
 1 file changed, 24 insertions(+)
drivers/usb/typec/mux/intel_pmc_mux.c +0 -0
index 60ed1f809130..233958084b43 100644

[...]

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_dp(struct pmc_usb_port *port,

Quoted 1 line
drivers/usb/typec/mux/intel_pmc_mux.c +0 -0
@@ -293,6 +299,24 @@ pmc_usb_mux_dp(struct pmc_usb_port *port,

struct typec_mux_state *state)

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state)

Quoted 5 lines
drivers/usb/typec/mux/intel_pmc_mux.c +2 -0
 	req.mode_data |= (state->mode - TYPEC_STATE_MODAL) <<
 			 PMC_USB_ALTMODE_DP_MODE_SHIFT;
 
+	if (!is_pmc_mux_tbt(port->pmc->iom_adev)) {
+		u8 cable_speed = (data->conf &

DP_CONF_SIGNALLING_MASK) >>

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state)

Quoted 7 lines
drivers/usb/typec/mux/intel_pmc_mux.c +3 -0
+				  DP_CONF_SIGNALLING_SHIFT;
+
+		u8 cable_type = (data->conf & DP_CONF_CABLE_TYPE_MASK)
Quoted 1 line
drivers/usb/typec/mux/intel_pmc_mux.c +3 -0
+				 DP_CONF_CABLE_TYPE_SHIFT;
+
+		req.mode_data |=

PMC_USB_ALTMODE_CABLE_SPD(cable_speed);

drivers/usb/typec/mux/intel_pmc_mux.c pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state)

Quoted 5 lines
drivers/usb/typec/mux/intel_pmc_mux.c +5 -0
+
+		if (cable_type == DP_CONF_CABLE_TYPE_OPTICAL)
+			req.mode_data |= PMC_USB_ALTMODE_CABLE_TYPE;
+		else if (cable_type == DP_CONF_CABLE_TYPE_RE_TIMER)
+			req.mode_data |=

PMC_USB_ALTMODE_ACTIVE_CABLE |

Quoted 8 lines
Quoted 1 line

+

PMC_USB_ALTMODE_RETIMER_CABLE;

drivers/usb/typec/mux/intel_pmc_mux.c

Quoted 2 lines
drivers/usb/typec/mux/intel_pmc_mux.c +2 -0
+		else if (cable_type == DP_CONF_CABLE_TYPE_RE_DRIVER)
+			req.mode_data |=

PMC_USB_ALTMODE_ACTIVE_CABLE;

Why not *switch* instead of string of *if*s?

Switch can be used here but if there is no added benefit, would stick to if/else.

Sincerely,
Utkarsh Patel.

#12 lore raw
In reply to Utkarsh Patel
This series was applied to chrome-platform/linux.git (for-kernelci) by Greg Kroah-Hartman <[email protected]>:

Hello:

This series was applied to chrome-platform/linux.git (for-kernelci) by Greg Kroah-Hartman <[email protected]>:

Quoted 9 lines · On Tue, 19 Sep 2023 19:32:38 -0700 you wrote:

This series enabels cable identification flow required for Displayport Alternate Mode 2.1 support.

Please add this series to usb-next.

Changes in v4:
- Added [PATCH 3/5] back in this series with Reviewed-by tag from Heikki.

[...]

Here is the summary with links:
- [v4,1/5] usb: typec: Add Displayport Alternate Mode 2.1 Support

    https://git.kernel.org/chrome-platform/c/a17fae8fc38e
  - [v4,2/5] usb: typec: Add Active or Passive cable defination to cable discover mode VDO
    https://git.kernel.org/chrome-platform/c/c365b1e1f404
  - [v4,3/5] usb: pd: Add helper macro to get Type C cable speed
    https://git.kernel.org/chrome-platform/c/f9ee6043283a
  - [v4,4/5] platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1 Support
    https://git.kernel.org/chrome-platform/c/70ca6c7312c5
  - [v4,5/5] usb: typec: intel_pmc_mux: Configure Displayport Alternate mode 2.1
    https://git.kernel.org/chrome-platform/c/6c29de68fb29

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#13 lore raw
In reply to Utkarsh Patel
This series was applied to chrome-platform/linux.git (for-next) by Greg Kroah-Hartman <[email protected]>:

Hello:

This series was applied to chrome-platform/linux.git (for-next) by Greg Kroah-Hartman <[email protected]>:

Quoted 9 lines · On Tue, 19 Sep 2023 19:32:38 -0700 you wrote:

This series enabels cable identification flow required for Displayport Alternate Mode 2.1 support.

Please add this series to usb-next.

Changes in v4:
- Added [PATCH 3/5] back in this series with Reviewed-by tag from Heikki.

[...]

Here is the summary with links:
- [v4,1/5] usb: typec: Add Displayport Alternate Mode 2.1 Support

    https://git.kernel.org/chrome-platform/c/a17fae8fc38e
  - [v4,2/5] usb: typec: Add Active or Passive cable defination to cable discover mode VDO
    https://git.kernel.org/chrome-platform/c/c365b1e1f404
  - [v4,3/5] usb: pd: Add helper macro to get Type C cable speed
    https://git.kernel.org/chrome-platform/c/f9ee6043283a
  - [v4,4/5] platform/chrome: cros_ec_typec: Add Displayport Alternatemode 2.1 Support
    https://git.kernel.org/chrome-platform/c/70ca6c7312c5
  - [v4,5/5] usb: typec: intel_pmc_mux: Configure Displayport Alternate mode 2.1
    https://git.kernel.org/chrome-platform/c/6c29de68fb29

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html