Skip to content

Commit 73bffb9

Browse files
charliu-AMDENGgregkh
authored andcommitted
drm/amd/display: support spdif
[ Upstream commit b5a4162 ] [Description] port spdif fix to staging: spdif hardwired to afmt inst 1. spdif func pointer spdif resource allocation (reserve last audio endpoint for spdif only) Signed-off-by: Charlene Liu <charlene.liu@amd.com> Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com> Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 18184bd commit 73bffb9

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

‎drivers/gpu/drm/amd/display/dc/core/dc_resource.c‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,10 @@ bool resource_construct(
261261
DC_ERR("DC: failed to create audio!\n");
262262
return false;
263263
}
264-
265264
if (!aud->funcs->endpoint_valid(aud)) {
266265
aud->funcs->destroy(&aud);
267266
break;
268267
}
269-
270268
pool->audios[i] = aud;
271269
pool->audio_count++;
272270
}
@@ -1692,24 +1690,25 @@ static struct audio *find_first_free_audio(
16921690
const struct resource_pool *pool,
16931691
enum engine_id id)
16941692
{
1695-
int i;
1696-
for (i = 0; i < pool->audio_count; i++) {
1693+
int i, available_audio_count;
1694+
1695+
available_audio_count = pool->audio_count;
1696+
1697+
for (i = 0; i < available_audio_count; i++) {
16971698
if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) {
16981699
/*we have enough audio endpoint, find the matching inst*/
16991700
if (id != i)
17001701
continue;
1701-
17021702
return pool->audios[i];
17031703
}
17041704
}
17051705

1706-
/* use engine id to find free audio */
1707-
if ((id < pool->audio_count) && (res_ctx->is_audio_acquired[id] == false)) {
1706+
/* use engine id to find free audio */
1707+
if ((id < available_audio_count) && (res_ctx->is_audio_acquired[id] == false)) {
17081708
return pool->audios[id];
17091709
}
1710-
17111710
/*not found the matching one, first come first serve*/
1712-
for (i = 0; i < pool->audio_count; i++) {
1711+
for (i = 0; i < available_audio_count; i++) {
17131712
if (res_ctx->is_audio_acquired[i] == false) {
17141713
return pool->audios[i];
17151714
}

‎drivers/gpu/drm/amd/display/dc/dce/dce_audio.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,8 @@ void dce_aud_az_configure(
611611

612612
AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO1,
613613
value);
614+
DC_LOG_HW_AUDIO("\n\tAUDIO:az_configure: index: %u data, 0x%x, displayName %s: \n",
615+
audio->inst, value, audio_info->display_name);
614616

615617
/*
616618
*write the port ID:
@@ -922,7 +924,6 @@ static const struct audio_funcs funcs = {
922924
.az_configure = dce_aud_az_configure,
923925
.destroy = dce_aud_destroy,
924926
};
925-
926927
void dce_aud_destroy(struct audio **audio)
927928
{
928929
struct dce_audio *aud = DCE_AUD(*audio);
@@ -953,7 +954,6 @@ struct audio *dce_audio_create(
953954
audio->regs = reg;
954955
audio->shifts = shifts;
955956
audio->masks = masks;
956-
957957
return &audio->base;
958958
}
959959

0 commit comments

Comments
 (0)