Commit a1651530 authored by Su Sung Chung's avatar Su Sung Chung Committed by Alex Deucher

drm/amd/display: make clk_mgr call enable_pme_wa

refactor a code so we will call clk_mgr's enable_pme_wa function so we
can use pme_wa for future asics. This way we don't need to worry about
different ASIC since clk_mgr already have that information
Signed-off-by: default avatarSu Sung Chung <Su.Chung@amd.com>
Reviewed-by: default avatarEric Yang <eric.yang2@amd.com>
Acked-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 16b6253a
...@@ -215,9 +215,23 @@ static void rv1_update_clocks(struct clk_mgr *clk_mgr_base, ...@@ -215,9 +215,23 @@ static void rv1_update_clocks(struct clk_mgr *clk_mgr_base,
} }
} }
static void rv1_enable_pme_wa(struct clk_mgr *clk_mgr_base)
{
struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
struct pp_smu_funcs_rv *pp_smu = NULL;
if (clk_mgr->pp_smu) {
pp_smu = &clk_mgr->pp_smu->rv_funcs;
if (pp_smu->set_pme_wa_enable)
pp_smu->set_pme_wa_enable(&pp_smu->pp_smu);
}
}
static struct clk_mgr_funcs rv1_clk_funcs = { static struct clk_mgr_funcs rv1_clk_funcs = {
.get_dp_ref_clk_frequency = dce12_get_dp_ref_freq_khz, .get_dp_ref_clk_frequency = dce12_get_dp_ref_freq_khz,
.update_clocks = rv1_update_clocks, .update_clocks = rv1_update_clocks,
.enable_pme_wa = rv1_enable_pme_wa,
}; };
static struct clk_mgr_internal_funcs rv1_clk_internal_funcs = { static struct clk_mgr_internal_funcs rv1_clk_internal_funcs = {
......
...@@ -939,26 +939,12 @@ void hwss_edp_backlight_control( ...@@ -939,26 +939,12 @@ void hwss_edp_backlight_control(
edp_receiver_ready_T9(link); edp_receiver_ready_T9(link);
} }
// Static helper function which calls the correct function
// based on pp_smu version
static void set_pme_wa_enable_by_version(struct dc *dc)
{
struct pp_smu_funcs *pp_smu = NULL;
if (dc->res_pool->pp_smu)
pp_smu = dc->res_pool->pp_smu;
if (pp_smu) {
if (pp_smu->ctx.ver == PP_SMU_VER_RV && pp_smu->rv_funcs.set_pme_wa_enable)
pp_smu->rv_funcs.set_pme_wa_enable(&(pp_smu->ctx));
}
}
void dce110_enable_audio_stream(struct pipe_ctx *pipe_ctx) void dce110_enable_audio_stream(struct pipe_ctx *pipe_ctx)
{ {
/* notify audio driver for audio modes of monitor */ /* notify audio driver for audio modes of monitor */
struct dc *core_dc = pipe_ctx->stream->ctx->dc; struct dc *core_dc = pipe_ctx->stream->ctx->dc;
struct pp_smu_funcs *pp_smu = NULL; struct pp_smu_funcs *pp_smu = NULL;
struct clk_mgr *clk_mgr = core_dc->clk_mgr;
unsigned int i, num_audio = 1; unsigned int i, num_audio = 1;
if (pipe_ctx->stream_res.audio && pipe_ctx->stream_res.audio->enabled == true) if (pipe_ctx->stream_res.audio && pipe_ctx->stream_res.audio->enabled == true)
...@@ -976,9 +962,9 @@ void dce110_enable_audio_stream(struct pipe_ctx *pipe_ctx) ...@@ -976,9 +962,9 @@ void dce110_enable_audio_stream(struct pipe_ctx *pipe_ctx)
pipe_ctx->stream_res.audio->funcs->az_enable(pipe_ctx->stream_res.audio); pipe_ctx->stream_res.audio->funcs->az_enable(pipe_ctx->stream_res.audio);
if (num_audio >= 1 && pp_smu != NULL) if (num_audio >= 1 && clk_mgr->funcs->enable_pme_wa)
/*this is the first audio. apply the PME w/a in order to wake AZ from D3*/ /*this is the first audio. apply the PME w/a in order to wake AZ from D3*/
set_pme_wa_enable_by_version(core_dc); clk_mgr->funcs->enable_pme_wa(clk_mgr);
/* un-mute audio */ /* un-mute audio */
/* TODO: audio should be per stream rather than per link */ /* TODO: audio should be per stream rather than per link */
pipe_ctx->stream_res.stream_enc->funcs->audio_mute_control( pipe_ctx->stream_res.stream_enc->funcs->audio_mute_control(
...@@ -992,6 +978,7 @@ void dce110_disable_audio_stream(struct pipe_ctx *pipe_ctx, int option) ...@@ -992,6 +978,7 @@ void dce110_disable_audio_stream(struct pipe_ctx *pipe_ctx, int option)
{ {
struct dc *dc = pipe_ctx->stream->ctx->dc; struct dc *dc = pipe_ctx->stream->ctx->dc;
struct pp_smu_funcs *pp_smu = NULL; struct pp_smu_funcs *pp_smu = NULL;
struct clk_mgr *clk_mgr = dc->clk_mgr;
if (pipe_ctx->stream_res.audio && pipe_ctx->stream_res.audio->enabled == false) if (pipe_ctx->stream_res.audio && pipe_ctx->stream_res.audio->enabled == false)
return; return;
...@@ -1020,9 +1007,9 @@ void dce110_disable_audio_stream(struct pipe_ctx *pipe_ctx, int option) ...@@ -1020,9 +1007,9 @@ void dce110_disable_audio_stream(struct pipe_ctx *pipe_ctx, int option)
update_audio_usage(&dc->current_state->res_ctx, dc->res_pool, pipe_ctx->stream_res.audio, false); update_audio_usage(&dc->current_state->res_ctx, dc->res_pool, pipe_ctx->stream_res.audio, false);
pipe_ctx->stream_res.audio = NULL; pipe_ctx->stream_res.audio = NULL;
} }
if (pp_smu != NULL) if (clk_mgr->funcs->enable_pme_wa)
/*this is the first audio. apply the PME w/a in order to wake AZ from D3*/ /*this is the first audio. apply the PME w/a in order to wake AZ from D3*/
set_pme_wa_enable_by_version(dc); clk_mgr->funcs->enable_pme_wa(clk_mgr);
/* TODO: notify audio driver for if audio modes list changed /* TODO: notify audio driver for if audio modes list changed
* add audio mode list change flag */ * add audio mode list change flag */
......
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