aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharlene Liu <charlene.liu@amd.com>2017-11-15 18:55:57 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-11-28 17:55:56 -0500
commitcfb071f7a9673109415d097125b3c12c16836acc (patch)
treee758c5e473792afcf24c6b4ba25a17a0691623ed
parent2b7c97d687e81db07d8c67b32ff920e7bf59444e (diff)
drm/amd/display: try to find matching audio inst for enc inst first
[Description] in eDP+ HDMI/DP clone or extended configuration, audio inst changed from inst 1 to inst0. No failure related this though, just playback device endpoint inst changed. Also remove one addition register read. Signed-off-by: Charlene Liu <charlene.liu@amd.com> Reviewed-by: Tony Cheng <Tony.Cheng@amd.com> Acked-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_resource.c9
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c4
2 files changed, 8 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index 655e08df48a0..546fe99d34f2 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -1449,11 +1449,16 @@ static struct stream_encoder *find_first_free_match_stream_enc_for_link(
1449 1449
1450static struct audio *find_first_free_audio( 1450static struct audio *find_first_free_audio(
1451 struct resource_context *res_ctx, 1451 struct resource_context *res_ctx,
1452 const struct resource_pool *pool) 1452 const struct resource_pool *pool,
1453 enum engine_id id)
1453{ 1454{
1454 int i; 1455 int i;
1455 for (i = 0; i < pool->audio_count; i++) { 1456 for (i = 0; i < pool->audio_count; i++) {
1456 if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) { 1457 if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) {
1458 /*we have enough audio endpoint, find the matching inst*/
1459 if (id != i)
1460 continue;
1461
1457 return pool->audios[i]; 1462 return pool->audios[i];
1458 } 1463 }
1459 } 1464 }
@@ -1702,7 +1707,7 @@ enum dc_status resource_map_pool_resources(
1702 dc_is_audio_capable_signal(pipe_ctx->stream->signal) && 1707 dc_is_audio_capable_signal(pipe_ctx->stream->signal) &&
1703 stream->audio_info.mode_count) { 1708 stream->audio_info.mode_count) {
1704 pipe_ctx->stream_res.audio = find_first_free_audio( 1709 pipe_ctx->stream_res.audio = find_first_free_audio(
1705 &context->res_ctx, pool); 1710 &context->res_ctx, pool, pipe_ctx->stream_res.stream_enc->id);
1706 1711
1707 /* 1712 /*
1708 * Audio assigned in order first come first get. 1713 * Audio assigned in order first come first get.
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c b/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
index c04d67db9cea..e42b6eb1c1f0 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c
@@ -87,10 +87,8 @@ static void dce110_update_generic_info_packet(
87 */ 87 */
88 uint32_t max_retries = 50; 88 uint32_t max_retries = 50;
89 89
90 REG_GET(AFMT_CNTL, AFMT_AUDIO_CLOCK_EN, &regval);
91 /*we need turn on clock before programming AFMT block*/ 90 /*we need turn on clock before programming AFMT block*/
92 if (regval != 1) 91 REG_UPDATE(AFMT_CNTL, AFMT_AUDIO_CLOCK_EN, 1);
93 REG_UPDATE(AFMT_CNTL, AFMT_AUDIO_CLOCK_EN, 1);
94 92
95 if (REG(AFMT_VBI_PACKET_CONTROL1)) { 93 if (REG(AFMT_VBI_PACKET_CONTROL1)) {
96 if (packet_index >= 8) 94 if (packet_index >= 8)