Skip to content

Commit b5a4162

Browse files
charliu-AMDENGalexdeucher
authored andcommitted
drm/amd/display: support spdif
[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>
1 parent a9f54ce commit b5a4162

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
@@ -262,12 +262,10 @@ bool resource_construct(
262262
DC_ERR("DC: failed to create audio!\n");
263263
return false;
264264
}
265-
266265
if (!aud->funcs->endpoint_valid(aud)) {
267266
aud->funcs->destroy(&aud);
268267
break;
269268
}
270-
271269
pool->audios[i] = aud;
272270
pool->audio_count++;
273271
}
@@ -1621,24 +1619,25 @@ static struct audio *find_first_free_audio(
16211619
const struct resource_pool *pool,
16221620
enum engine_id id)
16231621
{
1624-
int i;
1625-
for (i = 0; i < pool->audio_count; i++) {
1622+
int i, available_audio_count;
1623+
1624+
available_audio_count = pool->audio_count;
1625+
1626+
for (i = 0; i < available_audio_count; i++) {
16261627
if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) {
16271628
/*we have enough audio endpoint, find the matching inst*/
16281629
if (id != i)
16291630
continue;
1630-
16311631
return pool->audios[i];
16321632
}
16331633
}
16341634

1635-
/* use engine id to find free audio */
1636-
if ((id < pool->audio_count) && (res_ctx->is_audio_acquired[id] == false)) {
1635+
/* use engine id to find free audio */
1636+
if ((id < available_audio_count) && (res_ctx->is_audio_acquired[id] == false)) {
16371637
return pool->audios[id];
16381638
}
1639-
16401639
/*not found the matching one, first come first serve*/
1641-
for (i = 0; i < pool->audio_count; i++) {
1640+
for (i = 0; i < available_audio_count; i++) {
16421641
if (res_ctx->is_audio_acquired[i] == false) {
16431642
return pool->audios[i];
16441643
}

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

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

614614
AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO1,
615615
value);
616+
DC_LOG_HW_AUDIO("\n\tAUDIO:az_configure: index: %u data, 0x%x, displayName %s: \n",
617+
audio->inst, value, audio_info->display_name);
616618

617619
/*
618620
*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)