Commit fab55d61 authored by Dmytro Laktyushkin's avatar Dmytro Laktyushkin Committed by Alex Deucher

drm/amd/display: redesign dce/dcn clock voltage update request

The goal of this change is to move clock programming and voltage
requests to a single function. As of this change only dce is affected.
Signed-off-by: default avatarDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 765b2683
...@@ -1145,10 +1145,10 @@ static unsigned int dcn_find_normalized_clock_vdd_Level( ...@@ -1145,10 +1145,10 @@ static unsigned int dcn_find_normalized_clock_vdd_Level(
switch (clocks_type) { switch (clocks_type) {
case DM_PP_CLOCK_TYPE_DISPLAY_CLK: case DM_PP_CLOCK_TYPE_DISPLAY_CLK:
/*if (clocks_in_khz > dc->dcn_soc->max_dispclk_vmax0p9*1000) { if (clocks_in_khz > dc->dcn_soc->max_dispclk_vmax0p9*1000) {
vdd_level = dcn_bw_v_max0p91; vdd_level = dcn_bw_v_max0p91;
//BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
} else*/ if (clocks_in_khz > dc->dcn_soc->max_dispclk_vnom0p8*1000) { } else if (clocks_in_khz > dc->dcn_soc->max_dispclk_vnom0p8*1000) {
vdd_level = dcn_bw_v_max0p9; vdd_level = dcn_bw_v_max0p9;
} else if (clocks_in_khz > dc->dcn_soc->max_dispclk_vmid0p72*1000) { } else if (clocks_in_khz > dc->dcn_soc->max_dispclk_vmid0p72*1000) {
vdd_level = dcn_bw_v_nom0p8; vdd_level = dcn_bw_v_nom0p8;
...@@ -1158,10 +1158,10 @@ static unsigned int dcn_find_normalized_clock_vdd_Level( ...@@ -1158,10 +1158,10 @@ static unsigned int dcn_find_normalized_clock_vdd_Level(
vdd_level = dcn_bw_v_min0p65; vdd_level = dcn_bw_v_min0p65;
break; break;
case DM_PP_CLOCK_TYPE_DISPLAYPHYCLK: case DM_PP_CLOCK_TYPE_DISPLAYPHYCLK:
/*if (clocks_in_khz > dc->dcn_soc->phyclkv_max0p9*1000) { if (clocks_in_khz > dc->dcn_soc->phyclkv_max0p9*1000) {
vdd_level = dcn_bw_v_max0p91; vdd_level = dcn_bw_v_max0p91;
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
} else*/ if (clocks_in_khz > dc->dcn_soc->phyclkv_nom0p8*1000) { } else if (clocks_in_khz > dc->dcn_soc->phyclkv_nom0p8*1000) {
vdd_level = dcn_bw_v_max0p9; vdd_level = dcn_bw_v_max0p9;
} else if (clocks_in_khz > dc->dcn_soc->phyclkv_mid0p72*1000) { } else if (clocks_in_khz > dc->dcn_soc->phyclkv_mid0p72*1000) {
vdd_level = dcn_bw_v_nom0p8; vdd_level = dcn_bw_v_nom0p8;
...@@ -1172,10 +1172,10 @@ static unsigned int dcn_find_normalized_clock_vdd_Level( ...@@ -1172,10 +1172,10 @@ static unsigned int dcn_find_normalized_clock_vdd_Level(
break; break;
case DM_PP_CLOCK_TYPE_DPPCLK: case DM_PP_CLOCK_TYPE_DPPCLK:
/*if (clocks_in_khz > dc->dcn_soc->max_dppclk_vmax0p9*1000) { if (clocks_in_khz > dc->dcn_soc->max_dppclk_vmax0p9*1000) {
vdd_level = dcn_bw_v_max0p91; vdd_level = dcn_bw_v_max0p91;
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
} else*/ if (clocks_in_khz > dc->dcn_soc->max_dppclk_vnom0p8*1000) { } else if (clocks_in_khz > dc->dcn_soc->max_dppclk_vnom0p8*1000) {
vdd_level = dcn_bw_v_max0p9; vdd_level = dcn_bw_v_max0p9;
} else if (clocks_in_khz > dc->dcn_soc->max_dppclk_vmid0p72*1000) { } else if (clocks_in_khz > dc->dcn_soc->max_dppclk_vmid0p72*1000) {
vdd_level = dcn_bw_v_nom0p8; vdd_level = dcn_bw_v_nom0p8;
...@@ -1189,10 +1189,10 @@ static unsigned int dcn_find_normalized_clock_vdd_Level( ...@@ -1189,10 +1189,10 @@ static unsigned int dcn_find_normalized_clock_vdd_Level(
{ {
unsigned factor = (ddr4_dram_factor_single_Channel * dc->dcn_soc->number_of_channels); unsigned factor = (ddr4_dram_factor_single_Channel * dc->dcn_soc->number_of_channels);
/*if (clocks_in_khz > dc->dcn_soc->fabric_and_dram_bandwidth_vmax0p9*1000000/factor) { if (clocks_in_khz > dc->dcn_soc->fabric_and_dram_bandwidth_vmax0p9*1000000/factor) {
vdd_level = dcn_bw_v_max0p91; vdd_level = dcn_bw_v_max0p91;
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
} else */if (clocks_in_khz > dc->dcn_soc->fabric_and_dram_bandwidth_vnom0p8*1000000/factor) { } else if (clocks_in_khz > dc->dcn_soc->fabric_and_dram_bandwidth_vnom0p8*1000000/factor) {
vdd_level = dcn_bw_v_max0p9; vdd_level = dcn_bw_v_max0p9;
} else if (clocks_in_khz > dc->dcn_soc->fabric_and_dram_bandwidth_vmid0p72*1000000/factor) { } else if (clocks_in_khz > dc->dcn_soc->fabric_and_dram_bandwidth_vmid0p72*1000000/factor) {
vdd_level = dcn_bw_v_nom0p8; vdd_level = dcn_bw_v_nom0p8;
...@@ -1204,10 +1204,10 @@ static unsigned int dcn_find_normalized_clock_vdd_Level( ...@@ -1204,10 +1204,10 @@ static unsigned int dcn_find_normalized_clock_vdd_Level(
break; break;
case DM_PP_CLOCK_TYPE_DCFCLK: case DM_PP_CLOCK_TYPE_DCFCLK:
/*if (clocks_in_khz > dc->dcn_soc->dcfclkv_max0p9*1000) { if (clocks_in_khz > dc->dcn_soc->dcfclkv_max0p9*1000) {
vdd_level = dcn_bw_v_max0p91; vdd_level = dcn_bw_v_max0p91;
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
} else */if (clocks_in_khz > dc->dcn_soc->dcfclkv_nom0p8*1000) { } else if (clocks_in_khz > dc->dcn_soc->dcfclkv_nom0p8*1000) {
vdd_level = dcn_bw_v_max0p9; vdd_level = dcn_bw_v_max0p9;
} else if (clocks_in_khz > dc->dcn_soc->dcfclkv_mid0p72*1000) { } else if (clocks_in_khz > dc->dcn_soc->dcfclkv_mid0p72*1000) {
vdd_level = dcn_bw_v_nom0p8; vdd_level = dcn_bw_v_nom0p8;
......
...@@ -1284,27 +1284,15 @@ static enum dc_status enable_link_dp( ...@@ -1284,27 +1284,15 @@ static enum dc_status enable_link_dp(
max_link_rate = LINK_RATE_HIGH3; max_link_rate = LINK_RATE_HIGH3;
if (link_settings.link_rate == max_link_rate) { if (link_settings.link_rate == max_link_rate) {
if (state->dis_clk->funcs->set_min_clocks_state) { struct dc_clocks clocks = state->bw.dcn.calc_clk;
if (state->dis_clk->cur_min_clks_state < DM_PP_CLOCKS_STATE_NOMINAL)
state->dis_clk->funcs->set_min_clocks_state( /* dce/dcn compat, do not update dispclk */
state->dis_clk, DM_PP_CLOCKS_STATE_NOMINAL); clocks.dispclk_khz = 0;
} else { /* 27mhz = 27000000hz= 27000khz */
uint32_t dp_phyclk_in_khz; clocks.phyclk_khz = link_settings.link_rate * 27000;
const struct dc_clocks clocks_value =
state->dis_clk->clks; state->dis_clk->funcs->update_clocks(
state->dis_clk, &clocks, false);
/* 27mhz = 27000000hz= 27000khz */
dp_phyclk_in_khz = link_settings.link_rate * 27000;
if (dp_phyclk_in_khz > clocks_value.phyclk_khz) {
state->dis_clk->funcs->apply_clock_voltage_request(
state->dis_clk,
DM_PP_CLOCK_TYPE_DISPLAYPHYCLK,
dp_phyclk_in_khz,
false,
true);
}
}
} }
dp_enable_link_phy( dp_enable_link_phy(
......
...@@ -91,7 +91,6 @@ struct dce_disp_clk { ...@@ -91,7 +91,6 @@ struct dce_disp_clk {
struct state_dependent_clocks max_clks_by_state[DM_PP_CLOCKS_MAX_STATES]; struct state_dependent_clocks max_clks_by_state[DM_PP_CLOCKS_MAX_STATES];
struct dce_divider_range divider_ranges[DIVIDER_RANGE_MAX]; struct dce_divider_range divider_ranges[DIVIDER_RANGE_MAX];
bool use_max_disp_clk;
int dentist_vco_freq_khz; int dentist_vco_freq_khz;
/* Cache the status of DFS-bypass feature*/ /* Cache the status of DFS-bypass feature*/
...@@ -106,9 +105,6 @@ struct dce_disp_clk { ...@@ -106,9 +105,6 @@ struct dce_disp_clk {
int dprefclk_ss_percentage; int dprefclk_ss_percentage;
/* DPREFCLK SS percentage Divider (100 or 1000) */ /* DPREFCLK SS percentage Divider (100 or 1000) */
int dprefclk_ss_divider; int dprefclk_ss_divider;
/* max disp_clk from PPLIB for max validation display clock*/
int max_displ_clk_in_khz;
}; };
...@@ -132,6 +128,8 @@ struct display_clock *dce112_disp_clk_create( ...@@ -132,6 +128,8 @@ struct display_clock *dce112_disp_clk_create(
struct display_clock *dce120_disp_clk_create(struct dc_context *ctx); struct display_clock *dce120_disp_clk_create(struct dc_context *ctx);
struct display_clock *dcn_disp_clk_create(struct dc_context *ctx);
void dce_disp_clk_destroy(struct display_clock **disp_clk); void dce_disp_clk_destroy(struct display_clock **disp_clk);
#endif /* _DCE_CLOCKS_H_ */ #endif /* _DCE_CLOCKS_H_ */
...@@ -125,17 +125,54 @@ static void dce100_pplib_apply_display_requirements( ...@@ -125,17 +125,54 @@ static void dce100_pplib_apply_display_requirements(
dc->prev_display_config = *pp_display_cfg; dc->prev_display_config = *pp_display_cfg;
} }
/* unit: in_khz before mode set, get pixel clock from context. ASIC register
* may not be programmed yet
*/
static uint32_t get_max_pixel_clock_for_all_paths(
struct dc *dc,
struct dc_state *context)
{
uint32_t max_pix_clk = 0;
int i;
for (i = 0; i < MAX_PIPES; i++) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
if (pipe_ctx->stream == NULL)
continue;
/* do not check under lay */
if (pipe_ctx->top_pipe)
continue;
if (pipe_ctx->stream_res.pix_clk_params.requested_pix_clk > max_pix_clk)
max_pix_clk =
pipe_ctx->stream_res.pix_clk_params.requested_pix_clk;
}
if (max_pix_clk == 0)
ASSERT(0);
return max_pix_clk;
}
void dce100_set_bandwidth( void dce100_set_bandwidth(
struct dc *dc, struct dc *dc,
struct dc_state *context, struct dc_state *context,
bool decrease_allowed) bool decrease_allowed)
{ {
if (decrease_allowed || context->bw.dce.dispclk_khz > dc->current_state->bw.dce.dispclk_khz) { struct dc_clocks req_clks;
dc->res_pool->display_clock->funcs->set_clock(
dc->res_pool->display_clock, req_clks.dispclk_khz = context->bw.dce.dispclk_khz * 115 / 100;
context->bw.dce.dispclk_khz * 115 / 100); req_clks.phyclk_khz = get_max_pixel_clock_for_all_paths(dc, context);
dc->current_state->bw.dce.dispclk_khz = context->bw.dce.dispclk_khz;
} dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool);
dc->res_pool->display_clock->funcs->update_clocks(
dc->res_pool->display_clock,
&req_clks,
decrease_allowed);
dce100_pplib_apply_display_requirements(dc, context); dce100_pplib_apply_display_requirements(dc, context);
} }
......
...@@ -1663,7 +1663,7 @@ static void dce110_set_displaymarks( ...@@ -1663,7 +1663,7 @@ static void dce110_set_displaymarks(
} }
} }
static void set_safe_displaymarks( void dce110_set_safe_displaymarks(
struct resource_context *res_ctx, struct resource_context *res_ctx,
const struct resource_pool *pool) const struct resource_pool *pool)
{ {
...@@ -1755,23 +1755,15 @@ static void set_static_screen_control(struct pipe_ctx **pipe_ctx, ...@@ -1755,23 +1755,15 @@ static void set_static_screen_control(struct pipe_ctx **pipe_ctx,
} }
/* unit: in_khz before mode set, get pixel clock from context. ASIC register /* unit: in_khz before mode set, get pixel clock from context. ASIC register
* may not be programmed yet. * may not be programmed yet
* TODO: after mode set, pre_mode_set = false,
* may read PLL register to get pixel clock
*/ */
static uint32_t get_max_pixel_clock_for_all_paths( static uint32_t get_max_pixel_clock_for_all_paths(
struct dc *dc, struct dc *dc,
struct dc_state *context, struct dc_state *context)
bool pre_mode_set)
{ {
uint32_t max_pix_clk = 0; uint32_t max_pix_clk = 0;
int i; int i;
if (!pre_mode_set) {
/* TODO: read ASIC register to get pixel clock */
ASSERT(0);
}
for (i = 0; i < MAX_PIPES; i++) { for (i = 0; i < MAX_PIPES; i++) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
...@@ -1793,74 +1785,6 @@ static uint32_t get_max_pixel_clock_for_all_paths( ...@@ -1793,74 +1785,6 @@ static uint32_t get_max_pixel_clock_for_all_paths(
return max_pix_clk; return max_pix_clk;
} }
/*
* Find clock state based on clock requested. if clock value is 0, simply
* set clock state as requested without finding clock state by clock value
*/
static void apply_min_clocks(
struct dc *dc,
struct dc_state *context,
enum dm_pp_clocks_state *clocks_state,
bool pre_mode_set)
{
struct state_dependent_clocks req_clocks = {0};
if (!pre_mode_set) {
/* set clock_state without verification */
if (context->dis_clk->funcs->set_min_clocks_state) {
context->dis_clk->funcs->set_min_clocks_state(
context->dis_clk, *clocks_state);
return;
}
/* TODO: This is incorrect. Figure out how to fix. */
context->dis_clk->funcs->apply_clock_voltage_request(
context->dis_clk,
DM_PP_CLOCK_TYPE_DISPLAY_CLK,
context->dis_clk->clks.dispclk_khz,
pre_mode_set,
false);
context->dis_clk->funcs->apply_clock_voltage_request(
context->dis_clk,
DM_PP_CLOCK_TYPE_DISPLAYPHYCLK,
context->dis_clk->clks.phyclk_khz,
pre_mode_set,
false);
return;
}
/* get the required state based on state dependent clocks:
* display clock and pixel clock
*/
req_clocks.display_clk_khz = context->bw.dce.dispclk_khz;
req_clocks.pixel_clk_khz = get_max_pixel_clock_for_all_paths(
dc, context, true);
if (context->dis_clk->funcs->get_required_clocks_state) {
*clocks_state = context->dis_clk->funcs->get_required_clocks_state(
context->dis_clk, &req_clocks);
context->dis_clk->funcs->set_min_clocks_state(
context->dis_clk, *clocks_state);
} else {
context->dis_clk->funcs->apply_clock_voltage_request(
context->dis_clk,
DM_PP_CLOCK_TYPE_DISPLAY_CLK,
req_clocks.display_clk_khz,
pre_mode_set,
false);
context->dis_clk->funcs->apply_clock_voltage_request(
context->dis_clk,
DM_PP_CLOCK_TYPE_DISPLAYPHYCLK,
req_clocks.pixel_clk_khz,
pre_mode_set,
false);
}
}
/* /*
* Check if FBC can be enabled * Check if FBC can be enabled
*/ */
...@@ -2079,7 +2003,6 @@ enum dc_status dce110_apply_ctx_to_hw( ...@@ -2079,7 +2003,6 @@ enum dc_status dce110_apply_ctx_to_hw(
struct dc_bios *dcb = dc->ctx->dc_bios; struct dc_bios *dcb = dc->ctx->dc_bios;
enum dc_status status; enum dc_status status;
int i; int i;
enum dm_pp_clocks_state clocks_state = DM_PP_CLOCKS_STATE_INVALID;
/* Reset old context */ /* Reset old context */
/* look up the targets that have been removed since last commit */ /* look up the targets that have been removed since last commit */
...@@ -2113,54 +2036,10 @@ enum dc_status dce110_apply_ctx_to_hw( ...@@ -2113,54 +2036,10 @@ enum dc_status dce110_apply_ctx_to_hw(
PIPE_GATING_CONTROL_DISABLE); PIPE_GATING_CONTROL_DISABLE);
} }
set_safe_displaymarks(&context->res_ctx, dc->res_pool);
if (dc->fbc_compressor) if (dc->fbc_compressor)
dc->fbc_compressor->funcs->disable_fbc(dc->fbc_compressor); dc->fbc_compressor->funcs->disable_fbc(dc->fbc_compressor);
/*TODO: when pplib works*/ dc->hwss.set_bandwidth(dc, context, false);
apply_min_clocks(dc, context, &clocks_state, true);
#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
if (dc->ctx->dce_version >= DCN_VERSION_1_0) {
if (context->bw.dcn.calc_clk.fclk_khz
> dc->current_state->bw.dcn.cur_clk.fclk_khz) {
struct dm_pp_clock_for_voltage_req clock;
clock.clk_type = DM_PP_CLOCK_TYPE_FCLK;
clock.clocks_in_khz = context->bw.dcn.calc_clk.fclk_khz;
dm_pp_apply_clock_for_voltage_request(dc->ctx, &clock);
dc->current_state->bw.dcn.cur_clk.fclk_khz = clock.clocks_in_khz;
context->bw.dcn.cur_clk.fclk_khz = clock.clocks_in_khz;
}
if (context->bw.dcn.calc_clk.dcfclk_khz
> dc->current_state->bw.dcn.cur_clk.dcfclk_khz) {
struct dm_pp_clock_for_voltage_req clock;
clock.clk_type = DM_PP_CLOCK_TYPE_DCFCLK;
clock.clocks_in_khz = context->bw.dcn.calc_clk.dcfclk_khz;
dm_pp_apply_clock_for_voltage_request(dc->ctx, &clock);
dc->current_state->bw.dcn.cur_clk.dcfclk_khz = clock.clocks_in_khz;
context->bw.dcn.cur_clk.dcfclk_khz = clock.clocks_in_khz;
}
if (context->bw.dcn.calc_clk.dispclk_khz
> dc->current_state->bw.dcn.cur_clk.dispclk_khz) {
dc->res_pool->display_clock->funcs->set_clock(
dc->res_pool->display_clock,
context->bw.dcn.calc_clk.dispclk_khz);
dc->current_state->bw.dcn.cur_clk.dispclk_khz =
context->bw.dcn.calc_clk.dispclk_khz;
context->bw.dcn.cur_clk.dispclk_khz =
context->bw.dcn.calc_clk.dispclk_khz;
}
} else
#endif
if (context->bw.dce.dispclk_khz
> dc->current_state->bw.dce.dispclk_khz) {
dc->res_pool->display_clock->funcs->set_clock(
dc->res_pool->display_clock,
context->bw.dce.dispclk_khz * 115 / 100);
}
dce110_setup_audio_dto(dc, context); dce110_setup_audio_dto(dc, context);
...@@ -2191,7 +2070,7 @@ enum dc_status dce110_apply_ctx_to_hw( ...@@ -2191,7 +2070,7 @@ enum dc_status dce110_apply_ctx_to_hw(
} }
/* to save power */ /* to save power */
apply_min_clocks(dc, context, &clocks_state, false); dc->hwss.set_bandwidth(dc, context, true);
dcb->funcs->set_scratch_critical_state(dcb, false); dcb->funcs->set_scratch_critical_state(dcb, false);
...@@ -2680,15 +2559,20 @@ static void dce110_set_bandwidth( ...@@ -2680,15 +2559,20 @@ static void dce110_set_bandwidth(
struct dc_state *context, struct dc_state *context,
bool decrease_allowed) bool decrease_allowed)
{ {
dce110_set_displaymarks(dc, context); struct dc_clocks req_clks;
if (decrease_allowed || context->bw.dce.dispclk_khz > dc->current_state->bw.dce.dispclk_khz) { req_clks.dispclk_khz = context->bw.dce.dispclk_khz * 115 / 100;
dc->res_pool->display_clock->funcs->set_clock( req_clks.phyclk_khz = get_max_pixel_clock_for_all_paths(dc, context);
dc->res_pool->display_clock,
context->bw.dce.dispclk_khz * 115 / 100); if (decrease_allowed)
dc->current_state->bw.dce.dispclk_khz = context->bw.dce.dispclk_khz; dce110_set_displaymarks(dc, context);
} else
dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool);
dc->res_pool->display_clock->funcs->update_clocks(
dc->res_pool->display_clock,
&req_clks,
decrease_allowed);
pplib_apply_display_requirements(dc, context); pplib_apply_display_requirements(dc, context);
} }
......
...@@ -60,6 +60,10 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context); ...@@ -60,6 +60,10 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context);
void dce110_power_down(struct dc *dc); void dce110_power_down(struct dc *dc);
void dce110_set_safe_displaymarks(
struct resource_context *res_ctx,
const struct resource_pool *pool);
void dce110_fill_display_configs( void dce110_fill_display_configs(
const struct dc_state *context, const struct dc_state *context,
struct dm_pp_display_configuration *pp_display_cfg); struct dm_pp_display_configuration *pp_display_cfg);
......
...@@ -2424,7 +2424,7 @@ static void ramp_up_dispclk_with_dpp(struct dc *dc, struct dc_state *context) ...@@ -2424,7 +2424,7 @@ static void ramp_up_dispclk_with_dpp(struct dc *dc, struct dc_state *context)
int dispclk_to_dpp_threshold = determine_dppclk_threshold(dc, context); int dispclk_to_dpp_threshold = determine_dppclk_threshold(dc, context);
/* set disp clk to dpp clk threshold */ /* set disp clk to dpp clk threshold */
dc->res_pool->display_clock->funcs->set_clock( dc->res_pool->display_clock->funcs->set_dispclk(
dc->res_pool->display_clock, dc->res_pool->display_clock,
dispclk_to_dpp_threshold); dispclk_to_dpp_threshold);
...@@ -2443,7 +2443,7 @@ static void ramp_up_dispclk_with_dpp(struct dc *dc, struct dc_state *context) ...@@ -2443,7 +2443,7 @@ static void ramp_up_dispclk_with_dpp(struct dc *dc, struct dc_state *context)
/* If target clk not same as dppclk threshold, set to target clock */ /* If target clk not same as dppclk threshold, set to target clock */
if (dispclk_to_dpp_threshold != context->bw.dcn.calc_clk.dispclk_khz) { if (dispclk_to_dpp_threshold != context->bw.dcn.calc_clk.dispclk_khz) {
dc->res_pool->display_clock->funcs->set_clock( dc->res_pool->display_clock->funcs->set_dispclk(
dc->res_pool->display_clock, dc->res_pool->display_clock,
context->bw.dcn.calc_clk.dispclk_khz); context->bw.dcn.calc_clk.dispclk_khz);
} }
...@@ -2473,6 +2473,11 @@ static void dcn10_set_bandwidth( ...@@ -2473,6 +2473,11 @@ static void dcn10_set_bandwidth(
if (IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment)) if (IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment))
return; return;
dc->res_pool->display_clock->funcs->update_clocks(
dc->res_pool->display_clock,
&context->bw.dcn.calc_clk,
decrease_allowed);
if (should_set_clock( if (should_set_clock(
decrease_allowed, decrease_allowed,
context->bw.dcn.calc_clk.dcfclk_khz, context->bw.dcn.calc_clk.dcfclk_khz,
......
...@@ -1072,7 +1072,7 @@ static bool construct( ...@@ -1072,7 +1072,7 @@ static bool construct(
} }
} }
pool->base.display_clock = dce120_disp_clk_create(ctx); pool->base.display_clock = dcn_disp_clk_create(ctx);
if (pool->base.display_clock == NULL) { if (pool->base.display_clock == NULL) {
dm_error("DC: failed to create display clock!\n"); dm_error("DC: failed to create display clock!\n");
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
......
...@@ -40,32 +40,19 @@ struct display_clock { ...@@ -40,32 +40,19 @@ struct display_clock {
struct dc_context *ctx; struct dc_context *ctx;
const struct display_clock_funcs *funcs; const struct display_clock_funcs *funcs;
bool dispclk_notify_pplib_done;
bool phyclk_notify_pplib_done;
enum dm_pp_clocks_state max_clks_state; enum dm_pp_clocks_state max_clks_state;
enum dm_pp_clocks_state cur_min_clks_state; enum dm_pp_clocks_state cur_min_clks_state;
struct dc_clocks clks; struct dc_clocks clks;
}; };
struct display_clock_funcs { struct display_clock_funcs {
int (*set_clock)(struct display_clock *disp_clk, void (*update_clocks)(struct display_clock *dccg,
struct dc_clocks *new_clocks,
bool safe_to_lower);
int (*set_dispclk)(struct display_clock *disp_clk,
int requested_clock_khz); int requested_clock_khz);
enum dm_pp_clocks_state (*get_required_clocks_state)(
struct display_clock *disp_clk,
struct state_dependent_clocks *req_clocks);
bool (*set_min_clocks_state)(struct display_clock *disp_clk,
enum dm_pp_clocks_state dm_pp_clocks_state);
int (*get_dp_ref_clk_frequency)(struct display_clock *disp_clk); int (*get_dp_ref_clk_frequency)(struct display_clock *disp_clk);
bool (*apply_clock_voltage_request)(
struct display_clock *disp_clk,
enum dm_pp_clock_type clocks_type,
int clocks_in_khz,
bool pre_mode_set,
bool update_dp_phyclk);
}; };
#endif /* __DISPLAY_CLOCK_H__ */ #endif /* __DISPLAY_CLOCK_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment