This source file includes following definitions.
- dal_bios_parser_init_cmd_tbl_helper
- dal_cmd_table_helper_controller_id_to_atom
- dal_cmd_table_helper_transmitter_bp_to_atom
- dal_cmd_table_helper_encoder_mode_bp_to_atom
- dal_cmd_table_helper_assign_control_parameter
- dal_cmd_table_helper_clock_source_id_to_ref_clk_src
- dal_cmd_table_helper_encoder_id_to_atom
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 #include "dm_services.h"
27
28 #include "atom.h"
29
30 #include "include/bios_parser_types.h"
31
32 #include "command_table_helper.h"
33
34 bool dal_bios_parser_init_cmd_tbl_helper(
35 const struct command_table_helper **h,
36 enum dce_version dce)
37 {
38 switch (dce) {
39 case DCE_VERSION_8_0:
40 case DCE_VERSION_8_1:
41 case DCE_VERSION_8_3:
42 *h = dal_cmd_tbl_helper_dce80_get_table();
43 return true;
44
45 case DCE_VERSION_10_0:
46 *h = dal_cmd_tbl_helper_dce110_get_table();
47 return true;
48
49 case DCE_VERSION_11_0:
50 *h = dal_cmd_tbl_helper_dce110_get_table();
51 return true;
52
53 case DCE_VERSION_11_2:
54 case DCE_VERSION_11_22:
55 *h = dal_cmd_tbl_helper_dce112_get_table();
56 return true;
57
58 default:
59
60 BREAK_TO_DEBUGGER();
61 return false;
62 }
63 }
64
65
66
67 bool dal_cmd_table_helper_controller_id_to_atom(
68 enum controller_id id,
69 uint8_t *atom_id)
70 {
71 if (atom_id == NULL) {
72 BREAK_TO_DEBUGGER();
73 return false;
74 }
75
76 switch (id) {
77 case CONTROLLER_ID_D0:
78 *atom_id = ATOM_CRTC1;
79 return true;
80 case CONTROLLER_ID_D1:
81 *atom_id = ATOM_CRTC2;
82 return true;
83 case CONTROLLER_ID_D2:
84 *atom_id = ATOM_CRTC3;
85 return true;
86 case CONTROLLER_ID_D3:
87 *atom_id = ATOM_CRTC4;
88 return true;
89 case CONTROLLER_ID_D4:
90 *atom_id = ATOM_CRTC5;
91 return true;
92 case CONTROLLER_ID_D5:
93 *atom_id = ATOM_CRTC6;
94 return true;
95 case CONTROLLER_ID_UNDERLAY0:
96 *atom_id = ATOM_UNDERLAY_PIPE0;
97 return true;
98 case CONTROLLER_ID_UNDEFINED:
99 *atom_id = ATOM_CRTC_INVALID;
100 return true;
101 default:
102
103 BREAK_TO_DEBUGGER();
104 return false;
105 }
106 }
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121 uint8_t dal_cmd_table_helper_transmitter_bp_to_atom(
122 enum transmitter t)
123 {
124 switch (t) {
125 case TRANSMITTER_UNIPHY_A:
126 case TRANSMITTER_UNIPHY_B:
127 case TRANSMITTER_TRAVIS_LCD:
128 return 0;
129 case TRANSMITTER_UNIPHY_C:
130 case TRANSMITTER_UNIPHY_D:
131 return 1;
132 case TRANSMITTER_UNIPHY_E:
133 case TRANSMITTER_UNIPHY_F:
134 return 2;
135 default:
136
137 BREAK_TO_DEBUGGER();
138 return 0;
139 }
140 }
141
142 uint32_t dal_cmd_table_helper_encoder_mode_bp_to_atom(
143 enum signal_type s,
144 bool enable_dp_audio)
145 {
146 switch (s) {
147 case SIGNAL_TYPE_DVI_SINGLE_LINK:
148 case SIGNAL_TYPE_DVI_DUAL_LINK:
149 return ATOM_ENCODER_MODE_DVI;
150 case SIGNAL_TYPE_HDMI_TYPE_A:
151 return ATOM_ENCODER_MODE_HDMI;
152 case SIGNAL_TYPE_LVDS:
153 return ATOM_ENCODER_MODE_LVDS;
154 case SIGNAL_TYPE_EDP:
155 case SIGNAL_TYPE_DISPLAY_PORT_MST:
156 case SIGNAL_TYPE_DISPLAY_PORT:
157 case SIGNAL_TYPE_VIRTUAL:
158 if (enable_dp_audio)
159 return ATOM_ENCODER_MODE_DP_AUDIO;
160 else
161 return ATOM_ENCODER_MODE_DP;
162 case SIGNAL_TYPE_RGB:
163 return ATOM_ENCODER_MODE_CRT;
164 default:
165 return ATOM_ENCODER_MODE_CRT;
166 }
167 }
168
169 void dal_cmd_table_helper_assign_control_parameter(
170 const struct command_table_helper *h,
171 struct bp_encoder_control *control,
172 DIG_ENCODER_CONTROL_PARAMETERS_V2 *ctrl_param)
173 {
174
175
176
177
178
179
180 if ((control->transmitter == TRANSMITTER_UNIPHY_B) ||
181 (control->transmitter == TRANSMITTER_UNIPHY_D) ||
182 (control->transmitter == TRANSMITTER_UNIPHY_F)) {
183
184
185
186
187 ctrl_param->acConfig.ucLinkSel = 1;
188 }
189
190
191
192
193
194
195
196 ctrl_param->acConfig.ucTransmitterSel =
197 (uint8_t)(h->transmitter_bp_to_atom(control->transmitter));
198
199
200 ctrl_param->ucAction = h->encoder_action_to_atom(control->action);
201 ctrl_param->usPixelClock = cpu_to_le16((uint16_t)(control->pixel_clock / 10));
202 ctrl_param->ucEncoderMode =
203 (uint8_t)(h->encoder_mode_bp_to_atom(
204 control->signal, control->enable_dp_audio));
205 ctrl_param->ucLaneNum = (uint8_t)(control->lanes_number);
206 }
207
208 bool dal_cmd_table_helper_clock_source_id_to_ref_clk_src(
209 enum clock_source_id id,
210 uint32_t *ref_clk_src_id)
211 {
212 if (ref_clk_src_id == NULL) {
213 BREAK_TO_DEBUGGER();
214 return false;
215 }
216
217 switch (id) {
218 case CLOCK_SOURCE_ID_PLL1:
219 *ref_clk_src_id = ENCODER_REFCLK_SRC_P1PLL;
220 return true;
221 case CLOCK_SOURCE_ID_PLL2:
222 *ref_clk_src_id = ENCODER_REFCLK_SRC_P2PLL;
223 return true;
224 case CLOCK_SOURCE_ID_DCPLL:
225 *ref_clk_src_id = ENCODER_REFCLK_SRC_DCPLL;
226 return true;
227 case CLOCK_SOURCE_ID_EXTERNAL:
228 *ref_clk_src_id = ENCODER_REFCLK_SRC_EXTCLK;
229 return true;
230 case CLOCK_SOURCE_ID_UNDEFINED:
231 *ref_clk_src_id = ENCODER_REFCLK_SRC_INVALID;
232 return true;
233 default:
234
235 BREAK_TO_DEBUGGER();
236 return false;
237 }
238 }
239
240 uint8_t dal_cmd_table_helper_encoder_id_to_atom(
241 enum encoder_id id)
242 {
243 switch (id) {
244 case ENCODER_ID_INTERNAL_LVDS:
245 return ENCODER_OBJECT_ID_INTERNAL_LVDS;
246 case ENCODER_ID_INTERNAL_TMDS1:
247 return ENCODER_OBJECT_ID_INTERNAL_TMDS1;
248 case ENCODER_ID_INTERNAL_TMDS2:
249 return ENCODER_OBJECT_ID_INTERNAL_TMDS2;
250 case ENCODER_ID_INTERNAL_DAC1:
251 return ENCODER_OBJECT_ID_INTERNAL_DAC1;
252 case ENCODER_ID_INTERNAL_DAC2:
253 return ENCODER_OBJECT_ID_INTERNAL_DAC2;
254 case ENCODER_ID_INTERNAL_LVTM1:
255 return ENCODER_OBJECT_ID_INTERNAL_LVTM1;
256 case ENCODER_ID_INTERNAL_HDMI:
257 return ENCODER_OBJECT_ID_HDMI_INTERNAL;
258 case ENCODER_ID_EXTERNAL_TRAVIS:
259 return ENCODER_OBJECT_ID_TRAVIS;
260 case ENCODER_ID_EXTERNAL_NUTMEG:
261 return ENCODER_OBJECT_ID_NUTMEG;
262 case ENCODER_ID_INTERNAL_KLDSCP_TMDS1:
263 return ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1;
264 case ENCODER_ID_INTERNAL_KLDSCP_DAC1:
265 return ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1;
266 case ENCODER_ID_INTERNAL_KLDSCP_DAC2:
267 return ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2;
268 case ENCODER_ID_EXTERNAL_MVPU_FPGA:
269 return ENCODER_OBJECT_ID_MVPU_FPGA;
270 case ENCODER_ID_INTERNAL_DDI:
271 return ENCODER_OBJECT_ID_INTERNAL_DDI;
272 case ENCODER_ID_INTERNAL_UNIPHY:
273 return ENCODER_OBJECT_ID_INTERNAL_UNIPHY;
274 case ENCODER_ID_INTERNAL_KLDSCP_LVTMA:
275 return ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA;
276 case ENCODER_ID_INTERNAL_UNIPHY1:
277 return ENCODER_OBJECT_ID_INTERNAL_UNIPHY1;
278 case ENCODER_ID_INTERNAL_UNIPHY2:
279 return ENCODER_OBJECT_ID_INTERNAL_UNIPHY2;
280 case ENCODER_ID_INTERNAL_UNIPHY3:
281 return ENCODER_OBJECT_ID_INTERNAL_UNIPHY3;
282 case ENCODER_ID_INTERNAL_WIRELESS:
283 return ENCODER_OBJECT_ID_INTERNAL_VCE;
284 case ENCODER_ID_UNKNOWN:
285 return ENCODER_OBJECT_ID_NONE;
286 default:
287
288 BREAK_TO_DEBUGGER();
289 return ENCODER_OBJECT_ID_NONE;
290 }
291 }