xref: /dflybsd-src/sys/dev/drm/amd/display/dc/dcn10/dcn10_link_encoder.h (revision b843c749addef9340ee7d4e250b09fdd492602a1)
1*b843c749SSergey Zigachev /*
2*b843c749SSergey Zigachev  * Copyright 2012-15 Advanced Micro Devices, Inc.
3*b843c749SSergey Zigachev  *
4*b843c749SSergey Zigachev  * Permission is hereby granted, free of charge, to any person obtaining a
5*b843c749SSergey Zigachev  * copy of this software and associated documentation files (the "Software"),
6*b843c749SSergey Zigachev  * to deal in the Software without restriction, including without limitation
7*b843c749SSergey Zigachev  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*b843c749SSergey Zigachev  *  and/or sell copies of the Software, and to permit persons to whom the
9*b843c749SSergey Zigachev  * Software is furnished to do so, subject to the following conditions:
10*b843c749SSergey Zigachev  *
11*b843c749SSergey Zigachev  * The above copyright notice and this permission notice shall be included in
12*b843c749SSergey Zigachev  * all copies or substantial portions of the Software.
13*b843c749SSergey Zigachev  *
14*b843c749SSergey Zigachev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*b843c749SSergey Zigachev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*b843c749SSergey Zigachev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*b843c749SSergey Zigachev  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*b843c749SSergey Zigachev  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*b843c749SSergey Zigachev  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*b843c749SSergey Zigachev  * OTHER DEALINGS IN THE SOFTWARE.
21*b843c749SSergey Zigachev  *
22*b843c749SSergey Zigachev  * Authors: AMD
23*b843c749SSergey Zigachev  *
24*b843c749SSergey Zigachev  */
25*b843c749SSergey Zigachev 
26*b843c749SSergey Zigachev #ifndef __DC_LINK_ENCODER__DCN10_H__
27*b843c749SSergey Zigachev #define __DC_LINK_ENCODER__DCN10_H__
28*b843c749SSergey Zigachev 
29*b843c749SSergey Zigachev #include "link_encoder.h"
30*b843c749SSergey Zigachev 
31*b843c749SSergey Zigachev #define TO_DCN10_LINK_ENC(link_encoder)\
32*b843c749SSergey Zigachev 	container_of(link_encoder, struct dcn10_link_encoder, base)
33*b843c749SSergey Zigachev 
34*b843c749SSergey Zigachev 
35*b843c749SSergey Zigachev #define AUX_REG_LIST(id)\
36*b843c749SSergey Zigachev 	SRI(AUX_CONTROL, DP_AUX, id), \
37*b843c749SSergey Zigachev 	SRI(AUX_DPHY_RX_CONTROL0, DP_AUX, id)
38*b843c749SSergey Zigachev 
39*b843c749SSergey Zigachev #define HPD_REG_LIST(id)\
40*b843c749SSergey Zigachev 	SRI(DC_HPD_CONTROL, HPD, id)
41*b843c749SSergey Zigachev 
42*b843c749SSergey Zigachev #define LE_DCN_COMMON_REG_LIST(id) \
43*b843c749SSergey Zigachev 	SRI(DIG_BE_CNTL, DIG, id), \
44*b843c749SSergey Zigachev 	SRI(DIG_BE_EN_CNTL, DIG, id), \
45*b843c749SSergey Zigachev 	SRI(TMDS_CTL_BITS, DIG, id), \
46*b843c749SSergey Zigachev 	SRI(DP_CONFIG, DP, id), \
47*b843c749SSergey Zigachev 	SRI(DP_DPHY_CNTL, DP, id), \
48*b843c749SSergey Zigachev 	SRI(DP_DPHY_PRBS_CNTL, DP, id), \
49*b843c749SSergey Zigachev 	SRI(DP_DPHY_SCRAM_CNTL, DP, id),\
50*b843c749SSergey Zigachev 	SRI(DP_DPHY_SYM0, DP, id), \
51*b843c749SSergey Zigachev 	SRI(DP_DPHY_SYM1, DP, id), \
52*b843c749SSergey Zigachev 	SRI(DP_DPHY_SYM2, DP, id), \
53*b843c749SSergey Zigachev 	SRI(DP_DPHY_TRAINING_PATTERN_SEL, DP, id), \
54*b843c749SSergey Zigachev 	SRI(DP_LINK_CNTL, DP, id), \
55*b843c749SSergey Zigachev 	SRI(DP_LINK_FRAMING_CNTL, DP, id), \
56*b843c749SSergey Zigachev 	SRI(DP_MSE_SAT0, DP, id), \
57*b843c749SSergey Zigachev 	SRI(DP_MSE_SAT1, DP, id), \
58*b843c749SSergey Zigachev 	SRI(DP_MSE_SAT2, DP, id), \
59*b843c749SSergey Zigachev 	SRI(DP_MSE_SAT_UPDATE, DP, id), \
60*b843c749SSergey Zigachev 	SRI(DP_SEC_CNTL, DP, id), \
61*b843c749SSergey Zigachev 	SRI(DP_VID_STREAM_CNTL, DP, id), \
62*b843c749SSergey Zigachev 	SRI(DP_DPHY_FAST_TRAINING, DP, id), \
63*b843c749SSergey Zigachev 	SRI(DP_SEC_CNTL1, DP, id), \
64*b843c749SSergey Zigachev 	SRI(DP_DPHY_BS_SR_SWAP_CNTL, DP, id), \
65*b843c749SSergey Zigachev 	SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \
66*b843c749SSergey Zigachev 	SRI(DP_DPHY_HBR2_PATTERN_CONTROL, DP, id)
67*b843c749SSergey Zigachev 
68*b843c749SSergey Zigachev 
69*b843c749SSergey Zigachev #define LE_DCN10_REG_LIST(id)\
70*b843c749SSergey Zigachev 	LE_DCN_COMMON_REG_LIST(id)
71*b843c749SSergey Zigachev 
72*b843c749SSergey Zigachev struct dcn10_link_enc_aux_registers {
73*b843c749SSergey Zigachev 	uint32_t AUX_CONTROL;
74*b843c749SSergey Zigachev 	uint32_t AUX_DPHY_RX_CONTROL0;
75*b843c749SSergey Zigachev };
76*b843c749SSergey Zigachev 
77*b843c749SSergey Zigachev struct dcn10_link_enc_hpd_registers {
78*b843c749SSergey Zigachev 	uint32_t DC_HPD_CONTROL;
79*b843c749SSergey Zigachev };
80*b843c749SSergey Zigachev 
81*b843c749SSergey Zigachev struct dcn10_link_enc_registers {
82*b843c749SSergey Zigachev 	uint32_t DIG_BE_CNTL;
83*b843c749SSergey Zigachev 	uint32_t DIG_BE_EN_CNTL;
84*b843c749SSergey Zigachev 	uint32_t DP_CONFIG;
85*b843c749SSergey Zigachev 	uint32_t DP_DPHY_CNTL;
86*b843c749SSergey Zigachev 	uint32_t DP_DPHY_INTERNAL_CTRL;
87*b843c749SSergey Zigachev 	uint32_t DP_DPHY_PRBS_CNTL;
88*b843c749SSergey Zigachev 	uint32_t DP_DPHY_SCRAM_CNTL;
89*b843c749SSergey Zigachev 	uint32_t DP_DPHY_SYM0;
90*b843c749SSergey Zigachev 	uint32_t DP_DPHY_SYM1;
91*b843c749SSergey Zigachev 	uint32_t DP_DPHY_SYM2;
92*b843c749SSergey Zigachev 	uint32_t DP_DPHY_TRAINING_PATTERN_SEL;
93*b843c749SSergey Zigachev 	uint32_t DP_LINK_CNTL;
94*b843c749SSergey Zigachev 	uint32_t DP_LINK_FRAMING_CNTL;
95*b843c749SSergey Zigachev 	uint32_t DP_MSE_SAT0;
96*b843c749SSergey Zigachev 	uint32_t DP_MSE_SAT1;
97*b843c749SSergey Zigachev 	uint32_t DP_MSE_SAT2;
98*b843c749SSergey Zigachev 	uint32_t DP_MSE_SAT_UPDATE;
99*b843c749SSergey Zigachev 	uint32_t DP_SEC_CNTL;
100*b843c749SSergey Zigachev 	uint32_t DP_VID_STREAM_CNTL;
101*b843c749SSergey Zigachev 	uint32_t DP_DPHY_FAST_TRAINING;
102*b843c749SSergey Zigachev 	uint32_t DP_DPHY_BS_SR_SWAP_CNTL;
103*b843c749SSergey Zigachev 	uint32_t DP_DPHY_HBR2_PATTERN_CONTROL;
104*b843c749SSergey Zigachev 	uint32_t DP_SEC_CNTL1;
105*b843c749SSergey Zigachev 	uint32_t TMDS_CTL_BITS;
106*b843c749SSergey Zigachev };
107*b843c749SSergey Zigachev 
108*b843c749SSergey Zigachev #define LE_SF(reg_name, field_name, post_fix)\
109*b843c749SSergey Zigachev 	.field_name = reg_name ## __ ## field_name ## post_fix
110*b843c749SSergey Zigachev 
111*b843c749SSergey Zigachev #define LINK_ENCODER_MASK_SH_LIST_DCN10(mask_sh)\
112*b843c749SSergey Zigachev 	LE_SF(DIG0_DIG_BE_EN_CNTL, DIG_ENABLE, mask_sh),\
113*b843c749SSergey Zigachev 	LE_SF(DIG0_DIG_BE_CNTL, DIG_HPD_SELECT, mask_sh),\
114*b843c749SSergey Zigachev 	LE_SF(DIG0_DIG_BE_CNTL, DIG_MODE, mask_sh),\
115*b843c749SSergey Zigachev 	LE_SF(DIG0_DIG_BE_CNTL, DIG_FE_SOURCE_SELECT, mask_sh),\
116*b843c749SSergey Zigachev 	LE_SF(DIG0_TMDS_CTL_BITS, TMDS_CTL0, mask_sh), \
117*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_CNTL, DPHY_BYPASS, mask_sh),\
118*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_CNTL, DPHY_ATEST_SEL_LANE0, mask_sh),\
119*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_CNTL, DPHY_ATEST_SEL_LANE1, mask_sh),\
120*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_CNTL, DPHY_ATEST_SEL_LANE2, mask_sh),\
121*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_CNTL, DPHY_ATEST_SEL_LANE3, mask_sh),\
122*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_PRBS_CNTL, DPHY_PRBS_EN, mask_sh),\
123*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_PRBS_CNTL, DPHY_PRBS_SEL, mask_sh),\
124*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_SYM0, DPHY_SYM1, mask_sh),\
125*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_SYM0, DPHY_SYM2, mask_sh),\
126*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_SYM0, DPHY_SYM3, mask_sh),\
127*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_SYM1, DPHY_SYM4, mask_sh),\
128*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_SYM1, DPHY_SYM5, mask_sh),\
129*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_SYM1, DPHY_SYM6, mask_sh),\
130*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_SYM2, DPHY_SYM7, mask_sh),\
131*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_SYM2, DPHY_SYM8, mask_sh),\
132*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_SCRAM_CNTL, DPHY_SCRAMBLER_BS_COUNT, mask_sh),\
133*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_SCRAM_CNTL, DPHY_SCRAMBLER_ADVANCE, mask_sh),\
134*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_FAST_TRAINING, DPHY_RX_FAST_TRAINING_CAPABLE, mask_sh),\
135*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_BS_SR_SWAP_CNTL, DPHY_LOAD_BS_COUNT, mask_sh),\
136*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_TRAINING_PATTERN_SEL, DPHY_TRAINING_PATTERN_SEL, mask_sh),\
137*b843c749SSergey Zigachev 	LE_SF(DP0_DP_DPHY_HBR2_PATTERN_CONTROL, DP_DPHY_HBR2_PATTERN_CONTROL, mask_sh),\
138*b843c749SSergey Zigachev 	LE_SF(DP0_DP_LINK_CNTL, DP_LINK_TRAINING_COMPLETE, mask_sh),\
139*b843c749SSergey Zigachev 	LE_SF(DP0_DP_LINK_FRAMING_CNTL, DP_IDLE_BS_INTERVAL, mask_sh),\
140*b843c749SSergey Zigachev 	LE_SF(DP0_DP_LINK_FRAMING_CNTL, DP_VBID_DISABLE, mask_sh),\
141*b843c749SSergey Zigachev 	LE_SF(DP0_DP_LINK_FRAMING_CNTL, DP_VID_ENHANCED_FRAME_MODE, mask_sh),\
142*b843c749SSergey Zigachev 	LE_SF(DP0_DP_VID_STREAM_CNTL, DP_VID_STREAM_ENABLE, mask_sh),\
143*b843c749SSergey Zigachev 	LE_SF(DP0_DP_CONFIG, DP_UDI_LANES, mask_sh),\
144*b843c749SSergey Zigachev 	LE_SF(DP0_DP_SEC_CNTL1, DP_SEC_GSP0_LINE_NUM, mask_sh),\
145*b843c749SSergey Zigachev 	LE_SF(DP0_DP_SEC_CNTL1, DP_SEC_GSP0_PRIORITY, mask_sh),\
146*b843c749SSergey Zigachev 	LE_SF(DP0_DP_MSE_SAT0, DP_MSE_SAT_SRC0, mask_sh),\
147*b843c749SSergey Zigachev 	LE_SF(DP0_DP_MSE_SAT0, DP_MSE_SAT_SRC1, mask_sh),\
148*b843c749SSergey Zigachev 	LE_SF(DP0_DP_MSE_SAT0, DP_MSE_SAT_SLOT_COUNT0, mask_sh),\
149*b843c749SSergey Zigachev 	LE_SF(DP0_DP_MSE_SAT0, DP_MSE_SAT_SLOT_COUNT1, mask_sh),\
150*b843c749SSergey Zigachev 	LE_SF(DP0_DP_MSE_SAT1, DP_MSE_SAT_SRC2, mask_sh),\
151*b843c749SSergey Zigachev 	LE_SF(DP0_DP_MSE_SAT1, DP_MSE_SAT_SRC3, mask_sh),\
152*b843c749SSergey Zigachev 	LE_SF(DP0_DP_MSE_SAT1, DP_MSE_SAT_SLOT_COUNT2, mask_sh),\
153*b843c749SSergey Zigachev 	LE_SF(DP0_DP_MSE_SAT1, DP_MSE_SAT_SLOT_COUNT3, mask_sh),\
154*b843c749SSergey Zigachev 	LE_SF(DP0_DP_MSE_SAT_UPDATE, DP_MSE_SAT_UPDATE, mask_sh),\
155*b843c749SSergey Zigachev 	LE_SF(DP0_DP_MSE_SAT_UPDATE, DP_MSE_16_MTP_KEEPOUT, mask_sh),\
156*b843c749SSergey Zigachev 	LE_SF(DP_AUX0_AUX_CONTROL, AUX_HPD_SEL, mask_sh),\
157*b843c749SSergey Zigachev 	LE_SF(DP_AUX0_AUX_CONTROL, AUX_LS_READ_EN, mask_sh),\
158*b843c749SSergey Zigachev 	LE_SF(DP_AUX0_AUX_DPHY_RX_CONTROL0, AUX_RX_RECEIVE_WINDOW, mask_sh),\
159*b843c749SSergey Zigachev 	LE_SF(HPD0_DC_HPD_CONTROL, DC_HPD_EN, mask_sh)
160*b843c749SSergey Zigachev 
161*b843c749SSergey Zigachev #define DCN_LINK_ENCODER_REG_FIELD_LIST(type) \
162*b843c749SSergey Zigachev 	type DIG_ENABLE;\
163*b843c749SSergey Zigachev 	type DIG_HPD_SELECT;\
164*b843c749SSergey Zigachev 	type DIG_MODE;\
165*b843c749SSergey Zigachev 	type DIG_FE_SOURCE_SELECT;\
166*b843c749SSergey Zigachev 	type DPHY_BYPASS;\
167*b843c749SSergey Zigachev 	type DPHY_ATEST_SEL_LANE0;\
168*b843c749SSergey Zigachev 	type DPHY_ATEST_SEL_LANE1;\
169*b843c749SSergey Zigachev 	type DPHY_ATEST_SEL_LANE2;\
170*b843c749SSergey Zigachev 	type DPHY_ATEST_SEL_LANE3;\
171*b843c749SSergey Zigachev 	type DPHY_PRBS_EN;\
172*b843c749SSergey Zigachev 	type DPHY_PRBS_SEL;\
173*b843c749SSergey Zigachev 	type DPHY_SYM1;\
174*b843c749SSergey Zigachev 	type DPHY_SYM2;\
175*b843c749SSergey Zigachev 	type DPHY_SYM3;\
176*b843c749SSergey Zigachev 	type DPHY_SYM4;\
177*b843c749SSergey Zigachev 	type DPHY_SYM5;\
178*b843c749SSergey Zigachev 	type DPHY_SYM6;\
179*b843c749SSergey Zigachev 	type DPHY_SYM7;\
180*b843c749SSergey Zigachev 	type DPHY_SYM8;\
181*b843c749SSergey Zigachev 	type DPHY_SCRAMBLER_BS_COUNT;\
182*b843c749SSergey Zigachev 	type DPHY_SCRAMBLER_ADVANCE;\
183*b843c749SSergey Zigachev 	type DPHY_RX_FAST_TRAINING_CAPABLE;\
184*b843c749SSergey Zigachev 	type DPHY_LOAD_BS_COUNT;\
185*b843c749SSergey Zigachev 	type DPHY_TRAINING_PATTERN_SEL;\
186*b843c749SSergey Zigachev 	type DP_DPHY_HBR2_PATTERN_CONTROL;\
187*b843c749SSergey Zigachev 	type DP_LINK_TRAINING_COMPLETE;\
188*b843c749SSergey Zigachev 	type DP_IDLE_BS_INTERVAL;\
189*b843c749SSergey Zigachev 	type DP_VBID_DISABLE;\
190*b843c749SSergey Zigachev 	type DP_VID_ENHANCED_FRAME_MODE;\
191*b843c749SSergey Zigachev 	type DP_VID_STREAM_ENABLE;\
192*b843c749SSergey Zigachev 	type DP_UDI_LANES;\
193*b843c749SSergey Zigachev 	type DP_SEC_GSP0_LINE_NUM;\
194*b843c749SSergey Zigachev 	type DP_SEC_GSP0_PRIORITY;\
195*b843c749SSergey Zigachev 	type DP_MSE_SAT_SRC0;\
196*b843c749SSergey Zigachev 	type DP_MSE_SAT_SRC1;\
197*b843c749SSergey Zigachev 	type DP_MSE_SAT_SRC2;\
198*b843c749SSergey Zigachev 	type DP_MSE_SAT_SRC3;\
199*b843c749SSergey Zigachev 	type DP_MSE_SAT_SLOT_COUNT0;\
200*b843c749SSergey Zigachev 	type DP_MSE_SAT_SLOT_COUNT1;\
201*b843c749SSergey Zigachev 	type DP_MSE_SAT_SLOT_COUNT2;\
202*b843c749SSergey Zigachev 	type DP_MSE_SAT_SLOT_COUNT3;\
203*b843c749SSergey Zigachev 	type DP_MSE_SAT_UPDATE;\
204*b843c749SSergey Zigachev 	type DP_MSE_16_MTP_KEEPOUT;\
205*b843c749SSergey Zigachev 	type DC_HPD_EN;\
206*b843c749SSergey Zigachev 	type TMDS_CTL0;\
207*b843c749SSergey Zigachev 	type AUX_HPD_SEL;\
208*b843c749SSergey Zigachev 	type AUX_LS_READ_EN;\
209*b843c749SSergey Zigachev 	type AUX_RX_RECEIVE_WINDOW
210*b843c749SSergey Zigachev 
211*b843c749SSergey Zigachev struct dcn10_link_enc_shift {
212*b843c749SSergey Zigachev 	DCN_LINK_ENCODER_REG_FIELD_LIST(uint8_t);
213*b843c749SSergey Zigachev };
214*b843c749SSergey Zigachev 
215*b843c749SSergey Zigachev struct dcn10_link_enc_mask {
216*b843c749SSergey Zigachev 	DCN_LINK_ENCODER_REG_FIELD_LIST(uint32_t);
217*b843c749SSergey Zigachev };
218*b843c749SSergey Zigachev 
219*b843c749SSergey Zigachev struct dcn10_link_encoder {
220*b843c749SSergey Zigachev 	struct link_encoder base;
221*b843c749SSergey Zigachev 	const struct dcn10_link_enc_registers *link_regs;
222*b843c749SSergey Zigachev 	const struct dcn10_link_enc_aux_registers *aux_regs;
223*b843c749SSergey Zigachev 	const struct dcn10_link_enc_hpd_registers *hpd_regs;
224*b843c749SSergey Zigachev 	const struct dcn10_link_enc_shift *link_shift;
225*b843c749SSergey Zigachev 	const struct dcn10_link_enc_mask *link_mask;
226*b843c749SSergey Zigachev };
227*b843c749SSergey Zigachev 
228*b843c749SSergey Zigachev 
229*b843c749SSergey Zigachev void dcn10_link_encoder_construct(
230*b843c749SSergey Zigachev 	struct dcn10_link_encoder *enc10,
231*b843c749SSergey Zigachev 	const struct encoder_init_data *init_data,
232*b843c749SSergey Zigachev 	const struct encoder_feature_support *enc_features,
233*b843c749SSergey Zigachev 	const struct dcn10_link_enc_registers *link_regs,
234*b843c749SSergey Zigachev 	const struct dcn10_link_enc_aux_registers *aux_regs,
235*b843c749SSergey Zigachev 	const struct dcn10_link_enc_hpd_registers *hpd_regs,
236*b843c749SSergey Zigachev 	const struct dcn10_link_enc_shift *link_shift,
237*b843c749SSergey Zigachev 	const struct dcn10_link_enc_mask *link_mask);
238*b843c749SSergey Zigachev 
239*b843c749SSergey Zigachev bool dcn10_link_encoder_validate_dvi_output(
240*b843c749SSergey Zigachev 	const struct dcn10_link_encoder *enc10,
241*b843c749SSergey Zigachev 	enum signal_type connector_signal,
242*b843c749SSergey Zigachev 	enum signal_type signal,
243*b843c749SSergey Zigachev 	const struct dc_crtc_timing *crtc_timing);
244*b843c749SSergey Zigachev 
245*b843c749SSergey Zigachev bool dcn10_link_encoder_validate_rgb_output(
246*b843c749SSergey Zigachev 	const struct dcn10_link_encoder *enc10,
247*b843c749SSergey Zigachev 	const struct dc_crtc_timing *crtc_timing);
248*b843c749SSergey Zigachev 
249*b843c749SSergey Zigachev bool dcn10_link_encoder_validate_dp_output(
250*b843c749SSergey Zigachev 	const struct dcn10_link_encoder *enc10,
251*b843c749SSergey Zigachev 	const struct dc_crtc_timing *crtc_timing);
252*b843c749SSergey Zigachev 
253*b843c749SSergey Zigachev bool dcn10_link_encoder_validate_wireless_output(
254*b843c749SSergey Zigachev 	const struct dcn10_link_encoder *enc10,
255*b843c749SSergey Zigachev 	const struct dc_crtc_timing *crtc_timing);
256*b843c749SSergey Zigachev 
257*b843c749SSergey Zigachev bool dcn10_link_encoder_validate_output_with_stream(
258*b843c749SSergey Zigachev 	struct link_encoder *enc,
259*b843c749SSergey Zigachev 	const struct dc_stream_state *stream);
260*b843c749SSergey Zigachev 
261*b843c749SSergey Zigachev /****************** HW programming ************************/
262*b843c749SSergey Zigachev 
263*b843c749SSergey Zigachev /* initialize HW */  /* why do we initialze aux in here? */
264*b843c749SSergey Zigachev void dcn10_link_encoder_hw_init(struct link_encoder *enc);
265*b843c749SSergey Zigachev 
266*b843c749SSergey Zigachev void dcn10_link_encoder_destroy(struct link_encoder **enc);
267*b843c749SSergey Zigachev 
268*b843c749SSergey Zigachev /* program DIG_MODE in DIG_BE */
269*b843c749SSergey Zigachev /* TODO can this be combined with enable_output? */
270*b843c749SSergey Zigachev void dcn10_link_encoder_setup(
271*b843c749SSergey Zigachev 	struct link_encoder *enc,
272*b843c749SSergey Zigachev 	enum signal_type signal);
273*b843c749SSergey Zigachev 
274*b843c749SSergey Zigachev void configure_encoder(
275*b843c749SSergey Zigachev 	struct dcn10_link_encoder *enc10,
276*b843c749SSergey Zigachev 	const struct dc_link_settings *link_settings);
277*b843c749SSergey Zigachev 
278*b843c749SSergey Zigachev /* enables TMDS PHY output */
279*b843c749SSergey Zigachev /* TODO: still need depth or just pass in adjusted pixel clock? */
280*b843c749SSergey Zigachev void dcn10_link_encoder_enable_tmds_output(
281*b843c749SSergey Zigachev 	struct link_encoder *enc,
282*b843c749SSergey Zigachev 	enum clock_source_id clock_source,
283*b843c749SSergey Zigachev 	enum dc_color_depth color_depth,
284*b843c749SSergey Zigachev 	enum signal_type signal,
285*b843c749SSergey Zigachev 	uint32_t pixel_clock);
286*b843c749SSergey Zigachev 
287*b843c749SSergey Zigachev /* enables DP PHY output */
288*b843c749SSergey Zigachev void dcn10_link_encoder_enable_dp_output(
289*b843c749SSergey Zigachev 	struct link_encoder *enc,
290*b843c749SSergey Zigachev 	const struct dc_link_settings *link_settings,
291*b843c749SSergey Zigachev 	enum clock_source_id clock_source);
292*b843c749SSergey Zigachev 
293*b843c749SSergey Zigachev /* enables DP PHY output in MST mode */
294*b843c749SSergey Zigachev void dcn10_link_encoder_enable_dp_mst_output(
295*b843c749SSergey Zigachev 	struct link_encoder *enc,
296*b843c749SSergey Zigachev 	const struct dc_link_settings *link_settings,
297*b843c749SSergey Zigachev 	enum clock_source_id clock_source);
298*b843c749SSergey Zigachev 
299*b843c749SSergey Zigachev /* disable PHY output */
300*b843c749SSergey Zigachev void dcn10_link_encoder_disable_output(
301*b843c749SSergey Zigachev 	struct link_encoder *enc,
302*b843c749SSergey Zigachev 	enum signal_type signal);
303*b843c749SSergey Zigachev 
304*b843c749SSergey Zigachev /* set DP lane settings */
305*b843c749SSergey Zigachev void dcn10_link_encoder_dp_set_lane_settings(
306*b843c749SSergey Zigachev 	struct link_encoder *enc,
307*b843c749SSergey Zigachev 	const struct link_training_settings *link_settings);
308*b843c749SSergey Zigachev 
309*b843c749SSergey Zigachev void dcn10_link_encoder_dp_set_phy_pattern(
310*b843c749SSergey Zigachev 	struct link_encoder *enc,
311*b843c749SSergey Zigachev 	const struct encoder_set_dp_phy_pattern_param *param);
312*b843c749SSergey Zigachev 
313*b843c749SSergey Zigachev /* programs DP MST VC payload allocation */
314*b843c749SSergey Zigachev void dcn10_link_encoder_update_mst_stream_allocation_table(
315*b843c749SSergey Zigachev 	struct link_encoder *enc,
316*b843c749SSergey Zigachev 	const struct link_mst_stream_allocation_table *table);
317*b843c749SSergey Zigachev 
318*b843c749SSergey Zigachev void dcn10_link_encoder_connect_dig_be_to_fe(
319*b843c749SSergey Zigachev 	struct link_encoder *enc,
320*b843c749SSergey Zigachev 	enum engine_id engine,
321*b843c749SSergey Zigachev 	bool connect);
322*b843c749SSergey Zigachev 
323*b843c749SSergey Zigachev void dcn10_link_encoder_set_dp_phy_pattern_training_pattern(
324*b843c749SSergey Zigachev 	struct link_encoder *enc,
325*b843c749SSergey Zigachev 	uint32_t index);
326*b843c749SSergey Zigachev 
327*b843c749SSergey Zigachev void dcn10_link_encoder_enable_hpd(struct link_encoder *enc);
328*b843c749SSergey Zigachev 
329*b843c749SSergey Zigachev void dcn10_link_encoder_disable_hpd(struct link_encoder *enc);
330*b843c749SSergey Zigachev 
331*b843c749SSergey Zigachev void dcn10_psr_program_dp_dphy_fast_training(struct link_encoder *enc,
332*b843c749SSergey Zigachev 			bool exit_link_training_required);
333*b843c749SSergey Zigachev 
334*b843c749SSergey Zigachev void dcn10_psr_program_secondary_packet(struct link_encoder *enc,
335*b843c749SSergey Zigachev 			unsigned int sdp_transmit_line_num_deadline);
336*b843c749SSergey Zigachev 
337*b843c749SSergey Zigachev bool dcn10_is_dig_enabled(struct link_encoder *enc);
338*b843c749SSergey Zigachev 
339*b843c749SSergey Zigachev void dcn10_aux_initialize(struct dcn10_link_encoder *enc10);
340*b843c749SSergey Zigachev 
341*b843c749SSergey Zigachev #endif /* __DC_LINK_ENCODER__DCN10_H__ */
342