Skip to content

Commit a17fae8

Browse files
uhpatelgregkh
authored andcommitted
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>
1 parent bb00788 commit a17fae8

4 files changed

Lines changed: 31 additions & 8 deletions

File tree

drivers/usb/typec/altmodes/displayport.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,11 @@ static int dp_altmode_notify(struct dp_altmode *dp)
8686

8787
static int dp_altmode_configure(struct dp_altmode *dp, u8 con)
8888
{
89-
u32 conf = DP_CONF_SIGNALING_DP; /* Only DP signaling supported */
9089
u8 pin_assign = 0;
90+
u32 conf;
91+
92+
/* DP Signalling */
93+
conf = (dp->data.conf & DP_CONF_SIGNALLING_MASK) >> DP_CONF_SIGNALLING_SHIFT;
9194

9295
switch (con) {
9396
case DP_STATUS_CON_DISABLED:

drivers/usb/typec/ucsi/displayport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ struct typec_altmode *ucsi_register_displayport(struct ucsi_connector *con,
315315
struct ucsi_dp *dp;
316316

317317
/* 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;
319319

320320
/* Claiming that we support all pin assignments */
321321
desc->vdo |= all_assignments << 8;

drivers/usb/typec/ucsi/ucsi_ccg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,8 @@ static void ucsi_ccg_nvidia_altmode(struct ucsi_ccg *uc,
501501
case NVIDIA_FTB_DP_OFFSET:
502502
if (alt[0].mid == USB_TYPEC_NVIDIA_VLINK_DBG_VDO)
503503
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));
506506
break;
507507
case NVIDIA_FTB_DBG_OFFSET:
508508
if (alt[0].mid == USB_TYPEC_NVIDIA_VLINK_DP_VDO)

include/linux/usb/typec_dp.h

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ enum {
6767
#define DP_CAP_UFP_D 1
6868
#define DP_CAP_DFP_D 2
6969
#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
7274
#define DP_CAP_RECEPTACLE BIT(6)
7375
#define DP_CAP_USB BIT(7)
7476
#define DP_CAP_DFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(15, 8)) >> 8)
@@ -78,6 +80,13 @@ enum {
7880
DP_CAP_UFP_D_PIN_ASSIGN(_cap_) : DP_CAP_DFP_D_PIN_ASSIGN(_cap_))
7981
#define DP_CAP_PIN_ASSIGN_DFP_D(_cap_) ((_cap_ & DP_CAP_RECEPTACLE) ? \
8082
DP_CAP_DFP_D_PIN_ASSIGN(_cap_) : DP_CAP_UFP_D_PIN_ASSIGN(_cap_))
83+
#define DP_CAP_UHBR_13_5_SUPPORT BIT(26)
84+
#define DP_CAP_CABLE_TYPE(_cap_) (((_cap_) & GENMASK(29, 28)) >> 28)
85+
#define DP_CAP_CABLE_TYPE_PASSIVE 0
86+
#define DP_CAP_CABLE_TYPE_RE_TIMER 1
87+
#define DP_CAP_CABLE_TYPE_RE_DRIVER 2
88+
#define DP_CAP_CABLE_TYPE_OPTICAL 3
89+
#define DP_CAP_DPAM_VERSION BIT(30)
8190

8291
/* DisplayPort Status Update VDO bits */
8392
#define DP_STATUS_CONNECTION(_status_) ((_status_) & 3)
@@ -97,13 +106,24 @@ enum {
97106
#define DP_CONF_CURRENTLY(_conf_) ((_conf_) & 3)
98107
#define DP_CONF_UFP_U_AS_DFP_D BIT(0)
99108
#define DP_CONF_UFP_U_AS_UFP_D BIT(1)
100-
#define DP_CONF_SIGNALING_DP BIT(2)
101-
#define DP_CONF_SIGNALING_GEN_2 BIT(3) /* Reserved after v1.0b */
109+
#define DP_CONF_SIGNALLING_MASK GENMASK(5, 2)
110+
#define DP_CONF_SIGNALLING_SHIFT 2
111+
#define DP_CONF_SIGNALLING_HBR3 1
112+
#define DP_CONF_SIGNALLING_UHBR10 2
113+
#define DP_CONF_SIGNALLING_UHBR20 3
102114
#define DP_CONF_PIN_ASSIGNEMENT_SHIFT 8
103115
#define DP_CONF_PIN_ASSIGNEMENT_MASK GENMASK(15, 8)
104116

105117
/* Helper for setting/getting the pin assignment value to the configuration */
106118
#define DP_CONF_SET_PIN_ASSIGN(_a_) ((_a_) << 8)
107119
#define DP_CONF_GET_PIN_ASSIGN(_conf_) (((_conf_) & GENMASK(15, 8)) >> 8)
120+
#define DP_CONF_UHBR13_5_SUPPORT BIT(26)
121+
#define DP_CONF_CABLE_TYPE_MASK GENMASK(29, 28)
122+
#define DP_CONF_CABLE_TYPE_SHIFT 28
123+
#define DP_CONF_CABLE_TYPE_PASSIVE 0
124+
#define DP_CONF_CABLE_TYPE_RE_TIMER 1
125+
#define DP_CONF_CABLE_TYPE_RE_DRIVER 2
126+
#define DP_CONF_CABLE_TYPE_OPTICAL 3
127+
#define DP_CONF_DPAM_VERSION BIT(30)
108128

109129
#endif /* __USB_TYPEC_DP_H */

0 commit comments

Comments
 (0)