1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #ifndef DRM_DP_DUAL_MODE_HELPER_H
24 #define DRM_DP_DUAL_MODE_HELPER_H
25
26 #include <linux/types.h>
27
28
29
30
31
32 #define DP_DUAL_MODE_HDMI_ID 0x00
33 #define DP_DUAL_MODE_HDMI_ID_LEN 16
34
35
36
37
38 #define DP_DUAL_MODE_ADAPTOR_ID 0x10
39 #define DP_DUAL_MODE_REV_MASK 0x07
40 #define DP_DUAL_MODE_REV_TYPE2 0x00
41 #define DP_DUAL_MODE_TYPE_MASK 0xf0
42 #define DP_DUAL_MODE_TYPE_TYPE2 0xa0
43
44 #define DP_DUAL_MODE_TYPE_HAS_DPCD 0x08
45 #define DP_DUAL_MODE_IEEE_OUI 0x11
46 #define DP_DUAL_IEEE_OUI_LEN 3
47 #define DP_DUAL_DEVICE_ID 0x14
48 #define DP_DUAL_DEVICE_ID_LEN 6
49 #define DP_DUAL_MODE_HARDWARE_REV 0x1a
50 #define DP_DUAL_MODE_FIRMWARE_MAJOR_REV 0x1b
51 #define DP_DUAL_MODE_FIRMWARE_MINOR_REV 0x1c
52 #define DP_DUAL_MODE_MAX_TMDS_CLOCK 0x1d
53 #define DP_DUAL_MODE_I2C_SPEED_CAP 0x1e
54 #define DP_DUAL_MODE_TMDS_OEN 0x20
55 #define DP_DUAL_MODE_TMDS_DISABLE 0x01
56 #define DP_DUAL_MODE_HDMI_PIN_CTRL 0x21
57 #define DP_DUAL_MODE_CEC_ENABLE 0x01
58 #define DP_DUAL_MODE_I2C_SPEED_CTRL 0x22
59
60
61 #define DP_DUAL_MODE_LSPCON_MODE_CHANGE 0x40
62 #define DP_DUAL_MODE_LSPCON_CURRENT_MODE 0x41
63 #define DP_DUAL_MODE_LSPCON_MODE_PCON 0x1
64
65 struct i2c_adapter;
66
67 ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter,
68 u8 offset, void *buffer, size_t size);
69 ssize_t drm_dp_dual_mode_write(struct i2c_adapter *adapter,
70 u8 offset, const void *buffer, size_t size);
71
72
73
74
75
76
77
78
79
80 enum drm_lspcon_mode {
81 DRM_LSPCON_MODE_INVALID,
82 DRM_LSPCON_MODE_LS,
83 DRM_LSPCON_MODE_PCON,
84 };
85
86
87
88
89
90
91
92
93
94
95
96 enum drm_dp_dual_mode_type {
97 DRM_DP_DUAL_MODE_NONE,
98 DRM_DP_DUAL_MODE_UNKNOWN,
99 DRM_DP_DUAL_MODE_TYPE1_DVI,
100 DRM_DP_DUAL_MODE_TYPE1_HDMI,
101 DRM_DP_DUAL_MODE_TYPE2_DVI,
102 DRM_DP_DUAL_MODE_TYPE2_HDMI,
103 DRM_DP_DUAL_MODE_LSPCON,
104 };
105
106 enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct i2c_adapter *adapter);
107 int drm_dp_dual_mode_max_tmds_clock(enum drm_dp_dual_mode_type type,
108 struct i2c_adapter *adapter);
109 int drm_dp_dual_mode_get_tmds_output(enum drm_dp_dual_mode_type type,
110 struct i2c_adapter *adapter, bool *enabled);
111 int drm_dp_dual_mode_set_tmds_output(enum drm_dp_dual_mode_type type,
112 struct i2c_adapter *adapter, bool enable);
113 const char *drm_dp_get_dual_mode_type_name(enum drm_dp_dual_mode_type type);
114
115 int drm_lspcon_get_mode(struct i2c_adapter *adapter,
116 enum drm_lspcon_mode *current_mode);
117 int drm_lspcon_set_mode(struct i2c_adapter *adapter,
118 enum drm_lspcon_mode reqd_mode);
119 #endif