1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __USB_TYPEC_DP_H
3 #define __USB_TYPEC_DP_H
5 #include <linux/usb/typec_altmode.h>
7 #define USB_TYPEC_DP_SID 0xff01
8 #define USB_TYPEC_DP_MODE 1
11 * Connector states matching the pin assignments in DisplayPort Alt Mode
14 * These values are meant primarily to be used by the mux drivers, but they are
15 * also used as the "value" part in the alternate mode notification chain, so
16 * receivers of those notifications will always see them.
18 * Note. DisplayPort USB Type-C Alt Mode Specification version 1.0b deprecated
19 * pin assignments A, B and F, but they are still defined here for legacy
23 TYPEC_DP_STATE_A = TYPEC_STATE_MODAL, /* Not supported after v1.0b */
24 TYPEC_DP_STATE_B, /* Not supported after v1.0b */
28 TYPEC_DP_STATE_F, /* Not supported after v1.0b */
32 * struct typec_displayport_data - DisplayPort Alt Mode specific data
33 * @status: Status Update command VDO content
34 * @conf: Configure command VDO content
36 * This structure is delivered as the data part with the notifications. It
37 * contains the VDOs from the two DisplayPort Type-C alternate mode specific
38 * commands: Status Update and Configure.
40 * @status will show for example the status of the HPD signal.
42 struct typec_displayport_data {
48 DP_PIN_ASSIGN_A, /* Not supported after v1.0b */
49 DP_PIN_ASSIGN_B, /* Not supported after v1.0b */
53 DP_PIN_ASSIGN_F, /* Not supported after v1.0b */
56 /* DisplayPort alt mode specific commands */
57 #define DP_CMD_STATUS_UPDATE VDO_CMD_VENDOR(0)
58 #define DP_CMD_CONFIGURE VDO_CMD_VENDOR(1)
60 /* DisplayPort Capabilities VDO bits (returned with Discover Modes) */
61 #define DP_CAP_CAPABILITY(_cap_) ((_cap_) & 3)
62 #define DP_CAP_UFP_D 1
63 #define DP_CAP_DFP_D 2
64 #define DP_CAP_DFP_D_AND_UFP_D 3
65 #define DP_CAP_DP_SIGNALING BIT(2) /* Always set */
66 #define DP_CAP_GEN2 BIT(3) /* Reserved after v1.0b */
67 #define DP_CAP_RECEPTACLE BIT(6)
68 #define DP_CAP_USB BIT(7)
69 #define DP_CAP_DFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(15, 8)) >> 8)
70 #define DP_CAP_UFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(23, 16)) >> 16)
72 /* DisplayPort Status Update VDO bits */
73 #define DP_STATUS_CONNECTION(_status_) ((_status_) & 3)
74 #define DP_STATUS_CON_DISABLED 0
75 #define DP_STATUS_CON_DFP_D 1
76 #define DP_STATUS_CON_UFP_D 2
77 #define DP_STATUS_CON_BOTH 3
78 #define DP_STATUS_POWER_LOW BIT(2)
79 #define DP_STATUS_ENABLED BIT(3)
80 #define DP_STATUS_PREFER_MULTI_FUNC BIT(4)
81 #define DP_STATUS_SWITCH_TO_USB BIT(5)
82 #define DP_STATUS_EXIT_DP_MODE BIT(6)
83 #define DP_STATUS_HPD_STATE BIT(7) /* 0 = HPD_Low, 1 = HPD_High */
84 #define DP_STATUS_IRQ_HPD BIT(8)
86 /* DisplayPort Configurations VDO bits */
87 #define DP_CONF_CURRENTLY(_conf_) ((_conf_) & 3)
88 #define DP_CONF_UFP_U_AS_DFP_D BIT(0)
89 #define DP_CONF_UFP_U_AS_UFP_D BIT(1)
90 #define DP_CONF_SIGNALING_DP BIT(2)
91 #define DP_CONF_SIGNALING_GEN_2 BIT(3) /* Reserved after v1.0b */
92 #define DP_CONF_PIN_ASSIGNEMENT_SHIFT 8
93 #define DP_CONF_PIN_ASSIGNEMENT_MASK GENMASK(15, 8)
95 #endif /* __USB_TYPEC_DP_H */