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 #include "dm_services.h"
27*b843c749SSergey Zigachev
28*b843c749SSergey Zigachev #include "atom.h"
29*b843c749SSergey Zigachev
30*b843c749SSergey Zigachev #include "include/bios_parser_types.h"
31*b843c749SSergey Zigachev
32*b843c749SSergey Zigachev #include "../command_table_helper.h"
33*b843c749SSergey Zigachev
phy_id_to_atom(enum transmitter t)34*b843c749SSergey Zigachev static uint8_t phy_id_to_atom(enum transmitter t)
35*b843c749SSergey Zigachev {
36*b843c749SSergey Zigachev uint8_t atom_phy_id;
37*b843c749SSergey Zigachev
38*b843c749SSergey Zigachev switch (t) {
39*b843c749SSergey Zigachev case TRANSMITTER_UNIPHY_A:
40*b843c749SSergey Zigachev atom_phy_id = ATOM_PHY_ID_UNIPHYA;
41*b843c749SSergey Zigachev break;
42*b843c749SSergey Zigachev case TRANSMITTER_UNIPHY_B:
43*b843c749SSergey Zigachev atom_phy_id = ATOM_PHY_ID_UNIPHYB;
44*b843c749SSergey Zigachev break;
45*b843c749SSergey Zigachev case TRANSMITTER_UNIPHY_C:
46*b843c749SSergey Zigachev atom_phy_id = ATOM_PHY_ID_UNIPHYC;
47*b843c749SSergey Zigachev break;
48*b843c749SSergey Zigachev case TRANSMITTER_UNIPHY_D:
49*b843c749SSergey Zigachev atom_phy_id = ATOM_PHY_ID_UNIPHYD;
50*b843c749SSergey Zigachev break;
51*b843c749SSergey Zigachev case TRANSMITTER_UNIPHY_E:
52*b843c749SSergey Zigachev atom_phy_id = ATOM_PHY_ID_UNIPHYE;
53*b843c749SSergey Zigachev break;
54*b843c749SSergey Zigachev case TRANSMITTER_UNIPHY_F:
55*b843c749SSergey Zigachev atom_phy_id = ATOM_PHY_ID_UNIPHYF;
56*b843c749SSergey Zigachev break;
57*b843c749SSergey Zigachev case TRANSMITTER_UNIPHY_G:
58*b843c749SSergey Zigachev atom_phy_id = ATOM_PHY_ID_UNIPHYG;
59*b843c749SSergey Zigachev break;
60*b843c749SSergey Zigachev default:
61*b843c749SSergey Zigachev atom_phy_id = ATOM_PHY_ID_UNIPHYA;
62*b843c749SSergey Zigachev break;
63*b843c749SSergey Zigachev }
64*b843c749SSergey Zigachev return atom_phy_id;
65*b843c749SSergey Zigachev }
66*b843c749SSergey Zigachev
signal_type_to_atom_dig_mode(enum signal_type s)67*b843c749SSergey Zigachev static uint8_t signal_type_to_atom_dig_mode(enum signal_type s)
68*b843c749SSergey Zigachev {
69*b843c749SSergey Zigachev uint8_t atom_dig_mode = ATOM_TRANSMITTER_DIGMODE_V6_DP;
70*b843c749SSergey Zigachev
71*b843c749SSergey Zigachev switch (s) {
72*b843c749SSergey Zigachev case SIGNAL_TYPE_DISPLAY_PORT:
73*b843c749SSergey Zigachev case SIGNAL_TYPE_EDP:
74*b843c749SSergey Zigachev atom_dig_mode = ATOM_TRANSMITTER_DIGMODE_V6_DP;
75*b843c749SSergey Zigachev break;
76*b843c749SSergey Zigachev case SIGNAL_TYPE_DVI_SINGLE_LINK:
77*b843c749SSergey Zigachev case SIGNAL_TYPE_DVI_DUAL_LINK:
78*b843c749SSergey Zigachev atom_dig_mode = ATOM_TRANSMITTER_DIGMODE_V6_DVI;
79*b843c749SSergey Zigachev break;
80*b843c749SSergey Zigachev case SIGNAL_TYPE_HDMI_TYPE_A:
81*b843c749SSergey Zigachev atom_dig_mode = ATOM_TRANSMITTER_DIGMODE_V6_HDMI;
82*b843c749SSergey Zigachev break;
83*b843c749SSergey Zigachev case SIGNAL_TYPE_DISPLAY_PORT_MST:
84*b843c749SSergey Zigachev atom_dig_mode = ATOM_TRANSMITTER_DIGMODE_V6_DP_MST;
85*b843c749SSergey Zigachev break;
86*b843c749SSergey Zigachev default:
87*b843c749SSergey Zigachev atom_dig_mode = ATOM_TRANSMITTER_DIGMODE_V6_DVI;
88*b843c749SSergey Zigachev break;
89*b843c749SSergey Zigachev }
90*b843c749SSergey Zigachev
91*b843c749SSergey Zigachev return atom_dig_mode;
92*b843c749SSergey Zigachev }
93*b843c749SSergey Zigachev
clock_source_id_to_atom_phy_clk_src_id(enum clock_source_id id)94*b843c749SSergey Zigachev static uint8_t clock_source_id_to_atom_phy_clk_src_id(
95*b843c749SSergey Zigachev enum clock_source_id id)
96*b843c749SSergey Zigachev {
97*b843c749SSergey Zigachev uint8_t atom_phy_clk_src_id = 0;
98*b843c749SSergey Zigachev
99*b843c749SSergey Zigachev switch (id) {
100*b843c749SSergey Zigachev case CLOCK_SOURCE_ID_PLL0:
101*b843c749SSergey Zigachev atom_phy_clk_src_id = ATOM_TRANSMITTER_CONFIG_V5_P0PLL;
102*b843c749SSergey Zigachev break;
103*b843c749SSergey Zigachev case CLOCK_SOURCE_ID_PLL1:
104*b843c749SSergey Zigachev atom_phy_clk_src_id = ATOM_TRANSMITTER_CONFIG_V5_P1PLL;
105*b843c749SSergey Zigachev break;
106*b843c749SSergey Zigachev case CLOCK_SOURCE_ID_PLL2:
107*b843c749SSergey Zigachev atom_phy_clk_src_id = ATOM_TRANSMITTER_CONFIG_V5_P2PLL;
108*b843c749SSergey Zigachev break;
109*b843c749SSergey Zigachev case CLOCK_SOURCE_ID_EXTERNAL:
110*b843c749SSergey Zigachev atom_phy_clk_src_id = ATOM_TRANSMITTER_CONFIG_V5_REFCLK_SRC_EXT;
111*b843c749SSergey Zigachev break;
112*b843c749SSergey Zigachev default:
113*b843c749SSergey Zigachev atom_phy_clk_src_id = ATOM_TRANSMITTER_CONFIG_V5_P1PLL;
114*b843c749SSergey Zigachev break;
115*b843c749SSergey Zigachev }
116*b843c749SSergey Zigachev
117*b843c749SSergey Zigachev return atom_phy_clk_src_id >> 2;
118*b843c749SSergey Zigachev }
119*b843c749SSergey Zigachev
hpd_sel_to_atom(enum hpd_source_id id)120*b843c749SSergey Zigachev static uint8_t hpd_sel_to_atom(enum hpd_source_id id)
121*b843c749SSergey Zigachev {
122*b843c749SSergey Zigachev uint8_t atom_hpd_sel = 0;
123*b843c749SSergey Zigachev
124*b843c749SSergey Zigachev switch (id) {
125*b843c749SSergey Zigachev case HPD_SOURCEID1:
126*b843c749SSergey Zigachev atom_hpd_sel = ATOM_TRANSMITTER_V6_HPD1_SEL;
127*b843c749SSergey Zigachev break;
128*b843c749SSergey Zigachev case HPD_SOURCEID2:
129*b843c749SSergey Zigachev atom_hpd_sel = ATOM_TRANSMITTER_V6_HPD2_SEL;
130*b843c749SSergey Zigachev break;
131*b843c749SSergey Zigachev case HPD_SOURCEID3:
132*b843c749SSergey Zigachev atom_hpd_sel = ATOM_TRANSMITTER_V6_HPD3_SEL;
133*b843c749SSergey Zigachev break;
134*b843c749SSergey Zigachev case HPD_SOURCEID4:
135*b843c749SSergey Zigachev atom_hpd_sel = ATOM_TRANSMITTER_V6_HPD4_SEL;
136*b843c749SSergey Zigachev break;
137*b843c749SSergey Zigachev case HPD_SOURCEID5:
138*b843c749SSergey Zigachev atom_hpd_sel = ATOM_TRANSMITTER_V6_HPD5_SEL;
139*b843c749SSergey Zigachev break;
140*b843c749SSergey Zigachev case HPD_SOURCEID6:
141*b843c749SSergey Zigachev atom_hpd_sel = ATOM_TRANSMITTER_V6_HPD6_SEL;
142*b843c749SSergey Zigachev break;
143*b843c749SSergey Zigachev case HPD_SOURCEID_UNKNOWN:
144*b843c749SSergey Zigachev default:
145*b843c749SSergey Zigachev atom_hpd_sel = 0;
146*b843c749SSergey Zigachev break;
147*b843c749SSergey Zigachev }
148*b843c749SSergey Zigachev return atom_hpd_sel;
149*b843c749SSergey Zigachev }
150*b843c749SSergey Zigachev
dig_encoder_sel_to_atom(enum engine_id id)151*b843c749SSergey Zigachev static uint8_t dig_encoder_sel_to_atom(enum engine_id id)
152*b843c749SSergey Zigachev {
153*b843c749SSergey Zigachev uint8_t atom_dig_encoder_sel = 0;
154*b843c749SSergey Zigachev
155*b843c749SSergey Zigachev switch (id) {
156*b843c749SSergey Zigachev case ENGINE_ID_DIGA:
157*b843c749SSergey Zigachev atom_dig_encoder_sel = ATOM_TRANMSITTER_V6__DIGA_SEL;
158*b843c749SSergey Zigachev break;
159*b843c749SSergey Zigachev case ENGINE_ID_DIGB:
160*b843c749SSergey Zigachev atom_dig_encoder_sel = ATOM_TRANMSITTER_V6__DIGB_SEL;
161*b843c749SSergey Zigachev break;
162*b843c749SSergey Zigachev case ENGINE_ID_DIGC:
163*b843c749SSergey Zigachev atom_dig_encoder_sel = ATOM_TRANMSITTER_V6__DIGC_SEL;
164*b843c749SSergey Zigachev break;
165*b843c749SSergey Zigachev case ENGINE_ID_DIGD:
166*b843c749SSergey Zigachev atom_dig_encoder_sel = ATOM_TRANMSITTER_V6__DIGD_SEL;
167*b843c749SSergey Zigachev break;
168*b843c749SSergey Zigachev case ENGINE_ID_DIGE:
169*b843c749SSergey Zigachev atom_dig_encoder_sel = ATOM_TRANMSITTER_V6__DIGE_SEL;
170*b843c749SSergey Zigachev break;
171*b843c749SSergey Zigachev case ENGINE_ID_DIGF:
172*b843c749SSergey Zigachev atom_dig_encoder_sel = ATOM_TRANMSITTER_V6__DIGF_SEL;
173*b843c749SSergey Zigachev break;
174*b843c749SSergey Zigachev case ENGINE_ID_DIGG:
175*b843c749SSergey Zigachev atom_dig_encoder_sel = ATOM_TRANMSITTER_V6__DIGG_SEL;
176*b843c749SSergey Zigachev break;
177*b843c749SSergey Zigachev case ENGINE_ID_UNKNOWN:
178*b843c749SSergey Zigachev /* No DIG_FRONT is associated to DIG_BACKEND */
179*b843c749SSergey Zigachev atom_dig_encoder_sel = 0;
180*b843c749SSergey Zigachev break;
181*b843c749SSergey Zigachev default:
182*b843c749SSergey Zigachev atom_dig_encoder_sel = ATOM_TRANMSITTER_V6__DIGA_SEL;
183*b843c749SSergey Zigachev break;
184*b843c749SSergey Zigachev }
185*b843c749SSergey Zigachev
186*b843c749SSergey Zigachev return 0;
187*b843c749SSergey Zigachev }
188*b843c749SSergey Zigachev
clock_source_id_to_atom(enum clock_source_id id,uint32_t * atom_pll_id)189*b843c749SSergey Zigachev static bool clock_source_id_to_atom(
190*b843c749SSergey Zigachev enum clock_source_id id,
191*b843c749SSergey Zigachev uint32_t *atom_pll_id)
192*b843c749SSergey Zigachev {
193*b843c749SSergey Zigachev bool result = true;
194*b843c749SSergey Zigachev
195*b843c749SSergey Zigachev if (atom_pll_id != NULL)
196*b843c749SSergey Zigachev switch (id) {
197*b843c749SSergey Zigachev case CLOCK_SOURCE_COMBO_PHY_PLL0:
198*b843c749SSergey Zigachev *atom_pll_id = ATOM_COMBOPHY_PLL0;
199*b843c749SSergey Zigachev break;
200*b843c749SSergey Zigachev case CLOCK_SOURCE_COMBO_PHY_PLL1:
201*b843c749SSergey Zigachev *atom_pll_id = ATOM_COMBOPHY_PLL1;
202*b843c749SSergey Zigachev break;
203*b843c749SSergey Zigachev case CLOCK_SOURCE_COMBO_PHY_PLL2:
204*b843c749SSergey Zigachev *atom_pll_id = ATOM_COMBOPHY_PLL2;
205*b843c749SSergey Zigachev break;
206*b843c749SSergey Zigachev case CLOCK_SOURCE_COMBO_PHY_PLL3:
207*b843c749SSergey Zigachev *atom_pll_id = ATOM_COMBOPHY_PLL3;
208*b843c749SSergey Zigachev break;
209*b843c749SSergey Zigachev case CLOCK_SOURCE_COMBO_PHY_PLL4:
210*b843c749SSergey Zigachev *atom_pll_id = ATOM_COMBOPHY_PLL4;
211*b843c749SSergey Zigachev break;
212*b843c749SSergey Zigachev case CLOCK_SOURCE_COMBO_PHY_PLL5:
213*b843c749SSergey Zigachev *atom_pll_id = ATOM_COMBOPHY_PLL5;
214*b843c749SSergey Zigachev break;
215*b843c749SSergey Zigachev case CLOCK_SOURCE_COMBO_DISPLAY_PLL0:
216*b843c749SSergey Zigachev *atom_pll_id = ATOM_PPLL0;
217*b843c749SSergey Zigachev break;
218*b843c749SSergey Zigachev case CLOCK_SOURCE_ID_DFS:
219*b843c749SSergey Zigachev *atom_pll_id = ATOM_GCK_DFS;
220*b843c749SSergey Zigachev break;
221*b843c749SSergey Zigachev case CLOCK_SOURCE_ID_VCE:
222*b843c749SSergey Zigachev *atom_pll_id = ATOM_DP_DTO;
223*b843c749SSergey Zigachev break;
224*b843c749SSergey Zigachev case CLOCK_SOURCE_ID_DP_DTO:
225*b843c749SSergey Zigachev *atom_pll_id = ATOM_DP_DTO;
226*b843c749SSergey Zigachev break;
227*b843c749SSergey Zigachev case CLOCK_SOURCE_ID_UNDEFINED:
228*b843c749SSergey Zigachev /* Should not happen */
229*b843c749SSergey Zigachev *atom_pll_id = ATOM_PPLL_INVALID;
230*b843c749SSergey Zigachev result = false;
231*b843c749SSergey Zigachev break;
232*b843c749SSergey Zigachev default:
233*b843c749SSergey Zigachev result = false;
234*b843c749SSergey Zigachev break;
235*b843c749SSergey Zigachev }
236*b843c749SSergey Zigachev
237*b843c749SSergey Zigachev return result;
238*b843c749SSergey Zigachev }
239*b843c749SSergey Zigachev
engine_bp_to_atom(enum engine_id id,uint32_t * atom_engine_id)240*b843c749SSergey Zigachev static bool engine_bp_to_atom(enum engine_id id, uint32_t *atom_engine_id)
241*b843c749SSergey Zigachev {
242*b843c749SSergey Zigachev bool result = false;
243*b843c749SSergey Zigachev
244*b843c749SSergey Zigachev if (atom_engine_id != NULL)
245*b843c749SSergey Zigachev switch (id) {
246*b843c749SSergey Zigachev case ENGINE_ID_DIGA:
247*b843c749SSergey Zigachev *atom_engine_id = ASIC_INT_DIG1_ENCODER_ID;
248*b843c749SSergey Zigachev result = true;
249*b843c749SSergey Zigachev break;
250*b843c749SSergey Zigachev case ENGINE_ID_DIGB:
251*b843c749SSergey Zigachev *atom_engine_id = ASIC_INT_DIG2_ENCODER_ID;
252*b843c749SSergey Zigachev result = true;
253*b843c749SSergey Zigachev break;
254*b843c749SSergey Zigachev case ENGINE_ID_DIGC:
255*b843c749SSergey Zigachev *atom_engine_id = ASIC_INT_DIG3_ENCODER_ID;
256*b843c749SSergey Zigachev result = true;
257*b843c749SSergey Zigachev break;
258*b843c749SSergey Zigachev case ENGINE_ID_DIGD:
259*b843c749SSergey Zigachev *atom_engine_id = ASIC_INT_DIG4_ENCODER_ID;
260*b843c749SSergey Zigachev result = true;
261*b843c749SSergey Zigachev break;
262*b843c749SSergey Zigachev case ENGINE_ID_DIGE:
263*b843c749SSergey Zigachev *atom_engine_id = ASIC_INT_DIG5_ENCODER_ID;
264*b843c749SSergey Zigachev result = true;
265*b843c749SSergey Zigachev break;
266*b843c749SSergey Zigachev case ENGINE_ID_DIGF:
267*b843c749SSergey Zigachev *atom_engine_id = ASIC_INT_DIG6_ENCODER_ID;
268*b843c749SSergey Zigachev result = true;
269*b843c749SSergey Zigachev break;
270*b843c749SSergey Zigachev case ENGINE_ID_DIGG:
271*b843c749SSergey Zigachev *atom_engine_id = ASIC_INT_DIG7_ENCODER_ID;
272*b843c749SSergey Zigachev result = true;
273*b843c749SSergey Zigachev break;
274*b843c749SSergey Zigachev case ENGINE_ID_DACA:
275*b843c749SSergey Zigachev *atom_engine_id = ASIC_INT_DAC1_ENCODER_ID;
276*b843c749SSergey Zigachev result = true;
277*b843c749SSergey Zigachev break;
278*b843c749SSergey Zigachev default:
279*b843c749SSergey Zigachev break;
280*b843c749SSergey Zigachev }
281*b843c749SSergey Zigachev
282*b843c749SSergey Zigachev return result;
283*b843c749SSergey Zigachev }
284*b843c749SSergey Zigachev
encoder_action_to_atom(enum bp_encoder_control_action action)285*b843c749SSergey Zigachev static uint8_t encoder_action_to_atom(enum bp_encoder_control_action action)
286*b843c749SSergey Zigachev {
287*b843c749SSergey Zigachev uint8_t atom_action = 0;
288*b843c749SSergey Zigachev
289*b843c749SSergey Zigachev switch (action) {
290*b843c749SSergey Zigachev case ENCODER_CONTROL_ENABLE:
291*b843c749SSergey Zigachev atom_action = ATOM_ENABLE;
292*b843c749SSergey Zigachev break;
293*b843c749SSergey Zigachev case ENCODER_CONTROL_DISABLE:
294*b843c749SSergey Zigachev atom_action = ATOM_DISABLE;
295*b843c749SSergey Zigachev break;
296*b843c749SSergey Zigachev case ENCODER_CONTROL_SETUP:
297*b843c749SSergey Zigachev atom_action = ATOM_ENCODER_CMD_STREAM_SETUP;
298*b843c749SSergey Zigachev break;
299*b843c749SSergey Zigachev case ENCODER_CONTROL_INIT:
300*b843c749SSergey Zigachev atom_action = ATOM_ENCODER_INIT;
301*b843c749SSergey Zigachev break;
302*b843c749SSergey Zigachev default:
303*b843c749SSergey Zigachev BREAK_TO_DEBUGGER(); /* Unhandle action in driver.!! */
304*b843c749SSergey Zigachev break;
305*b843c749SSergey Zigachev }
306*b843c749SSergey Zigachev
307*b843c749SSergey Zigachev return atom_action;
308*b843c749SSergey Zigachev }
309*b843c749SSergey Zigachev
disp_power_gating_action_to_atom(enum bp_pipe_control_action action)310*b843c749SSergey Zigachev static uint8_t disp_power_gating_action_to_atom(
311*b843c749SSergey Zigachev enum bp_pipe_control_action action)
312*b843c749SSergey Zigachev {
313*b843c749SSergey Zigachev uint8_t atom_pipe_action = 0;
314*b843c749SSergey Zigachev
315*b843c749SSergey Zigachev switch (action) {
316*b843c749SSergey Zigachev case ASIC_PIPE_DISABLE:
317*b843c749SSergey Zigachev atom_pipe_action = ATOM_DISABLE;
318*b843c749SSergey Zigachev break;
319*b843c749SSergey Zigachev case ASIC_PIPE_ENABLE:
320*b843c749SSergey Zigachev atom_pipe_action = ATOM_ENABLE;
321*b843c749SSergey Zigachev break;
322*b843c749SSergey Zigachev case ASIC_PIPE_INIT:
323*b843c749SSergey Zigachev atom_pipe_action = ATOM_INIT;
324*b843c749SSergey Zigachev break;
325*b843c749SSergey Zigachev default:
326*b843c749SSergey Zigachev ASSERT_CRITICAL(false); /* Unhandle action in driver! */
327*b843c749SSergey Zigachev break;
328*b843c749SSergey Zigachev }
329*b843c749SSergey Zigachev
330*b843c749SSergey Zigachev return atom_pipe_action;
331*b843c749SSergey Zigachev }
332*b843c749SSergey Zigachev
dc_clock_type_to_atom(enum bp_dce_clock_type id,uint32_t * atom_clock_type)333*b843c749SSergey Zigachev static bool dc_clock_type_to_atom(
334*b843c749SSergey Zigachev enum bp_dce_clock_type id,
335*b843c749SSergey Zigachev uint32_t *atom_clock_type)
336*b843c749SSergey Zigachev {
337*b843c749SSergey Zigachev bool retCode = true;
338*b843c749SSergey Zigachev
339*b843c749SSergey Zigachev if (atom_clock_type != NULL) {
340*b843c749SSergey Zigachev switch (id) {
341*b843c749SSergey Zigachev case DCECLOCK_TYPE_DISPLAY_CLOCK:
342*b843c749SSergey Zigachev *atom_clock_type = DCE_CLOCK_TYPE_DISPCLK;
343*b843c749SSergey Zigachev break;
344*b843c749SSergey Zigachev
345*b843c749SSergey Zigachev case DCECLOCK_TYPE_DPREFCLK:
346*b843c749SSergey Zigachev *atom_clock_type = DCE_CLOCK_TYPE_DPREFCLK;
347*b843c749SSergey Zigachev break;
348*b843c749SSergey Zigachev
349*b843c749SSergey Zigachev default:
350*b843c749SSergey Zigachev ASSERT_CRITICAL(false); /* Unhandle action in driver! */
351*b843c749SSergey Zigachev break;
352*b843c749SSergey Zigachev }
353*b843c749SSergey Zigachev }
354*b843c749SSergey Zigachev
355*b843c749SSergey Zigachev return retCode;
356*b843c749SSergey Zigachev }
357*b843c749SSergey Zigachev
transmitter_color_depth_to_atom(enum transmitter_color_depth id)358*b843c749SSergey Zigachev static uint8_t transmitter_color_depth_to_atom(enum transmitter_color_depth id)
359*b843c749SSergey Zigachev {
360*b843c749SSergey Zigachev uint8_t atomColorDepth = 0;
361*b843c749SSergey Zigachev
362*b843c749SSergey Zigachev switch (id) {
363*b843c749SSergey Zigachev case TRANSMITTER_COLOR_DEPTH_24:
364*b843c749SSergey Zigachev atomColorDepth = PIXEL_CLOCK_V7_DEEPCOLOR_RATIO_DIS;
365*b843c749SSergey Zigachev break;
366*b843c749SSergey Zigachev case TRANSMITTER_COLOR_DEPTH_30:
367*b843c749SSergey Zigachev atomColorDepth = PIXEL_CLOCK_V7_DEEPCOLOR_RATIO_5_4;
368*b843c749SSergey Zigachev break;
369*b843c749SSergey Zigachev case TRANSMITTER_COLOR_DEPTH_36:
370*b843c749SSergey Zigachev atomColorDepth = PIXEL_CLOCK_V7_DEEPCOLOR_RATIO_3_2;
371*b843c749SSergey Zigachev break;
372*b843c749SSergey Zigachev case TRANSMITTER_COLOR_DEPTH_48:
373*b843c749SSergey Zigachev atomColorDepth = PIXEL_CLOCK_V7_DEEPCOLOR_RATIO_2_1;
374*b843c749SSergey Zigachev break;
375*b843c749SSergey Zigachev default:
376*b843c749SSergey Zigachev ASSERT_CRITICAL(false); /* Unhandle action in driver! */
377*b843c749SSergey Zigachev break;
378*b843c749SSergey Zigachev }
379*b843c749SSergey Zigachev
380*b843c749SSergey Zigachev return atomColorDepth;
381*b843c749SSergey Zigachev }
382*b843c749SSergey Zigachev
383*b843c749SSergey Zigachev /* function table */
384*b843c749SSergey Zigachev static const struct command_table_helper command_table_helper_funcs = {
385*b843c749SSergey Zigachev .controller_id_to_atom = dal_cmd_table_helper_controller_id_to_atom,
386*b843c749SSergey Zigachev .encoder_action_to_atom = encoder_action_to_atom,
387*b843c749SSergey Zigachev .engine_bp_to_atom = engine_bp_to_atom,
388*b843c749SSergey Zigachev .clock_source_id_to_atom = clock_source_id_to_atom,
389*b843c749SSergey Zigachev .clock_source_id_to_atom_phy_clk_src_id =
390*b843c749SSergey Zigachev clock_source_id_to_atom_phy_clk_src_id,
391*b843c749SSergey Zigachev .signal_type_to_atom_dig_mode = signal_type_to_atom_dig_mode,
392*b843c749SSergey Zigachev .hpd_sel_to_atom = hpd_sel_to_atom,
393*b843c749SSergey Zigachev .dig_encoder_sel_to_atom = dig_encoder_sel_to_atom,
394*b843c749SSergey Zigachev .phy_id_to_atom = phy_id_to_atom,
395*b843c749SSergey Zigachev .disp_power_gating_action_to_atom = disp_power_gating_action_to_atom,
396*b843c749SSergey Zigachev .assign_control_parameter = NULL,
397*b843c749SSergey Zigachev .clock_source_id_to_ref_clk_src = NULL,
398*b843c749SSergey Zigachev .transmitter_bp_to_atom = NULL,
399*b843c749SSergey Zigachev .encoder_id_to_atom = dal_cmd_table_helper_encoder_id_to_atom,
400*b843c749SSergey Zigachev .encoder_mode_bp_to_atom = dal_cmd_table_helper_encoder_mode_bp_to_atom,
401*b843c749SSergey Zigachev .dc_clock_type_to_atom = dc_clock_type_to_atom,
402*b843c749SSergey Zigachev .transmitter_color_depth_to_atom = transmitter_color_depth_to_atom,
403*b843c749SSergey Zigachev };
404*b843c749SSergey Zigachev
405*b843c749SSergey Zigachev /*
406*b843c749SSergey Zigachev * dal_cmd_tbl_helper_dce110_get_table
407*b843c749SSergey Zigachev *
408*b843c749SSergey Zigachev * @brief
409*b843c749SSergey Zigachev * Initialize command table helper functions
410*b843c749SSergey Zigachev *
411*b843c749SSergey Zigachev * @param
412*b843c749SSergey Zigachev * const struct command_table_helper **h - [out] struct of functions
413*b843c749SSergey Zigachev *
414*b843c749SSergey Zigachev */
dal_cmd_tbl_helper_dce112_get_table(void)415*b843c749SSergey Zigachev const struct command_table_helper *dal_cmd_tbl_helper_dce112_get_table(void)
416*b843c749SSergey Zigachev {
417*b843c749SSergey Zigachev return &command_table_helper_funcs;
418*b843c749SSergey Zigachev }
419