1
2
3
4
5
6
7#ifndef DRM_TEGRA_DP_H
8#define DRM_TEGRA_DP_H 1
9
10#include <linux/types.h>
11
12struct drm_display_info;
13struct drm_display_mode;
14struct drm_dp_aux;
15struct drm_dp_link;
16
17
18
19
20struct drm_dp_link_caps {
21
22
23
24
25
26 bool enhanced_framing;
27
28
29
30
31
32
33 bool tps3_supported;
34
35
36
37
38
39
40 bool fast_training;
41
42
43
44
45
46
47 bool channel_coding;
48
49
50
51
52
53
54 bool alternate_scrambler_reset;
55};
56
57void drm_dp_link_caps_copy(struct drm_dp_link_caps *dest,
58 const struct drm_dp_link_caps *src);
59
60
61
62
63struct drm_dp_link_ops {
64
65
66
67 int (*apply_training)(struct drm_dp_link *link);
68
69
70
71
72 int (*configure)(struct drm_dp_link *link);
73};
74
75#define DP_TRAIN_VOLTAGE_SWING_LEVEL(x) ((x) << 0)
76#define DP_TRAIN_PRE_EMPHASIS_LEVEL(x) ((x) << 3)
77#define DP_LANE_POST_CURSOR(i, x) (((x) & 0x3) << (((i) & 1) << 2))
78
79
80
81
82
83
84
85struct drm_dp_link_train_set {
86 unsigned int voltage_swing[4];
87 unsigned int pre_emphasis[4];
88 unsigned int post_cursor[4];
89};
90
91
92
93
94
95
96
97
98
99struct drm_dp_link_train {
100 struct drm_dp_link_train_set request;
101 struct drm_dp_link_train_set adjust;
102
103 unsigned int pattern;
104
105 bool clock_recovered;
106 bool channel_equalized;
107};
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122struct drm_dp_link {
123 unsigned char revision;
124 unsigned int max_rate;
125 unsigned int max_lanes;
126
127 struct drm_dp_link_caps caps;
128
129
130
131
132
133 struct {
134 unsigned int cr;
135 unsigned int ce;
136 } aux_rd_interval;
137
138 unsigned char edp;
139
140 unsigned int rate;
141 unsigned int lanes;
142
143 unsigned long rates[DP_MAX_SUPPORTED_RATES];
144 unsigned int num_rates;
145
146
147
148
149 const struct drm_dp_link_ops *ops;
150
151
152
153
154 struct drm_dp_aux *aux;
155
156
157
158
159 struct drm_dp_link_train train;
160};
161
162int drm_dp_link_add_rate(struct drm_dp_link *link, unsigned long rate);
163int drm_dp_link_remove_rate(struct drm_dp_link *link, unsigned long rate);
164void drm_dp_link_update_rates(struct drm_dp_link *link);
165
166int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link);
167int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link);
168int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link);
169int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
170int drm_dp_link_choose(struct drm_dp_link *link,
171 const struct drm_display_mode *mode,
172 const struct drm_display_info *info);
173
174void drm_dp_link_train_init(struct drm_dp_link_train *train);
175int drm_dp_link_train(struct drm_dp_link *link);
176
177#endif
178