1
2#ifndef __USB_TYPEC_DP_H
3#define __USB_TYPEC_DP_H
4
5#include <linux/usb/typec_altmode.h>
6
7#define USB_TYPEC_DP_SID 0xff01
8
9
10
11
12#define USB_TYPEC_NVIDIA_VLINK_SID 0x955
13#define USB_TYPEC_DP_MODE 1
14
15
16
17
18
19
20
21
22
23
24
25
26
27enum {
28 TYPEC_DP_STATE_A = TYPEC_STATE_MODAL,
29 TYPEC_DP_STATE_B,
30 TYPEC_DP_STATE_C,
31 TYPEC_DP_STATE_D,
32 TYPEC_DP_STATE_E,
33 TYPEC_DP_STATE_F,
34};
35
36
37
38
39
40
41
42
43
44
45
46
47struct typec_displayport_data {
48 u32 status;
49 u32 conf;
50};
51
52enum {
53 DP_PIN_ASSIGN_A,
54 DP_PIN_ASSIGN_B,
55 DP_PIN_ASSIGN_C,
56 DP_PIN_ASSIGN_D,
57 DP_PIN_ASSIGN_E,
58 DP_PIN_ASSIGN_F,
59};
60
61
62#define DP_CMD_STATUS_UPDATE VDO_CMD_VENDOR(0)
63#define DP_CMD_CONFIGURE VDO_CMD_VENDOR(1)
64
65
66#define DP_CAP_CAPABILITY(_cap_) ((_cap_) & 3)
67#define DP_CAP_UFP_D 1
68#define DP_CAP_DFP_D 2
69#define DP_CAP_DFP_D_AND_UFP_D 3
70#define DP_CAP_DP_SIGNALING BIT(2)
71#define DP_CAP_GEN2 BIT(3)
72#define DP_CAP_RECEPTACLE BIT(6)
73#define DP_CAP_USB BIT(7)
74#define DP_CAP_DFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(15, 8)) >> 8)
75#define DP_CAP_UFP_D_PIN_ASSIGN(_cap_) (((_cap_) & GENMASK(23, 16)) >> 16)
76
77
78#define DP_STATUS_CONNECTION(_status_) ((_status_) & 3)
79#define DP_STATUS_CON_DISABLED 0
80#define DP_STATUS_CON_DFP_D 1
81#define DP_STATUS_CON_UFP_D 2
82#define DP_STATUS_CON_BOTH 3
83#define DP_STATUS_POWER_LOW BIT(2)
84#define DP_STATUS_ENABLED BIT(3)
85#define DP_STATUS_PREFER_MULTI_FUNC BIT(4)
86#define DP_STATUS_SWITCH_TO_USB BIT(5)
87#define DP_STATUS_EXIT_DP_MODE BIT(6)
88#define DP_STATUS_HPD_STATE BIT(7)
89#define DP_STATUS_IRQ_HPD BIT(8)
90
91
92#define DP_CONF_CURRENTLY(_conf_) ((_conf_) & 3)
93#define DP_CONF_UFP_U_AS_DFP_D BIT(0)
94#define DP_CONF_UFP_U_AS_UFP_D BIT(1)
95#define DP_CONF_SIGNALING_DP BIT(2)
96#define DP_CONF_SIGNALING_GEN_2 BIT(3)
97#define DP_CONF_PIN_ASSIGNEMENT_SHIFT 8
98#define DP_CONF_PIN_ASSIGNEMENT_MASK GENMASK(15, 8)
99
100
101#define DP_CONF_SET_PIN_ASSIGN(_a_) ((_a_) << 8)
102#define DP_CONF_GET_PIN_ASSIGN(_conf_) (((_conf_) & GENMASK(15, 8)) >> 8)
103
104#endif
105