xref: /linux/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c (revision ac84bac4062e7fc24f5e2c61c6a414b2a00a29ad)
1 /*
2  * Copyright 2018 Advanced Micro Devices, Inc.
3  *
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:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
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.
21  *
22  * Authors: AMD
23  *
24  */
25 
26 #include "dccg.h"
27 #include "clk_mgr_internal.h"
28 
29 #include "dce100/dce_clk_mgr.h"
30 #include "dcn20_clk_mgr.h"
31 #include "reg_helper.h"
32 #include "core_types.h"
33 #include "dm_helpers.h"
34 
35 #include "navi10_ip_offset.h"
36 #include "dcn/dcn_2_0_0_offset.h"
37 #include "dcn/dcn_2_0_0_sh_mask.h"
38 #include "clk/clk_11_0_0_offset.h"
39 #include "clk/clk_11_0_0_sh_mask.h"
40 
41 #undef FN
42 #define FN(reg_name, field_name) \
43 	clk_mgr->clk_mgr_shift->field_name, clk_mgr->clk_mgr_mask->field_name
44 
45 #define REG(reg) \
46 	(clk_mgr->regs->reg)
47 
48 #define BASE_INNER(seg) DCN_BASE__INST0_SEG ## seg
49 
50 #define BASE(seg) BASE_INNER(seg)
51 
52 #define SR(reg_name)\
53 		.reg_name = BASE(mm ## reg_name ## _BASE_IDX) +  \
54 					mm ## reg_name
55 
56 #define CLK_BASE_INNER(seg) \
57 	CLK_BASE__INST0_SEG ## seg
58 
59 
60 static const struct clk_mgr_registers clk_mgr_regs = {
61 	CLK_REG_LIST_NV10()
62 };
63 
64 static const struct clk_mgr_shift clk_mgr_shift = {
65 	CLK_MASK_SH_LIST_NV10(__SHIFT)
66 };
67 
68 static const struct clk_mgr_mask clk_mgr_mask = {
69 	CLK_MASK_SH_LIST_NV10(_MASK)
70 };
71 
72 uint32_t dentist_get_did_from_divider(int divider)
73 {
74 	uint32_t divider_id;
75 
76 	/* we want to floor here to get higher clock than required rather than lower */
77 	if (divider < DENTIST_DIVIDER_RANGE_2_START) {
78 		if (divider < DENTIST_DIVIDER_RANGE_1_START)
79 			divider_id = DENTIST_BASE_DID_1;
80 		else
81 			divider_id = DENTIST_BASE_DID_1
82 				+ (divider - DENTIST_DIVIDER_RANGE_1_START)
83 					/ DENTIST_DIVIDER_RANGE_1_STEP;
84 	} else if (divider < DENTIST_DIVIDER_RANGE_3_START) {
85 		divider_id = DENTIST_BASE_DID_2
86 				+ (divider - DENTIST_DIVIDER_RANGE_2_START)
87 					/ DENTIST_DIVIDER_RANGE_2_STEP;
88 	} else if (divider < DENTIST_DIVIDER_RANGE_4_START) {
89 		divider_id = DENTIST_BASE_DID_3
90 				+ (divider - DENTIST_DIVIDER_RANGE_3_START)
91 					/ DENTIST_DIVIDER_RANGE_3_STEP;
92 	} else {
93 		divider_id = DENTIST_BASE_DID_4
94 				+ (divider - DENTIST_DIVIDER_RANGE_4_START)
95 					/ DENTIST_DIVIDER_RANGE_4_STEP;
96 		if (divider_id > DENTIST_MAX_DID)
97 			divider_id = DENTIST_MAX_DID;
98 	}
99 
100 	return divider_id;
101 }
102 
103 void dcn20_update_clocks_update_dpp_dto(struct clk_mgr_internal *clk_mgr,
104 		struct dc_state *context, bool safe_to_lower)
105 {
106 	int i;
107 
108 	clk_mgr->dccg->ref_dppclk = clk_mgr->base.clks.dppclk_khz;
109 	for (i = 0; i < clk_mgr->base.ctx->dc->res_pool->pipe_count; i++) {
110 		int dpp_inst, dppclk_khz, prev_dppclk_khz;
111 
112 		/* Loop index will match dpp->inst if resource exists,
113 		 * and we want to avoid dependency on dpp object
114 		 */
115 		dpp_inst = i;
116 		dppclk_khz = context->res_ctx.pipe_ctx[i].plane_res.bw.dppclk_khz;
117 
118 		prev_dppclk_khz = clk_mgr->dccg->pipe_dppclk_khz[i];
119 
120 		if (safe_to_lower || prev_dppclk_khz < dppclk_khz)
121 			clk_mgr->dccg->funcs->update_dpp_dto(
122 							clk_mgr->dccg, dpp_inst, dppclk_khz);
123 	}
124 }
125 
126 void dcn20_update_clocks_update_dentist(struct clk_mgr_internal *clk_mgr)
127 {
128 	int dpp_divider = DENTIST_DIVIDER_RANGE_SCALE_FACTOR
129 			* clk_mgr->base.dentist_vco_freq_khz / clk_mgr->base.clks.dppclk_khz;
130 	int disp_divider = DENTIST_DIVIDER_RANGE_SCALE_FACTOR
131 			* clk_mgr->base.dentist_vco_freq_khz / clk_mgr->base.clks.dispclk_khz;
132 
133 	uint32_t dppclk_wdivider = dentist_get_did_from_divider(dpp_divider);
134 	uint32_t dispclk_wdivider = dentist_get_did_from_divider(disp_divider);
135 
136 	REG_UPDATE(DENTIST_DISPCLK_CNTL,
137 			DENTIST_DISPCLK_WDIVIDER, dispclk_wdivider);
138 //	REG_WAIT(DENTIST_DISPCLK_CNTL, DENTIST_DISPCLK_CHG_DONE, 1, 5, 100);
139 	REG_UPDATE(DENTIST_DISPCLK_CNTL,
140 			DENTIST_DPPCLK_WDIVIDER, dppclk_wdivider);
141 	REG_WAIT(DENTIST_DISPCLK_CNTL, DENTIST_DPPCLK_CHG_DONE, 1, 5, 100);
142 }
143 
144 
145 void dcn2_update_clocks(struct clk_mgr *clk_mgr_base,
146 			struct dc_state *context,
147 			bool safe_to_lower)
148 {
149 	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
150 	struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;
151 	struct dc *dc = clk_mgr_base->ctx->dc;
152 	struct pp_smu_funcs_nv *pp_smu = NULL;
153 	int display_count;
154 	bool update_dppclk = false;
155 	bool update_dispclk = false;
156 	bool enter_display_off = false;
157 	bool dpp_clock_lowered = false;
158 	struct dmcu *dmcu = clk_mgr_base->ctx->dc->res_pool->dmcu;
159 	bool force_reset = false;
160 	bool p_state_change_support;
161 	int total_plane_count;
162 
163 	if (dc->work_arounds.skip_clock_update)
164 		return;
165 
166 	if (clk_mgr_base->clks.dispclk_khz == 0 ||
167 		dc->debug.force_clock_mode & 0x1) {
168 		//this is from resume or boot up, if forced_clock cfg option used, we bypass program dispclk and DPPCLK, but need set them for S3.
169 		force_reset = true;
170 
171 		dcn2_read_clocks_from_hw_dentist(clk_mgr_base);
172 
173 		//force_clock_mode 0x1:  force reset the clock even it is the same clock as long as it is in Passive level.
174 	}
175 	display_count = clk_mgr_helper_get_active_display_cnt(dc, context);
176 	if (dc->res_pool->pp_smu)
177 		pp_smu = &dc->res_pool->pp_smu->nv_funcs;
178 
179 	if (display_count == 0)
180 		enter_display_off = true;
181 
182 	if (enter_display_off == safe_to_lower) {
183 		if (pp_smu && pp_smu->set_display_count)
184 			pp_smu->set_display_count(&pp_smu->pp_smu, display_count);
185 	}
186 
187 	if (should_set_clock(safe_to_lower, new_clocks->phyclk_khz, clk_mgr_base->clks.phyclk_khz)) {
188 		clk_mgr_base->clks.phyclk_khz = new_clocks->phyclk_khz;
189 		if (pp_smu && pp_smu->set_voltage_by_freq)
190 			pp_smu->set_voltage_by_freq(&pp_smu->pp_smu, PP_SMU_NV_PHYCLK, clk_mgr_base->clks.phyclk_khz / 1000);
191 	}
192 
193 
194 	if (dc->debug.force_min_dcfclk_mhz > 0)
195 		new_clocks->dcfclk_khz = (new_clocks->dcfclk_khz > (dc->debug.force_min_dcfclk_mhz * 1000)) ?
196 				new_clocks->dcfclk_khz : (dc->debug.force_min_dcfclk_mhz * 1000);
197 
198 	if (should_set_clock(safe_to_lower, new_clocks->dcfclk_khz, clk_mgr_base->clks.dcfclk_khz)) {
199 		clk_mgr_base->clks.dcfclk_khz = new_clocks->dcfclk_khz;
200 		if (pp_smu && pp_smu->set_hard_min_dcfclk_by_freq)
201 			pp_smu->set_hard_min_dcfclk_by_freq(&pp_smu->pp_smu, clk_mgr_base->clks.dcfclk_khz / 1000);
202 	}
203 
204 	if (should_set_clock(safe_to_lower,
205 			new_clocks->dcfclk_deep_sleep_khz, clk_mgr_base->clks.dcfclk_deep_sleep_khz)) {
206 		clk_mgr_base->clks.dcfclk_deep_sleep_khz = new_clocks->dcfclk_deep_sleep_khz;
207 		if (pp_smu && pp_smu->set_min_deep_sleep_dcfclk)
208 			pp_smu->set_min_deep_sleep_dcfclk(&pp_smu->pp_smu, clk_mgr_base->clks.dcfclk_deep_sleep_khz / 1000);
209 	}
210 
211 	if (should_set_clock(safe_to_lower, new_clocks->socclk_khz, clk_mgr_base->clks.socclk_khz)) {
212 		clk_mgr_base->clks.socclk_khz = new_clocks->socclk_khz;
213 		if (pp_smu && pp_smu->set_hard_min_socclk_by_freq)
214 			pp_smu->set_hard_min_socclk_by_freq(&pp_smu->pp_smu, clk_mgr_base->clks.socclk_khz / 1000);
215 	}
216 
217 	total_plane_count = clk_mgr_helper_get_active_plane_cnt(dc, context);
218 	p_state_change_support = new_clocks->p_state_change_support || (total_plane_count == 0);
219 	if (should_update_pstate_support(safe_to_lower, p_state_change_support, clk_mgr_base->clks.p_state_change_support)) {
220 		clk_mgr_base->clks.prev_p_state_change_support = clk_mgr_base->clks.p_state_change_support;
221 		clk_mgr_base->clks.p_state_change_support = p_state_change_support;
222 		if (pp_smu && pp_smu->set_pstate_handshake_support)
223 			pp_smu->set_pstate_handshake_support(&pp_smu->pp_smu, clk_mgr_base->clks.p_state_change_support);
224 	}
225 
226 	if (should_set_clock(safe_to_lower, new_clocks->dramclk_khz, clk_mgr_base->clks.dramclk_khz)) {
227 		clk_mgr_base->clks.dramclk_khz = new_clocks->dramclk_khz;
228 		if (pp_smu && pp_smu->set_hard_min_uclk_by_freq)
229 			pp_smu->set_hard_min_uclk_by_freq(&pp_smu->pp_smu, clk_mgr_base->clks.dramclk_khz / 1000);
230 	}
231 
232 	if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) {
233 		if (clk_mgr->base.clks.dppclk_khz > new_clocks->dppclk_khz)
234 			dpp_clock_lowered = true;
235 		clk_mgr->base.clks.dppclk_khz = new_clocks->dppclk_khz;
236 
237 		if (pp_smu && pp_smu->set_voltage_by_freq)
238 			pp_smu->set_voltage_by_freq(&pp_smu->pp_smu, PP_SMU_NV_PIXELCLK, clk_mgr_base->clks.dppclk_khz / 1000);
239 
240 		update_dppclk = true;
241 	}
242 
243 	if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) {
244 		clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz;
245 		if (pp_smu && pp_smu->set_voltage_by_freq)
246 			pp_smu->set_voltage_by_freq(&pp_smu->pp_smu, PP_SMU_NV_DISPCLK, clk_mgr_base->clks.dispclk_khz / 1000);
247 
248 		update_dispclk = true;
249 	}
250 
251 	if (dc->config.forced_clocks == false || (force_reset && safe_to_lower)) {
252 		if (dpp_clock_lowered) {
253 			// if clock is being lowered, increase DTO before lowering refclk
254 			dcn20_update_clocks_update_dpp_dto(clk_mgr, context, safe_to_lower);
255 			dcn20_update_clocks_update_dentist(clk_mgr);
256 		} else {
257 			// if clock is being raised, increase refclk before lowering DTO
258 			if (update_dppclk || update_dispclk)
259 				dcn20_update_clocks_update_dentist(clk_mgr);
260 			// always update dtos unless clock is lowered and not safe to lower
261 			if (new_clocks->dppclk_khz >= dc->current_state->bw_ctx.bw.dcn.clk.dppclk_khz)
262 				dcn20_update_clocks_update_dpp_dto(clk_mgr, context, safe_to_lower);
263 		}
264 	}
265 
266 	if (update_dispclk &&
267 			dmcu && dmcu->funcs->is_dmcu_initialized(dmcu)) {
268 		/*update dmcu for wait_loop count*/
269 		dmcu->funcs->set_psr_wait_loop(dmcu,
270 			clk_mgr_base->clks.dispclk_khz / 1000 / 7);
271 	}
272 }
273 
274 void dcn2_update_clocks_fpga(struct clk_mgr *clk_mgr,
275 		struct dc_state *context,
276 		bool safe_to_lower)
277 {
278 	struct clk_mgr_internal *clk_mgr_int = TO_CLK_MGR_INTERNAL(clk_mgr);
279 
280 	struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;
281 	/* Min fclk = 1.2GHz since all the extra scemi logic seems to run off of it */
282 	int fclk_adj = new_clocks->fclk_khz > 1200000 ? new_clocks->fclk_khz : 1200000;
283 
284 	if (should_set_clock(safe_to_lower, new_clocks->phyclk_khz, clk_mgr->clks.phyclk_khz)) {
285 		clk_mgr->clks.phyclk_khz = new_clocks->phyclk_khz;
286 	}
287 
288 	if (should_set_clock(safe_to_lower, new_clocks->dcfclk_khz, clk_mgr->clks.dcfclk_khz)) {
289 		clk_mgr->clks.dcfclk_khz = new_clocks->dcfclk_khz;
290 	}
291 
292 	if (should_set_clock(safe_to_lower,
293 			new_clocks->dcfclk_deep_sleep_khz, clk_mgr->clks.dcfclk_deep_sleep_khz)) {
294 		clk_mgr->clks.dcfclk_deep_sleep_khz = new_clocks->dcfclk_deep_sleep_khz;
295 	}
296 
297 	if (should_set_clock(safe_to_lower, new_clocks->socclk_khz, clk_mgr->clks.socclk_khz)) {
298 		clk_mgr->clks.socclk_khz = new_clocks->socclk_khz;
299 	}
300 
301 	if (should_set_clock(safe_to_lower, new_clocks->dramclk_khz, clk_mgr->clks.dramclk_khz)) {
302 		clk_mgr->clks.dramclk_khz = new_clocks->dramclk_khz;
303 	}
304 
305 	if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->clks.dppclk_khz)) {
306 		clk_mgr->clks.dppclk_khz = new_clocks->dppclk_khz;
307 	}
308 
309 	if (should_set_clock(safe_to_lower, fclk_adj, clk_mgr->clks.fclk_khz)) {
310 		clk_mgr->clks.fclk_khz = fclk_adj;
311 	}
312 
313 	if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr->clks.dispclk_khz)) {
314 		clk_mgr->clks.dispclk_khz = new_clocks->dispclk_khz;
315 	}
316 
317 	/* Both fclk and ref_dppclk run on the same scemi clock.
318 	 * So take the higher value since the DPP DTO is typically programmed
319 	 * such that max dppclk is 1:1 with ref_dppclk.
320 	 */
321 	if (clk_mgr->clks.fclk_khz > clk_mgr->clks.dppclk_khz)
322 		clk_mgr->clks.dppclk_khz = clk_mgr->clks.fclk_khz;
323 	if (clk_mgr->clks.dppclk_khz > clk_mgr->clks.fclk_khz)
324 		clk_mgr->clks.fclk_khz = clk_mgr->clks.dppclk_khz;
325 
326 	// Both fclk and ref_dppclk run on the same scemi clock.
327 	clk_mgr_int->dccg->ref_dppclk = clk_mgr->clks.fclk_khz;
328 
329 	dm_set_dcn_clocks(clk_mgr->ctx, &clk_mgr->clks);
330 }
331 
332 void dcn2_init_clocks(struct clk_mgr *clk_mgr)
333 {
334 	memset(&(clk_mgr->clks), 0, sizeof(struct dc_clocks));
335 	// Assumption is that boot state always supports pstate
336 	clk_mgr->clks.p_state_change_support = true;
337 	clk_mgr->clks.prev_p_state_change_support = true;
338 }
339 
340 void dcn2_enable_pme_wa(struct clk_mgr *clk_mgr_base)
341 {
342 	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
343 	struct pp_smu_funcs_nv *pp_smu = NULL;
344 
345 	if (clk_mgr->pp_smu) {
346 		pp_smu = &clk_mgr->pp_smu->nv_funcs;
347 
348 		if (pp_smu->set_pme_wa_enable)
349 			pp_smu->set_pme_wa_enable(&pp_smu->pp_smu);
350 	}
351 }
352 
353 
354 void dcn2_read_clocks_from_hw_dentist(struct clk_mgr *clk_mgr_base)
355 {
356 	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
357 	uint32_t dispclk_wdivider;
358 	uint32_t dppclk_wdivider;
359 	int disp_divider;
360 	int dpp_divider;
361 
362 	REG_GET(DENTIST_DISPCLK_CNTL, DENTIST_DISPCLK_WDIVIDER, &dispclk_wdivider);
363 	REG_GET(DENTIST_DISPCLK_CNTL, DENTIST_DPPCLK_WDIVIDER, &dppclk_wdivider);
364 
365 	disp_divider = dentist_get_divider_from_did(dispclk_wdivider);
366 	dpp_divider = dentist_get_divider_from_did(dispclk_wdivider);
367 
368 	if (disp_divider && dpp_divider) {
369 		/* Calculate the current DFS clock, in kHz.*/
370 		clk_mgr_base->clks.dispclk_khz = (DENTIST_DIVIDER_RANGE_SCALE_FACTOR
371 			* clk_mgr->base.dentist_vco_freq_khz) / disp_divider;
372 
373 		clk_mgr_base->clks.dppclk_khz = (DENTIST_DIVIDER_RANGE_SCALE_FACTOR
374 				* clk_mgr->base.dentist_vco_freq_khz) / dpp_divider;
375 	}
376 
377 }
378 
379 void dcn2_get_clock(struct clk_mgr *clk_mgr,
380 		struct dc_state *context,
381 			enum dc_clock_type clock_type,
382 			struct dc_clock_config *clock_cfg)
383 {
384 
385 	if (clock_type == DC_CLOCK_TYPE_DISPCLK) {
386 		clock_cfg->max_clock_khz = context->bw_ctx.bw.dcn.clk.max_supported_dispclk_khz;
387 		clock_cfg->min_clock_khz = DCN_MINIMUM_DISPCLK_Khz;
388 		clock_cfg->current_clock_khz = clk_mgr->clks.dispclk_khz;
389 		clock_cfg->bw_requirequired_clock_khz = context->bw_ctx.bw.dcn.clk.bw_dispclk_khz;
390 	}
391 	if (clock_type == DC_CLOCK_TYPE_DPPCLK) {
392 		clock_cfg->max_clock_khz = context->bw_ctx.bw.dcn.clk.max_supported_dppclk_khz;
393 		clock_cfg->min_clock_khz = DCN_MINIMUM_DPPCLK_Khz;
394 		clock_cfg->current_clock_khz = clk_mgr->clks.dppclk_khz;
395 		clock_cfg->bw_requirequired_clock_khz = context->bw_ctx.bw.dcn.clk.bw_dppclk_khz;
396 	}
397 }
398 
399 static bool dcn2_are_clock_states_equal(struct dc_clocks *a,
400 		struct dc_clocks *b)
401 {
402 	if (a->dispclk_khz != b->dispclk_khz)
403 		return false;
404 	else if (a->dppclk_khz != b->dppclk_khz)
405 		return false;
406 	else if (a->dcfclk_khz != b->dcfclk_khz)
407 		return false;
408 	else if (a->socclk_khz != b->socclk_khz)
409 		return false;
410 	else if (a->dcfclk_deep_sleep_khz != b->dcfclk_deep_sleep_khz)
411 		return false;
412 	else if (a->phyclk_khz != b->phyclk_khz)
413 		return false;
414 	else if (a->dramclk_khz != b->dramclk_khz)
415 		return false;
416 	else if (a->p_state_change_support != b->p_state_change_support)
417 		return false;
418 
419 	return true;
420 }
421 
422 static struct clk_mgr_funcs dcn2_funcs = {
423 	.get_dp_ref_clk_frequency = dce12_get_dp_ref_freq_khz,
424 	.update_clocks = dcn2_update_clocks,
425 	.init_clocks = dcn2_init_clocks,
426 	.enable_pme_wa = dcn2_enable_pme_wa,
427 	.get_clock = dcn2_get_clock,
428 	.are_clock_states_equal = dcn2_are_clock_states_equal,
429 };
430 
431 
432 void dcn20_clk_mgr_construct(
433 		struct dc_context *ctx,
434 		struct clk_mgr_internal *clk_mgr,
435 		struct pp_smu_funcs *pp_smu,
436 		struct dccg *dccg)
437 {
438 	clk_mgr->base.ctx = ctx;
439 	clk_mgr->pp_smu = pp_smu;
440 	clk_mgr->base.funcs = &dcn2_funcs;
441 	clk_mgr->regs = &clk_mgr_regs;
442 	clk_mgr->clk_mgr_shift = &clk_mgr_shift;
443 	clk_mgr->clk_mgr_mask = &clk_mgr_mask;
444 
445 	clk_mgr->dccg = dccg;
446 	clk_mgr->dfs_bypass_disp_clk = 0;
447 
448 	clk_mgr->dprefclk_ss_percentage = 0;
449 	clk_mgr->dprefclk_ss_divider = 1000;
450 	clk_mgr->ss_on_dprefclk = false;
451 
452 	clk_mgr->base.dprefclk_khz = 700000; // 700 MHz planned if VCO is 3.85 GHz, will be retrieved
453 
454 	if (IS_FPGA_MAXIMUS_DC(ctx->dce_environment)) {
455 		dcn2_funcs.update_clocks = dcn2_update_clocks_fpga;
456 		clk_mgr->base.dentist_vco_freq_khz = 3850000;
457 
458 	} else {
459 		/* DFS Slice 2 should be used for DPREFCLK */
460 		int dprefclk_did = REG_READ(CLK3_CLK2_DFS_CNTL);
461 		/* Convert DPREFCLK DFS Slice DID to actual divider*/
462 		int target_div = dentist_get_divider_from_did(dprefclk_did);
463 
464 		/* get FbMult value */
465 		uint32_t pll_req_reg = REG_READ(CLK3_CLK_PLL_REQ);
466 		struct fixed31_32 pll_req;
467 
468 		/* set up a fixed-point number
469 		 * this works because the int part is on the right edge of the register
470 		 * and the frac part is on the left edge
471 		 */
472 
473 		pll_req = dc_fixpt_from_int(pll_req_reg & clk_mgr->clk_mgr_mask->FbMult_int);
474 		pll_req.value |= pll_req_reg & clk_mgr->clk_mgr_mask->FbMult_frac;
475 
476 		/* multiply by REFCLK period */
477 		pll_req = dc_fixpt_mul_int(pll_req, 100000);
478 
479 		/* integer part is now VCO frequency in kHz */
480 		clk_mgr->base.dentist_vco_freq_khz = dc_fixpt_floor(pll_req);
481 
482 		/* in case we don't get a value from the register, use default */
483 		if (clk_mgr->base.dentist_vco_freq_khz == 0)
484 			clk_mgr->base.dentist_vco_freq_khz = 3850000;
485 
486 		/* Calculate the DPREFCLK in kHz.*/
487 		clk_mgr->base.dprefclk_khz = (DENTIST_DIVIDER_RANGE_SCALE_FACTOR
488 			* clk_mgr->base.dentist_vco_freq_khz) / target_div;
489 	}
490 	//Integrated_info table does not exist on dGPU projects so should not be referenced
491 	//anywhere in code for dGPUs.
492 	//Also there is no plan for now that DFS BYPASS will be used on NV10/12/14.
493 	clk_mgr->dfs_bypass_enabled = false;
494 
495 	dce_clock_read_ss_info(clk_mgr);
496 }
497 
498