Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com>
Link: https://lore.kernel.org/r/20230920023243.2494410-2-utkarsh.h.patel@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Utkarsh Patel and committed by
Greg Kroah-Hartman
a17fae8f bb00788b

+31 -8
+4 -1
drivers/usb/typec/altmodes/displayport.c
··· 86 86 87 87 static int dp_altmode_configure(struct dp_altmode *dp, u8 con) 88 88 { 89 - u32 conf = DP_CONF_SIGNALING_DP; /* Only DP signaling supported */ 90 89 u8 pin_assign = 0; 90 + u32 conf; 91 + 92 + /* DP Signalling */ 93 + conf = (dp->data.conf & DP_CONF_SIGNALLING_MASK) >> DP_CONF_SIGNALLING_SHIFT; 91 94 92 95 switch (con) { 93 96 case DP_STATUS_CON_DISABLED:
+1 -1
drivers/usb/typec/ucsi/displayport.c
··· 315 315 struct ucsi_dp *dp; 316 316 317 317 /* We can't rely on the firmware with the capabilities. */ 318 - desc->vdo |= DP_CAP_DP_SIGNALING | DP_CAP_RECEPTACLE; 318 + desc->vdo |= DP_CAP_DP_SIGNALLING(0) | DP_CAP_RECEPTACLE; 319 319 320 320 /* Claiming that we support all pin assignments */ 321 321 desc->vdo |= all_assignments << 8;
+2 -2
drivers/usb/typec/ucsi/ucsi_ccg.c
··· 501 501 case NVIDIA_FTB_DP_OFFSET: 502 502 if (alt[0].mid == USB_TYPEC_NVIDIA_VLINK_DBG_VDO) 503 503 alt[0].mid = USB_TYPEC_NVIDIA_VLINK_DP_VDO | 504 - DP_CAP_DP_SIGNALING | DP_CAP_USB | 505 - DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_E)); 504 + DP_CAP_DP_SIGNALLING(0) | DP_CAP_USB | 505 + DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_E)); 506 506 break; 507 507 case NVIDIA_FTB_DBG_OFFSET: 508 508 if (alt[0].mid == USB_TYPEC_NVIDIA_VLINK_DP_VDO)
+24 -4
include/linux/usb/typec_dp.h
··· 67 67 #define DP_CAP_UFP_D 1 68 68 #define DP_CAP_DFP_D 2 69 69 #define DP_CAP_DFP_D_AND_UFP_D 3 70 - #define DP_CAP_DP_SIGNALING BIT(2) /* Always set */ 71 - #define DP_CAP_GEN2 BIT(3) /* Reserved after v1.0b */ 70 + #define DP_CAP_DP_SIGNALLING(_cap_) (((_cap_) & GENMASK(5, 2)) >> 2) 71 + #define DP_CAP_SIGNALLING_HBR3 1 72 + #define DP_CAP_SIGNALLING_UHBR10 2 73 + #define DP_CAP_SIGNALLING_UHBR20 3 72 74 #define DP_CAP_RECEPTACLE BIT(6) 73 75 #define DP_CAP_USB BIT(7) 74 76 #define DP_CAP_DFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(15, 8)) >> 8) ··· 80 78 DP_CAP_UFP_D_PIN_ASSIGN(_cap_) : DP_CAP_DFP_D_PIN_ASSIGN(_cap_)) 81 79 #define DP_CAP_PIN_ASSIGN_DFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \ 82 80 DP_CAP_DFP_D_PIN_ASSIGN(_cap_) : DP_CAP_UFP_D_PIN_ASSIGN(_cap_)) 81 + #define DP_CAP_UHBR_13_5_SUPPORT BIT(26) 82 + #define DP_CAP_CABLE_TYPE(_cap_) (((_cap_) & GENMASK(29, 28)) >> 28) 83 + #define DP_CAP_CABLE_TYPE_PASSIVE 0 84 + #define DP_CAP_CABLE_TYPE_RE_TIMER 1 85 + #define DP_CAP_CABLE_TYPE_RE_DRIVER 2 86 + #define DP_CAP_CABLE_TYPE_OPTICAL 3 87 + #define DP_CAP_DPAM_VERSION BIT(30) 83 88 84 89 /* DisplayPort Status Update VDO bits */ 85 90 #define DP_STATUS_CONNECTION(_status_) ((_status_) & 3) ··· 106 97 #define DP_CONF_CURRENTLY(_conf_) ((_conf_) & 3) 107 98 #define DP_CONF_UFP_U_AS_DFP_D BIT(0) 108 99 #define DP_CONF_UFP_U_AS_UFP_D BIT(1) 109 - #define DP_CONF_SIGNALING_DP BIT(2) 110 - #define DP_CONF_SIGNALING_GEN_2 BIT(3) /* Reserved after v1.0b */ 100 + #define DP_CONF_SIGNALLING_MASK GENMASK(5, 2) 101 + #define DP_CONF_SIGNALLING_SHIFT 2 102 + #define DP_CONF_SIGNALLING_HBR3 1 103 + #define DP_CONF_SIGNALLING_UHBR10 2 104 + #define DP_CONF_SIGNALLING_UHBR20 3 111 105 #define DP_CONF_PIN_ASSIGNEMENT_SHIFT 8 112 106 #define DP_CONF_PIN_ASSIGNEMENT_MASK GENMASK(15, 8) 113 107 114 108 /* Helper for setting/getting the pin assignment value to the configuration */ 115 109 #define DP_CONF_SET_PIN_ASSIGN(_a_) ((_a_) << 8) 116 110 #define DP_CONF_GET_PIN_ASSIGN(_conf_) (((_conf_) & GENMASK(15, 8)) >> 8) 111 + #define DP_CONF_UHBR13_5_SUPPORT BIT(26) 112 + #define DP_CONF_CABLE_TYPE_MASK GENMASK(29, 28) 113 + #define DP_CONF_CABLE_TYPE_SHIFT 28 114 + #define DP_CONF_CABLE_TYPE_PASSIVE 0 115 + #define DP_CONF_CABLE_TYPE_RE_TIMER 1 116 + #define DP_CONF_CABLE_TYPE_RE_DRIVER 2 117 + #define DP_CONF_CABLE_TYPE_OPTICAL 3 118 + #define DP_CONF_DPAM_VERSION BIT(30) 117 119 118 120 #endif /* __USB_TYPEC_DP_H */