Commit ab8812a3 authored by Hersen Wu's avatar Hersen Wu Committed by Alex Deucher

drm/amd/display: Audio is not switching to DP when HDMI/DP hot plug/unplug

Signed-off-by: default avatarHersen Wu <hersenxs.wu@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 871ffb60
...@@ -1732,7 +1732,6 @@ enum dc_status dce110_apply_ctx_to_hw( ...@@ -1732,7 +1732,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;
bool programmed_audio_dto = false;
enum dm_pp_clocks_state clocks_state = DM_PP_CLOCKS_STATE_INVALID; enum dm_pp_clocks_state clocks_state = DM_PP_CLOCKS_STATE_INVALID;
/* Reset old context */ /* Reset old context */
...@@ -1782,21 +1781,10 @@ enum dc_status dce110_apply_ctx_to_hw( ...@@ -1782,21 +1781,10 @@ enum dc_status dce110_apply_ctx_to_hw(
context->res_ctx.pool->display_clock, context->res_ctx.pool->display_clock,
context->dispclk_khz * 115 / 100); context->dispclk_khz * 115 / 100);
for (i = 0; i < context->res_ctx.pool->pipe_count; i++) { /* program audio wall clock. use HDMI as clock source if HDMI
struct pipe_ctx *pipe_ctx_old = * audio active. Otherwise, use DP as clock source
&dc->current_context->res_ctx.pipe_ctx[i]; * first, loop to find any HDMI audio, if not, loop find DP audio
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; */
if (pipe_ctx->stream == NULL)
continue;
if (pipe_ctx->stream == pipe_ctx_old->stream)
continue;
if (pipe_ctx->top_pipe)
continue;
if (context->res_ctx.pipe_ctx[i].audio != NULL) {
/* Setup audio rate clock source */ /* Setup audio rate clock source */
/* Issue: /* Issue:
* Audio lag happened on DP monitor when unplug a HDMI monitor * Audio lag happened on DP monitor when unplug a HDMI monitor
...@@ -1812,6 +1800,77 @@ enum dc_status dce110_apply_ctx_to_hw( ...@@ -1812,6 +1800,77 @@ enum dc_status dce110_apply_ctx_to_hw(
* find first available pipe with audio, setup audio wall DTO per topology * find first available pipe with audio, setup audio wall DTO per topology
* instead of per pipe. * instead of per pipe.
*/ */
for (i = 0; i < context->res_ctx.pool->pipe_count; i++) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
if (pipe_ctx->stream == NULL)
continue;
if (pipe_ctx->top_pipe)
continue;
if (pipe_ctx->stream->signal != SIGNAL_TYPE_HDMI_TYPE_A)
continue;
if (pipe_ctx->audio != NULL) {
struct audio_output audio_output;
build_audio_output(pipe_ctx, &audio_output);
pipe_ctx->audio->funcs->wall_dto_setup(
pipe_ctx->audio,
pipe_ctx->stream->signal,
&audio_output.crtc_info,
&audio_output.pll_info);
break;
}
}
/* no HDMI audio is found, try DP audio */
if (i == context->res_ctx.pool->pipe_count) {
for (i = 0; i < context->res_ctx.pool->pipe_count; i++) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
if (pipe_ctx->stream == NULL)
continue;
if (pipe_ctx->top_pipe)
continue;
if (!dc_is_dp_signal(pipe_ctx->stream->signal))
continue;
if (pipe_ctx->audio != NULL) {
struct audio_output audio_output;
build_audio_output(pipe_ctx, &audio_output);
pipe_ctx->audio->funcs->wall_dto_setup(
pipe_ctx->audio,
pipe_ctx->stream->signal,
&audio_output.crtc_info,
&audio_output.pll_info);
break;
}
}
}
for (i = 0; i < context->res_ctx.pool->pipe_count; i++) {
struct pipe_ctx *pipe_ctx_old =
&dc->current_context->res_ctx.pipe_ctx[i];
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
if (pipe_ctx->stream == NULL)
continue;
if (pipe_ctx->stream == pipe_ctx_old->stream)
continue;
if (pipe_ctx->top_pipe)
continue;
if (context->res_ctx.pipe_ctx[i].audio != NULL) {
struct audio_output audio_output; struct audio_output audio_output;
build_audio_output(pipe_ctx, &audio_output); build_audio_output(pipe_ctx, &audio_output);
...@@ -1833,15 +1892,6 @@ enum dc_status dce110_apply_ctx_to_hw( ...@@ -1833,15 +1892,6 @@ enum dc_status dce110_apply_ctx_to_hw(
pipe_ctx->stream->signal, pipe_ctx->stream->signal,
&audio_output.crtc_info, &audio_output.crtc_info,
&pipe_ctx->stream->public.audio_info); &pipe_ctx->stream->public.audio_info);
if (!programmed_audio_dto) {
pipe_ctx->audio->funcs->wall_dto_setup(
pipe_ctx->audio,
pipe_ctx->stream->signal,
&audio_output.crtc_info,
&audio_output.pll_info);
programmed_audio_dto = true;
}
} }
status = apply_single_controller_ctx_to_hw( status = apply_single_controller_ctx_to_hw(
......
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