2 * Copyright 2012-15 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
26 #ifndef __DC_LINK_ENCODER__DCN10_H__
27 #define __DC_LINK_ENCODER__DCN10_H__
29 #include "link_encoder.h"
31 #define TO_DCN10_LINK_ENC(link_encoder)\
32 container_of(link_encoder, struct dcn10_link_encoder, base)
34 #define AUX_REG_LIST(id)\
35 SRI(AUX_CONTROL, DP_AUX, id), \
36 SRI(AUX_DPHY_RX_CONTROL0, DP_AUX, id), \
37 SRI(AUX_DPHY_RX_CONTROL1, DP_AUX, id)
39 #define HPD_REG_LIST(id)\
40 SRI(DC_HPD_CONTROL, HPD, id)
42 #define LE_DCN_COMMON_REG_LIST(id) \
43 SRI(DIG_BE_CNTL, DIG, id), \
44 SRI(DIG_BE_EN_CNTL, DIG, id), \
45 SRI(TMDS_CTL_BITS, DIG, id), \
46 SRI(DP_CONFIG, DP, id), \
47 SRI(DP_DPHY_CNTL, DP, id), \
48 SRI(DP_DPHY_PRBS_CNTL, DP, id), \
49 SRI(DP_DPHY_SCRAM_CNTL, DP, id),\
50 SRI(DP_DPHY_SYM0, DP, id), \
51 SRI(DP_DPHY_SYM1, DP, id), \
52 SRI(DP_DPHY_SYM2, DP, id), \
53 SRI(DP_DPHY_TRAINING_PATTERN_SEL, DP, id), \
54 SRI(DP_LINK_CNTL, DP, id), \
55 SRI(DP_LINK_FRAMING_CNTL, DP, id), \
56 SRI(DP_MSE_SAT0, DP, id), \
57 SRI(DP_MSE_SAT1, DP, id), \
58 SRI(DP_MSE_SAT2, DP, id), \
59 SRI(DP_MSE_SAT_UPDATE, DP, id), \
60 SRI(DP_SEC_CNTL, DP, id), \
61 SRI(DP_VID_STREAM_CNTL, DP, id), \
62 SRI(DP_DPHY_FAST_TRAINING, DP, id), \
63 SRI(DP_SEC_CNTL1, DP, id), \
64 SRI(DP_DPHY_BS_SR_SWAP_CNTL, DP, id), \
65 SRI(DP_DPHY_HBR2_PATTERN_CONTROL, DP, id)
68 #define LE_DCN10_REG_LIST(id)\
69 SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \
70 LE_DCN_COMMON_REG_LIST(id)
72 struct dcn10_link_enc_aux_registers
{
74 uint32_t AUX_DPHY_RX_CONTROL0
;
75 uint32_t AUX_DPHY_TX_CONTROL
;
76 uint32_t AUX_DPHY_RX_CONTROL1
;
79 struct dcn10_link_enc_hpd_registers
{
80 uint32_t DC_HPD_CONTROL
;
83 struct dcn10_link_enc_registers
{
85 uint32_t DIG_BE_EN_CNTL
;
87 uint32_t DP_DPHY_CNTL
;
88 uint32_t DP_DPHY_INTERNAL_CTRL
;
89 uint32_t DP_DPHY_PRBS_CNTL
;
90 uint32_t DP_DPHY_SCRAM_CNTL
;
91 uint32_t DP_DPHY_SYM0
;
92 uint32_t DP_DPHY_SYM1
;
93 uint32_t DP_DPHY_SYM2
;
94 uint32_t DP_DPHY_TRAINING_PATTERN_SEL
;
95 uint32_t DP_LINK_CNTL
;
96 uint32_t DP_LINK_FRAMING_CNTL
;
100 uint32_t DP_MSE_SAT_UPDATE
;
101 uint32_t DP_SEC_CNTL
;
102 uint32_t DP_VID_STREAM_CNTL
;
103 uint32_t DP_DPHY_FAST_TRAINING
;
104 uint32_t DP_DPHY_BS_SR_SWAP_CNTL
;
105 uint32_t DP_DPHY_HBR2_PATTERN_CONTROL
;
106 uint32_t DP_SEC_CNTL1
;
107 uint32_t TMDS_CTL_BITS
;
109 uint32_t CLOCK_ENABLE
;
111 uint32_t DIG_LANE_ENABLE
;
113 uint32_t CHANNEL_XBAR_CNTL
;
115 uint32_t RDPCSTX_PHY_CNTL3
;
116 uint32_t RDPCSTX_PHY_CNTL4
;
117 uint32_t RDPCSTX_PHY_CNTL5
;
118 uint32_t RDPCSTX_PHY_CNTL6
;
119 uint32_t RDPCSTX_PHY_CNTL7
;
120 uint32_t RDPCSTX_PHY_CNTL8
;
121 uint32_t RDPCSTX_PHY_CNTL9
;
122 uint32_t RDPCSTX_PHY_CNTL10
;
123 uint32_t RDPCSTX_PHY_CNTL11
;
124 uint32_t RDPCSTX_PHY_CNTL12
;
125 uint32_t RDPCSTX_PHY_CNTL13
;
126 uint32_t RDPCSTX_PHY_CNTL14
;
127 uint32_t RDPCSTX_PHY_CNTL15
;
128 uint32_t RDPCSTX_CNTL
;
129 uint32_t RDPCSTX_CLOCK_CNTL
;
130 uint32_t RDPCSTX_PHY_CNTL0
;
131 uint32_t RDPCSTX_PHY_CNTL2
;
132 uint32_t RDPCSTX_PLL_UPDATE_DATA
;
133 uint32_t RDPCS_TX_CR_ADDR
;
134 uint32_t RDPCS_TX_CR_DATA
;
135 uint32_t DPCSTX_TX_CLOCK_CNTL
;
136 uint32_t DPCSTX_TX_CNTL
;
137 uint32_t RDPCSTX_INTERRUPT_CONTROL
;
138 uint32_t RDPCSTX_PHY_FUSE0
;
139 uint32_t RDPCSTX_PHY_FUSE1
;
140 uint32_t RDPCSTX_PHY_FUSE2
;
141 uint32_t RDPCSTX_PHY_FUSE3
;
142 uint32_t RDPCSTX_PHY_RX_LD_VAL
;
143 uint32_t DPCSTX_DEBUG_CONFIG
;
144 uint32_t RDPCSTX_DEBUG_CONFIG
;
145 uint32_t RDPCSTX0_RDPCSTX_SCRATCH
;
146 uint32_t RDPCSTX_DMCU_DPALT_DIS_BLOCK_REG
;
147 uint32_t DCIO_SOFT_RESET
;
148 /* indirect registers */
149 uint32_t RAWLANE0_DIG_PCS_XF_RX_OVRD_IN_2
;
150 uint32_t RAWLANE0_DIG_PCS_XF_RX_OVRD_IN_3
;
151 uint32_t RAWLANE1_DIG_PCS_XF_RX_OVRD_IN_2
;
152 uint32_t RAWLANE1_DIG_PCS_XF_RX_OVRD_IN_3
;
153 uint32_t RAWLANE2_DIG_PCS_XF_RX_OVRD_IN_2
;
154 uint32_t RAWLANE2_DIG_PCS_XF_RX_OVRD_IN_3
;
155 uint32_t RAWLANE3_DIG_PCS_XF_RX_OVRD_IN_2
;
156 uint32_t RAWLANE3_DIG_PCS_XF_RX_OVRD_IN_3
;
157 uint32_t TMDS_DCBALANCER_CONTROL
;
158 uint32_t PHYA_LINK_CNTL2
;
159 uint32_t PHYB_LINK_CNTL2
;
160 uint32_t PHYC_LINK_CNTL2
;
163 #define LE_SF(reg_name, field_name, post_fix)\
164 .field_name = reg_name ## __ ## field_name ## post_fix
166 #define LINK_ENCODER_MASK_SH_LIST_DCN10(mask_sh)\
167 LE_SF(DIG0_DIG_BE_EN_CNTL, DIG_ENABLE, mask_sh),\
168 LE_SF(DIG0_DIG_BE_CNTL, DIG_HPD_SELECT, mask_sh),\
169 LE_SF(DIG0_DIG_BE_CNTL, DIG_MODE, mask_sh),\
170 LE_SF(DIG0_DIG_BE_CNTL, DIG_FE_SOURCE_SELECT, mask_sh),\
171 LE_SF(DIG0_TMDS_CTL_BITS, TMDS_CTL0, mask_sh), \
172 LE_SF(DP0_DP_DPHY_CNTL, DPHY_BYPASS, mask_sh),\
173 LE_SF(DP0_DP_DPHY_CNTL, DPHY_ATEST_SEL_LANE0, mask_sh),\
174 LE_SF(DP0_DP_DPHY_CNTL, DPHY_ATEST_SEL_LANE1, mask_sh),\
175 LE_SF(DP0_DP_DPHY_CNTL, DPHY_ATEST_SEL_LANE2, mask_sh),\
176 LE_SF(DP0_DP_DPHY_CNTL, DPHY_ATEST_SEL_LANE3, mask_sh),\
177 LE_SF(DP0_DP_DPHY_PRBS_CNTL, DPHY_PRBS_EN, mask_sh),\
178 LE_SF(DP0_DP_DPHY_PRBS_CNTL, DPHY_PRBS_SEL, mask_sh),\
179 LE_SF(DP0_DP_DPHY_SYM0, DPHY_SYM1, mask_sh),\
180 LE_SF(DP0_DP_DPHY_SYM0, DPHY_SYM2, mask_sh),\
181 LE_SF(DP0_DP_DPHY_SYM0, DPHY_SYM3, mask_sh),\
182 LE_SF(DP0_DP_DPHY_SYM1, DPHY_SYM4, mask_sh),\
183 LE_SF(DP0_DP_DPHY_SYM1, DPHY_SYM5, mask_sh),\
184 LE_SF(DP0_DP_DPHY_SYM1, DPHY_SYM6, mask_sh),\
185 LE_SF(DP0_DP_DPHY_SYM2, DPHY_SYM7, mask_sh),\
186 LE_SF(DP0_DP_DPHY_SYM2, DPHY_SYM8, mask_sh),\
187 LE_SF(DP0_DP_DPHY_SCRAM_CNTL, DPHY_SCRAMBLER_BS_COUNT, mask_sh),\
188 LE_SF(DP0_DP_DPHY_SCRAM_CNTL, DPHY_SCRAMBLER_ADVANCE, mask_sh),\
189 LE_SF(DP0_DP_DPHY_FAST_TRAINING, DPHY_RX_FAST_TRAINING_CAPABLE, mask_sh),\
190 LE_SF(DP0_DP_DPHY_BS_SR_SWAP_CNTL, DPHY_LOAD_BS_COUNT, mask_sh),\
191 LE_SF(DP0_DP_DPHY_TRAINING_PATTERN_SEL, DPHY_TRAINING_PATTERN_SEL, mask_sh),\
192 LE_SF(DP0_DP_DPHY_HBR2_PATTERN_CONTROL, DP_DPHY_HBR2_PATTERN_CONTROL, mask_sh),\
193 LE_SF(DP0_DP_LINK_CNTL, DP_LINK_TRAINING_COMPLETE, mask_sh),\
194 LE_SF(DP0_DP_LINK_FRAMING_CNTL, DP_IDLE_BS_INTERVAL, mask_sh),\
195 LE_SF(DP0_DP_LINK_FRAMING_CNTL, DP_VBID_DISABLE, mask_sh),\
196 LE_SF(DP0_DP_LINK_FRAMING_CNTL, DP_VID_ENHANCED_FRAME_MODE, mask_sh),\
197 LE_SF(DP0_DP_VID_STREAM_CNTL, DP_VID_STREAM_ENABLE, mask_sh),\
198 LE_SF(DP0_DP_CONFIG, DP_UDI_LANES, mask_sh),\
199 LE_SF(DP0_DP_SEC_CNTL1, DP_SEC_GSP0_LINE_NUM, mask_sh),\
200 LE_SF(DP0_DP_SEC_CNTL1, DP_SEC_GSP0_PRIORITY, mask_sh),\
201 LE_SF(DP0_DP_MSE_SAT0, DP_MSE_SAT_SRC0, mask_sh),\
202 LE_SF(DP0_DP_MSE_SAT0, DP_MSE_SAT_SRC1, mask_sh),\
203 LE_SF(DP0_DP_MSE_SAT0, DP_MSE_SAT_SLOT_COUNT0, mask_sh),\
204 LE_SF(DP0_DP_MSE_SAT0, DP_MSE_SAT_SLOT_COUNT1, mask_sh),\
205 LE_SF(DP0_DP_MSE_SAT1, DP_MSE_SAT_SRC2, mask_sh),\
206 LE_SF(DP0_DP_MSE_SAT1, DP_MSE_SAT_SRC3, mask_sh),\
207 LE_SF(DP0_DP_MSE_SAT1, DP_MSE_SAT_SLOT_COUNT2, mask_sh),\
208 LE_SF(DP0_DP_MSE_SAT1, DP_MSE_SAT_SLOT_COUNT3, mask_sh),\
209 LE_SF(DP0_DP_MSE_SAT_UPDATE, DP_MSE_SAT_UPDATE, mask_sh),\
210 LE_SF(DP0_DP_MSE_SAT_UPDATE, DP_MSE_16_MTP_KEEPOUT, mask_sh),\
211 LE_SF(DP_AUX0_AUX_CONTROL, AUX_HPD_SEL, mask_sh),\
212 LE_SF(DP_AUX0_AUX_CONTROL, AUX_LS_READ_EN, mask_sh),\
213 LE_SF(DP_AUX0_AUX_DPHY_RX_CONTROL0, AUX_RX_RECEIVE_WINDOW, mask_sh),\
214 LE_SF(HPD0_DC_HPD_CONTROL, DC_HPD_EN, mask_sh)
216 #define DCN_LINK_ENCODER_REG_FIELD_LIST(type) \
218 type DIG_HPD_SELECT;\
220 type DIG_FE_SOURCE_SELECT;\
222 type DPHY_ATEST_SEL_LANE0;\
223 type DPHY_ATEST_SEL_LANE1;\
224 type DPHY_ATEST_SEL_LANE2;\
225 type DPHY_ATEST_SEL_LANE3;\
236 type DPHY_SCRAMBLER_BS_COUNT;\
237 type DPHY_SCRAMBLER_ADVANCE;\
238 type DPHY_RX_FAST_TRAINING_CAPABLE;\
239 type DPHY_LOAD_BS_COUNT;\
240 type DPHY_TRAINING_PATTERN_SEL;\
241 type DP_DPHY_HBR2_PATTERN_CONTROL;\
242 type DP_LINK_TRAINING_COMPLETE;\
243 type DP_IDLE_BS_INTERVAL;\
244 type DP_VBID_DISABLE;\
245 type DP_VID_ENHANCED_FRAME_MODE;\
246 type DP_VID_STREAM_ENABLE;\
248 type DP_SEC_GSP0_LINE_NUM;\
249 type DP_SEC_GSP0_PRIORITY;\
250 type DP_MSE_SAT_SRC0;\
251 type DP_MSE_SAT_SRC1;\
252 type DP_MSE_SAT_SRC2;\
253 type DP_MSE_SAT_SRC3;\
254 type DP_MSE_SAT_SLOT_COUNT0;\
255 type DP_MSE_SAT_SLOT_COUNT1;\
256 type DP_MSE_SAT_SLOT_COUNT2;\
257 type DP_MSE_SAT_SLOT_COUNT3;\
258 type DP_MSE_SAT_UPDATE;\
259 type DP_MSE_16_MTP_KEEPOUT;\
263 type AUX_LS_READ_EN;\
264 type AUX_RX_RECEIVE_WINDOW
267 #define DCN20_LINK_ENCODER_DPCS_REG_FIELD_LIST(type) \
268 type RDPCS_PHY_DP_TX0_DATA_EN;\
269 type RDPCS_PHY_DP_TX1_DATA_EN;\
270 type RDPCS_PHY_DP_TX2_DATA_EN;\
271 type RDPCS_PHY_DP_TX3_DATA_EN;\
272 type RDPCS_PHY_DP_TX0_PSTATE;\
273 type RDPCS_PHY_DP_TX1_PSTATE;\
274 type RDPCS_PHY_DP_TX2_PSTATE;\
275 type RDPCS_PHY_DP_TX3_PSTATE;\
276 type RDPCS_PHY_DP_TX0_MPLL_EN;\
277 type RDPCS_PHY_DP_TX1_MPLL_EN;\
278 type RDPCS_PHY_DP_TX2_MPLL_EN;\
279 type RDPCS_PHY_DP_TX3_MPLL_EN;\
280 type RDPCS_TX_FIFO_LANE0_EN;\
281 type RDPCS_TX_FIFO_LANE1_EN;\
282 type RDPCS_TX_FIFO_LANE2_EN;\
283 type RDPCS_TX_FIFO_LANE3_EN;\
284 type RDPCS_EXT_REFCLK_EN;\
285 type RDPCS_TX_FIFO_EN;\
286 type UNIPHY_LINK_ENABLE;\
287 type UNIPHY_CHANNEL0_XBAR_SOURCE;\
288 type UNIPHY_CHANNEL1_XBAR_SOURCE;\
289 type UNIPHY_CHANNEL2_XBAR_SOURCE;\
290 type UNIPHY_CHANNEL3_XBAR_SOURCE;\
291 type UNIPHY_CHANNEL0_INVERT;\
292 type UNIPHY_CHANNEL1_INVERT;\
293 type UNIPHY_CHANNEL2_INVERT;\
294 type UNIPHY_CHANNEL3_INVERT;\
295 type UNIPHY_LINK_ENABLE_HPD_MASK;\
296 type UNIPHY_LANE_STAGGER_DELAY;\
297 type RDPCS_SRAMCLK_BYPASS;\
298 type RDPCS_SRAMCLK_EN;\
299 type RDPCS_SRAMCLK_CLOCK_ON;\
300 type DPCS_TX_FIFO_EN;\
301 type RDPCS_PHY_DP_TX0_DISABLE;\
302 type RDPCS_PHY_DP_TX1_DISABLE;\
303 type RDPCS_PHY_DP_TX2_DISABLE;\
304 type RDPCS_PHY_DP_TX3_DISABLE;\
305 type RDPCS_PHY_DP_TX0_CLK_RDY;\
306 type RDPCS_PHY_DP_TX1_CLK_RDY;\
307 type RDPCS_PHY_DP_TX2_CLK_RDY;\
308 type RDPCS_PHY_DP_TX3_CLK_RDY;\
309 type RDPCS_PHY_DP_TX0_REQ;\
310 type RDPCS_PHY_DP_TX1_REQ;\
311 type RDPCS_PHY_DP_TX2_REQ;\
312 type RDPCS_PHY_DP_TX3_REQ;\
313 type RDPCS_PHY_DP_TX0_ACK;\
314 type RDPCS_PHY_DP_TX1_ACK;\
315 type RDPCS_PHY_DP_TX2_ACK;\
316 type RDPCS_PHY_DP_TX3_ACK;\
317 type RDPCS_PHY_DP_TX0_RESET;\
318 type RDPCS_PHY_DP_TX1_RESET;\
319 type RDPCS_PHY_DP_TX2_RESET;\
320 type RDPCS_PHY_DP_TX3_RESET;\
321 type RDPCS_PHY_RESET;\
322 type RDPCS_PHY_CR_MUX_SEL;\
323 type RDPCS_PHY_REF_RANGE;\
324 type RDPCS_PHY_DP4_POR;\
325 type RDPCS_SRAM_BYPASS;\
326 type RDPCS_SRAM_EXT_LD_DONE;\
327 type RDPCS_PHY_DP_TX0_TERM_CTRL;\
328 type RDPCS_PHY_DP_TX1_TERM_CTRL;\
329 type RDPCS_PHY_DP_TX2_TERM_CTRL;\
330 type RDPCS_PHY_DP_TX3_TERM_CTRL;\
331 type RDPCS_PHY_DP_REF_CLK_MPLLB_DIV;\
332 type RDPCS_PHY_DP_MPLLB_MULTIPLIER;\
333 type RDPCS_PHY_DP_MPLLB_SSC_EN;\
334 type RDPCS_PHY_DP_MPLLB_DIV5_CLK_EN;\
335 type RDPCS_PHY_DP_MPLLB_TX_CLK_DIV;\
336 type RDPCS_PHY_DP_MPLLB_WORD_DIV2_EN;\
337 type RDPCS_PHY_DP_MPLLB_FRACN_EN;\
338 type RDPCS_PHY_DP_MPLLB_PMIX_EN;\
339 type RDPCS_PHY_DP_MPLLB_FRACN_QUOT;\
340 type RDPCS_PHY_DP_MPLLB_FRACN_DEN;\
341 type RDPCS_PHY_DP_MPLLB_FRACN_REM;\
342 type RDPCS_PHY_DP_MPLLB_SSC_UP_SPREAD;\
343 type RDPCS_PHY_DP_MPLLB_SSC_STEPSIZE;\
344 type RDPCS_PHY_DP_MPLLB_SSC_PEAK;\
345 type RDPCS_PHY_DP_MPLLB_DIV_CLK_EN;\
346 type RDPCS_PHY_DP_MPLLB_DIV_MULTIPLIER;\
347 type RDPCS_PHY_TX_VBOOST_LVL;\
348 type RDPCS_PHY_HDMIMODE_ENABLE;\
349 type RDPCS_PHY_DP_REF_CLK_EN;\
350 type RDPCS_PLL_UPDATE_DATA;\
351 type RDPCS_SRAM_INIT_DONE;\
352 type RDPCS_TX_CR_ADDR;\
353 type RDPCS_TX_CR_DATA;\
354 type RDPCS_PHY_HDMI_MPLLB_HDMI_DIV;\
355 type RDPCS_PHY_DP_MPLLB_STATE;\
356 type RDPCS_PHY_DP_TX0_WIDTH;\
357 type RDPCS_PHY_DP_TX0_RATE;\
358 type RDPCS_PHY_DP_TX1_WIDTH;\
359 type RDPCS_PHY_DP_TX1_RATE;\
360 type RDPCS_PHY_DP_TX2_WIDTH;\
361 type RDPCS_PHY_DP_TX2_RATE;\
362 type RDPCS_PHY_DP_TX3_WIDTH;\
363 type RDPCS_PHY_DP_TX3_RATE;\
364 type DPCS_SYMCLK_CLOCK_ON;\
365 type DPCS_SYMCLK_GATE_DIS;\
366 type DPCS_SYMCLK_EN;\
367 type RDPCS_SYMCLK_DIV2_CLOCK_ON;\
368 type RDPCS_SYMCLK_DIV2_GATE_DIS;\
369 type RDPCS_SYMCLK_DIV2_EN;\
370 type DPCS_TX_DATA_SWAP;\
371 type DPCS_TX_DATA_ORDER_INVERT;\
372 type DPCS_TX_FIFO_RD_START_DELAY;\
373 type RDPCS_TX_FIFO_RD_START_DELAY;\
374 type RDPCS_REG_FIFO_ERROR_MASK;\
375 type RDPCS_TX_FIFO_ERROR_MASK;\
376 type RDPCS_DPALT_DISABLE_TOGGLE_MASK;\
377 type RDPCS_DPALT_4LANE_TOGGLE_MASK;\
378 type RDPCS_PHY_DPALT_DP4;\
379 type RDPCS_PHY_DPALT_DISABLE;\
380 type RDPCS_PHY_DPALT_DISABLE_ACK;\
381 type RDPCS_PHY_DP_MPLLB_V2I;\
382 type RDPCS_PHY_DP_MPLLB_FREQ_VCO;\
383 type RDPCS_PHY_DP_MPLLB_CP_INT_GS;\
384 type RDPCS_PHY_RX_VREF_CTRL;\
385 type RDPCS_PHY_DP_MPLLB_CP_INT;\
386 type RDPCS_PHY_DP_MPLLB_CP_PROP;\
387 type RDPCS_PHY_RX_REF_LD_VAL;\
388 type RDPCS_PHY_RX_VCO_LD_VAL;\
389 type DPCSTX_DEBUG_CONFIG; \
390 type RDPCSTX_DEBUG_CONFIG; \
391 type RDPCS_PHY_DP_TX0_EQ_MAIN;\
392 type RDPCS_PHY_DP_TX0_EQ_PRE;\
393 type RDPCS_PHY_DP_TX0_EQ_POST;\
394 type RDPCS_PHY_DP_TX1_EQ_MAIN;\
395 type RDPCS_PHY_DP_TX1_EQ_PRE;\
396 type RDPCS_PHY_DP_TX1_EQ_POST;\
397 type RDPCS_PHY_DP_TX2_EQ_MAIN;\
398 type RDPCS_PHY_DP_MPLLB_CP_PROP_GS;\
399 type RDPCS_PHY_DP_TX2_EQ_PRE;\
400 type RDPCS_PHY_DP_TX2_EQ_POST;\
401 type RDPCS_PHY_DP_TX3_EQ_MAIN;\
402 type RDPCS_PHY_DCO_RANGE;\
403 type RDPCS_PHY_DCO_FINETUNE;\
404 type RDPCS_PHY_DP_TX3_EQ_PRE;\
405 type RDPCS_PHY_DP_TX3_EQ_POST;\
406 type RDPCS_PHY_SUP_PRE_HP;\
407 type RDPCS_PHY_DP_TX0_VREGDRV_BYP;\
408 type RDPCS_PHY_DP_TX1_VREGDRV_BYP;\
409 type RDPCS_PHY_DP_TX2_VREGDRV_BYP;\
410 type RDPCS_PHY_DP_TX3_VREGDRV_BYP;\
411 type RDPCS_DMCU_DPALT_DIS_BLOCK_REG;\
412 type UNIPHYA_SOFT_RESET;\
413 type UNIPHYB_SOFT_RESET;\
414 type UNIPHYC_SOFT_RESET;\
415 type UNIPHYD_SOFT_RESET;\
416 type UNIPHYE_SOFT_RESET;\
417 type UNIPHYF_SOFT_RESET
419 #define DCN20_LINK_ENCODER_REG_FIELD_LIST(type) \
425 type SYMCLKA_CLOCK_ENABLE;\
427 type DPHY_FEC_READY_SHADOW;\
428 type DPHY_FEC_ACTIVE_STATUS;\
429 DCN20_LINK_ENCODER_DPCS_REG_FIELD_LIST(type);\
430 type VCO_LD_VAL_OVRD;\
431 type VCO_LD_VAL_OVRD_EN;\
432 type REF_LD_VAL_OVRD;\
433 type REF_LD_VAL_OVRD_EN;\
434 type AUX_RX_START_WINDOW; \
435 type AUX_RX_HALF_SYM_DETECT_LEN; \
436 type AUX_RX_TRANSITION_FILTER_EN; \
437 type AUX_RX_ALLOW_BELOW_THRESHOLD_PHASE_DETECT; \
438 type AUX_RX_ALLOW_BELOW_THRESHOLD_START; \
439 type AUX_RX_ALLOW_BELOW_THRESHOLD_STOP; \
440 type AUX_RX_PHASE_DETECT_LEN; \
441 type AUX_RX_DETECTION_THRESHOLD; \
442 type AUX_TX_PRECHARGE_LEN; \
443 type AUX_TX_PRECHARGE_SYMBOLS; \
444 type AUX_MODE_DET_CHECK_DELAY;\
445 type DPCS_DBG_CBUS_DIS;\
446 type AUX_RX_PRECHARGE_SKIP;\
447 type AUX_RX_TIMEOUT_LEN;\
448 type AUX_RX_TIMEOUT_LEN_MUL
450 #define DCN30_LINK_ENCODER_REG_FIELD_LIST(type) \
451 type TMDS_SYNC_DCBAL_EN;\
452 type PHY_HPO_DIG_SRC_SEL;\
453 type PHY_HPO_ENC_SRC_SEL;\
454 type DPCS_TX_HDMI_FRL_MODE;\
455 type DPCS_TX_DATA_SWAP_10_BIT;\
456 type DPCS_TX_DATA_ORDER_INVERT_18_BIT;\
459 struct dcn10_link_enc_shift
{
460 DCN_LINK_ENCODER_REG_FIELD_LIST(uint8_t);
461 DCN20_LINK_ENCODER_REG_FIELD_LIST(uint8_t);
462 DCN30_LINK_ENCODER_REG_FIELD_LIST(uint8_t);
465 struct dcn10_link_enc_mask
{
466 DCN_LINK_ENCODER_REG_FIELD_LIST(uint32_t);
467 DCN20_LINK_ENCODER_REG_FIELD_LIST(uint32_t);
468 DCN30_LINK_ENCODER_REG_FIELD_LIST(uint32_t);
471 struct dcn10_link_encoder
{
472 struct link_encoder base
;
473 const struct dcn10_link_enc_registers
*link_regs
;
474 const struct dcn10_link_enc_aux_registers
*aux_regs
;
475 const struct dcn10_link_enc_hpd_registers
*hpd_regs
;
476 const struct dcn10_link_enc_shift
*link_shift
;
477 const struct dcn10_link_enc_mask
*link_mask
;
481 void dcn10_link_encoder_construct(
482 struct dcn10_link_encoder
*enc10
,
483 const struct encoder_init_data
*init_data
,
484 const struct encoder_feature_support
*enc_features
,
485 const struct dcn10_link_enc_registers
*link_regs
,
486 const struct dcn10_link_enc_aux_registers
*aux_regs
,
487 const struct dcn10_link_enc_hpd_registers
*hpd_regs
,
488 const struct dcn10_link_enc_shift
*link_shift
,
489 const struct dcn10_link_enc_mask
*link_mask
);
491 bool dcn10_link_encoder_validate_dvi_output(
492 const struct dcn10_link_encoder
*enc10
,
493 enum signal_type connector_signal
,
494 enum signal_type signal
,
495 const struct dc_crtc_timing
*crtc_timing
);
497 bool dcn10_link_encoder_validate_rgb_output(
498 const struct dcn10_link_encoder
*enc10
,
499 const struct dc_crtc_timing
*crtc_timing
);
501 bool dcn10_link_encoder_validate_dp_output(
502 const struct dcn10_link_encoder
*enc10
,
503 const struct dc_crtc_timing
*crtc_timing
);
505 bool dcn10_link_encoder_validate_wireless_output(
506 const struct dcn10_link_encoder
*enc10
,
507 const struct dc_crtc_timing
*crtc_timing
);
509 bool dcn10_link_encoder_validate_output_with_stream(
510 struct link_encoder
*enc
,
511 const struct dc_stream_state
*stream
);
513 /****************** HW programming ************************/
515 /* initialize HW */ /* why do we initialze aux in here? */
516 void dcn10_link_encoder_hw_init(struct link_encoder
*enc
);
518 void dcn10_link_encoder_destroy(struct link_encoder
**enc
);
520 /* program DIG_MODE in DIG_BE */
521 /* TODO can this be combined with enable_output? */
522 void dcn10_link_encoder_setup(
523 struct link_encoder
*enc
,
524 enum signal_type signal
);
526 void enc1_configure_encoder(
527 struct dcn10_link_encoder
*enc10
,
528 const struct dc_link_settings
*link_settings
);
530 /* enables TMDS PHY output */
531 /* TODO: still need depth or just pass in adjusted pixel clock? */
532 void dcn10_link_encoder_enable_tmds_output(
533 struct link_encoder
*enc
,
534 enum clock_source_id clock_source
,
535 enum dc_color_depth color_depth
,
536 enum signal_type signal
,
537 uint32_t pixel_clock
);
539 /* enables DP PHY output */
540 void dcn10_link_encoder_enable_dp_output(
541 struct link_encoder
*enc
,
542 const struct dc_link_settings
*link_settings
,
543 enum clock_source_id clock_source
);
545 /* enables DP PHY output in MST mode */
546 void dcn10_link_encoder_enable_dp_mst_output(
547 struct link_encoder
*enc
,
548 const struct dc_link_settings
*link_settings
,
549 enum clock_source_id clock_source
);
551 /* disable PHY output */
552 void dcn10_link_encoder_disable_output(
553 struct link_encoder
*enc
,
554 enum signal_type signal
);
556 /* set DP lane settings */
557 void dcn10_link_encoder_dp_set_lane_settings(
558 struct link_encoder
*enc
,
559 const struct link_training_settings
*link_settings
);
561 void dcn10_link_encoder_dp_set_phy_pattern(
562 struct link_encoder
*enc
,
563 const struct encoder_set_dp_phy_pattern_param
*param
);
565 /* programs DP MST VC payload allocation */
566 void dcn10_link_encoder_update_mst_stream_allocation_table(
567 struct link_encoder
*enc
,
568 const struct link_mst_stream_allocation_table
*table
);
570 void dcn10_link_encoder_connect_dig_be_to_fe(
571 struct link_encoder
*enc
,
572 enum engine_id engine
,
575 void dcn10_link_encoder_set_dp_phy_pattern_training_pattern(
576 struct link_encoder
*enc
,
579 void dcn10_link_encoder_enable_hpd(struct link_encoder
*enc
);
581 void dcn10_link_encoder_disable_hpd(struct link_encoder
*enc
);
583 void dcn10_psr_program_dp_dphy_fast_training(struct link_encoder
*enc
,
584 bool exit_link_training_required
);
586 void dcn10_psr_program_secondary_packet(struct link_encoder
*enc
,
587 unsigned int sdp_transmit_line_num_deadline
);
589 bool dcn10_is_dig_enabled(struct link_encoder
*enc
);
591 unsigned int dcn10_get_dig_frontend(struct link_encoder
*enc
);
593 void dcn10_aux_initialize(struct dcn10_link_encoder
*enc10
);
595 enum signal_type
dcn10_get_dig_mode(
596 struct link_encoder
*enc
);
598 void dcn10_link_encoder_get_max_link_cap(struct link_encoder
*enc
,
599 struct dc_link_settings
*link_settings
);
600 #endif /* __DC_LINK_ENCODER__DCN10_H__ */