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 #include "dm_services.h"
29 #include "atomfirmware.h"
31 #include "include/bios_parser_types.h"
33 #include "command_table_helper2.h"
35 bool dal_bios_parser_init_cmd_tbl_helper2(
36 const struct command_table_helper **h,
43 *h = dal_cmd_tbl_helper_dce80_get_table();
46 case DCE_VERSION_10_0:
47 *h = dal_cmd_tbl_helper_dce110_get_table();
50 case DCE_VERSION_11_0:
51 *h = dal_cmd_tbl_helper_dce110_get_table();
54 case DCE_VERSION_11_2:
55 case DCE_VERSION_11_22:
56 *h = dal_cmd_tbl_helper_dce112_get_table2();
58 #if defined(CONFIG_DRM_AMD_DC_DCN)
60 case DCN_VERSION_1_01:
61 *h = dal_cmd_tbl_helper_dce112_get_table2();
66 *h = dal_cmd_tbl_helper_dce112_get_table2();
69 *h = dal_cmd_tbl_helper_dce112_get_table2();
71 case DCE_VERSION_12_0:
72 case DCE_VERSION_12_1:
73 *h = dal_cmd_tbl_helper_dce112_get_table2();
83 /* real implementations */
85 bool dal_cmd_table_helper_controller_id_to_atom2(
86 enum controller_id id,
89 if (atom_id == NULL) {
95 case CONTROLLER_ID_D0:
96 *atom_id = ATOM_CRTC1;
98 case CONTROLLER_ID_D1:
99 *atom_id = ATOM_CRTC2;
101 case CONTROLLER_ID_D2:
102 *atom_id = ATOM_CRTC3;
104 case CONTROLLER_ID_D3:
105 *atom_id = ATOM_CRTC4;
107 case CONTROLLER_ID_D4:
108 *atom_id = ATOM_CRTC5;
110 case CONTROLLER_ID_D5:
111 *atom_id = ATOM_CRTC6;
113 /* TODO :case CONTROLLER_ID_UNDERLAY0:
114 *atom_id = ATOM_UNDERLAY_PIPE0;
117 case CONTROLLER_ID_UNDEFINED:
118 *atom_id = ATOM_CRTC_INVALID;
121 /* Wrong controller id */
128 * translate_transmitter_bp_to_atom
131 * Translate the Transmitter to the corresponding ATOM BIOS value
135 * output digitalTransmitter
136 * // =00: Digital Transmitter1 ( UNIPHY linkAB )
137 * // =01: Digital Transmitter2 ( UNIPHY linkCD )
138 * // =02: Digital Transmitter3 ( UNIPHY linkEF )
140 uint8_t dal_cmd_table_helper_transmitter_bp_to_atom2(
144 case TRANSMITTER_UNIPHY_A:
145 case TRANSMITTER_UNIPHY_B:
146 case TRANSMITTER_TRAVIS_LCD:
148 case TRANSMITTER_UNIPHY_C:
149 case TRANSMITTER_UNIPHY_D:
151 case TRANSMITTER_UNIPHY_E:
152 case TRANSMITTER_UNIPHY_F:
155 /* Invalid Transmitter Type! */
161 uint32_t dal_cmd_table_helper_encoder_mode_bp_to_atom2(
163 bool enable_dp_audio)
166 case SIGNAL_TYPE_DVI_SINGLE_LINK:
167 case SIGNAL_TYPE_DVI_DUAL_LINK:
168 return ATOM_ENCODER_MODE_DVI;
169 case SIGNAL_TYPE_HDMI_TYPE_A:
170 return ATOM_ENCODER_MODE_HDMI;
171 case SIGNAL_TYPE_LVDS:
172 return ATOM_ENCODER_MODE_LVDS;
173 case SIGNAL_TYPE_EDP:
174 case SIGNAL_TYPE_DISPLAY_PORT_MST:
175 case SIGNAL_TYPE_DISPLAY_PORT:
176 case SIGNAL_TYPE_VIRTUAL:
178 return ATOM_ENCODER_MODE_DP_AUDIO;
180 return ATOM_ENCODER_MODE_DP;
181 case SIGNAL_TYPE_RGB:
182 return ATOM_ENCODER_MODE_CRT;
184 return ATOM_ENCODER_MODE_CRT;
188 bool dal_cmd_table_helper_clock_source_id_to_ref_clk_src2(
189 enum clock_source_id id,
190 uint32_t *ref_clk_src_id)
192 if (ref_clk_src_id == NULL) {
198 case CLOCK_SOURCE_ID_PLL1:
199 *ref_clk_src_id = ENCODER_REFCLK_SRC_P1PLL;
201 case CLOCK_SOURCE_ID_PLL2:
202 *ref_clk_src_id = ENCODER_REFCLK_SRC_P2PLL;
204 /*TODO:case CLOCK_SOURCE_ID_DCPLL:
205 *ref_clk_src_id = ENCODER_REFCLK_SRC_DCPLL;
208 case CLOCK_SOURCE_ID_EXTERNAL:
209 *ref_clk_src_id = ENCODER_REFCLK_SRC_EXTCLK;
211 case CLOCK_SOURCE_ID_UNDEFINED:
212 *ref_clk_src_id = ENCODER_REFCLK_SRC_INVALID;
215 /* Unsupported clock source id */
221 uint8_t dal_cmd_table_helper_encoder_id_to_atom2(
225 case ENCODER_ID_INTERNAL_LVDS:
226 return ENCODER_OBJECT_ID_INTERNAL_LVDS;
227 case ENCODER_ID_INTERNAL_TMDS1:
228 return ENCODER_OBJECT_ID_INTERNAL_TMDS1;
229 case ENCODER_ID_INTERNAL_TMDS2:
230 return ENCODER_OBJECT_ID_INTERNAL_TMDS2;
231 case ENCODER_ID_INTERNAL_DAC1:
232 return ENCODER_OBJECT_ID_INTERNAL_DAC1;
233 case ENCODER_ID_INTERNAL_DAC2:
234 return ENCODER_OBJECT_ID_INTERNAL_DAC2;
235 case ENCODER_ID_INTERNAL_LVTM1:
236 return ENCODER_OBJECT_ID_INTERNAL_LVTM1;
237 case ENCODER_ID_INTERNAL_HDMI:
238 return ENCODER_OBJECT_ID_HDMI_INTERNAL;
239 case ENCODER_ID_EXTERNAL_TRAVIS:
240 return ENCODER_OBJECT_ID_TRAVIS;
241 case ENCODER_ID_EXTERNAL_NUTMEG:
242 return ENCODER_OBJECT_ID_NUTMEG;
243 case ENCODER_ID_INTERNAL_KLDSCP_TMDS1:
244 return ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1;
245 case ENCODER_ID_INTERNAL_KLDSCP_DAC1:
246 return ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1;
247 case ENCODER_ID_INTERNAL_KLDSCP_DAC2:
248 return ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2;
249 case ENCODER_ID_EXTERNAL_MVPU_FPGA:
250 return ENCODER_OBJECT_ID_MVPU_FPGA;
251 case ENCODER_ID_INTERNAL_DDI:
252 return ENCODER_OBJECT_ID_INTERNAL_DDI;
253 case ENCODER_ID_INTERNAL_UNIPHY:
254 return ENCODER_OBJECT_ID_INTERNAL_UNIPHY;
255 case ENCODER_ID_INTERNAL_KLDSCP_LVTMA:
256 return ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA;
257 case ENCODER_ID_INTERNAL_UNIPHY1:
258 return ENCODER_OBJECT_ID_INTERNAL_UNIPHY1;
259 case ENCODER_ID_INTERNAL_UNIPHY2:
260 return ENCODER_OBJECT_ID_INTERNAL_UNIPHY2;
261 case ENCODER_ID_INTERNAL_UNIPHY3:
262 return ENCODER_OBJECT_ID_INTERNAL_UNIPHY3;
263 case ENCODER_ID_INTERNAL_WIRELESS:
264 return ENCODER_OBJECT_ID_INTERNAL_VCE;
265 case ENCODER_ID_INTERNAL_VIRTUAL:
266 return ENCODER_OBJECT_ID_NONE;
267 case ENCODER_ID_UNKNOWN:
268 return ENCODER_OBJECT_ID_NONE;
270 /* Invalid encoder id */
272 return ENCODER_OBJECT_ID_NONE;