2019-10-06 17:33:29

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.19 033/106] drm/amd/display: support spdif

From: Charlene Liu <[email protected]>

[ Upstream commit b5a41620bb88efb9fb31a4fa5e652e3d5bead7d4 ]

[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 <[email protected]>
Reviewed-by: Dmytro Laktyushkin <[email protected]>
Acked-by: Bhawanpreet Lakha <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---
.../gpu/drm/amd/display/dc/core/dc_resource.c | 17 ++++++++---------
drivers/gpu/drm/amd/display/dc/dce/dce_audio.c | 4 ++--
2 files changed, 10 insertions(+), 11 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 f0d68aa7c8fcc..d440b28ee43fb 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -229,12 +229,10 @@ bool resource_construct(
DC_ERR("DC: failed to create audio!\n");
return false;
}
-
if (!aud->funcs->endpoint_valid(aud)) {
aud->funcs->destroy(&aud);
break;
}
-
pool->audios[i] = aud;
pool->audio_count++;
}
@@ -1703,24 +1701,25 @@ static struct audio *find_first_free_audio(
const struct resource_pool *pool,
enum engine_id id)
{
- int i;
- for (i = 0; i < pool->audio_count; i++) {
+ int i, available_audio_count;
+
+ available_audio_count = pool->audio_count;
+
+ for (i = 0; i < available_audio_count; i++) {
if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) {
/*we have enough audio endpoint, find the matching inst*/
if (id != i)
continue;
-
return pool->audios[i];
}
}

- /* use engine id to find free audio */
- if ((id < pool->audio_count) && (res_ctx->is_audio_acquired[id] == false)) {
+ /* use engine id to find free audio */
+ if ((id < available_audio_count) && (res_ctx->is_audio_acquired[id] == false)) {
return pool->audios[id];
}
-
/*not found the matching one, first come first serve*/
- for (i = 0; i < pool->audio_count; i++) {
+ for (i = 0; i < available_audio_count; i++) {
if (res_ctx->is_audio_acquired[i] == false) {
return pool->audios[i];
}
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
index 7f6d724686f1a..abb559ce64085 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
@@ -611,6 +611,8 @@ void dce_aud_az_configure(

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

/*
*write the port ID:
@@ -922,7 +924,6 @@ static const struct audio_funcs funcs = {
.az_configure = dce_aud_az_configure,
.destroy = dce_aud_destroy,
};
-
void dce_aud_destroy(struct audio **audio)
{
struct dce_audio *aud = DCE_AUD(*audio);
@@ -953,7 +954,6 @@ struct audio *dce_audio_create(
audio->regs = reg;
audio->shifts = shifts;
audio->masks = masks;
-
return &audio->base;
}

--
2.20.1




2019-10-08 13:39:05

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH 4.19 033/106] drm/amd/display: support spdif

Hi!

> [ Upstream commit b5a41620bb88efb9fb31a4fa5e652e3d5bead7d4 ]
>
> [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)

I'm sorry, but I don't understand this changelog. Code below modifies
whitespace, adds a debug output, and uses local variable for
pool->audio_count.

Does not seem to be a bugfix, and does not seem to do anything with
staging.

Best regards,
Pavel


> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
> @@ -229,12 +229,10 @@ bool resource_construct(
> DC_ERR("DC: failed to create audio!\n");
> return false;
> }
> -
> if (!aud->funcs->endpoint_valid(aud)) {
> aud->funcs->destroy(&aud);
> break;
> }
> -
> pool->audios[i] = aud;
> pool->audio_count++;
> }
> @@ -1703,24 +1701,25 @@ static struct audio *find_first_free_audio(
> const struct resource_pool *pool,
> enum engine_id id)
> {
> - int i;
> - for (i = 0; i < pool->audio_count; i++) {
> + int i, available_audio_count;
> +
> + available_audio_count = pool->audio_count;
> +
> + for (i = 0; i < available_audio_count; i++) {
> if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) {
> /*we have enough audio endpoint, find the matching inst*/
> if (id != i)
> continue;
> -
> return pool->audios[i];
> }
> }
>
> - /* use engine id to find free audio */
> - if ((id < pool->audio_count) && (res_ctx->is_audio_acquired[id] == false)) {
> + /* use engine id to find free audio */
> + if ((id < available_audio_count) && (res_ctx->is_audio_acquired[id] == false)) {
> return pool->audios[id];
> }
> -
> /*not found the matching one, first come first serve*/
> - for (i = 0; i < pool->audio_count; i++) {
> + for (i = 0; i < available_audio_count; i++) {
> if (res_ctx->is_audio_acquired[i] == false) {
> return pool->audios[i];
> }
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
> index 7f6d724686f1a..abb559ce64085 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
> @@ -611,6 +611,8 @@ void dce_aud_az_configure(
>
> AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO1,
> value);
> + DC_LOG_HW_AUDIO("\n\tAUDIO:az_configure: index: %u data, 0x%x, displayName %s: \n",
> + audio->inst, value, audio_info->display_name);
>
> /*
> *write the port ID:
> @@ -922,7 +924,6 @@ static const struct audio_funcs funcs = {
> .az_configure = dce_aud_az_configure,
> .destroy = dce_aud_destroy,
> };
> -
> void dce_aud_destroy(struct audio **audio)
> {
> struct dce_audio *aud = DCE_AUD(*audio);
> @@ -953,7 +954,6 @@ struct audio *dce_audio_create(
> audio->regs = reg;
> audio->shifts = shifts;
> audio->masks = masks;
> -
> return &audio->base;
> }
>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (3.13 kB)
signature.asc (188.00 B)
Digital signature
Download all attachments

2019-10-08 15:18:57

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 4.19 033/106] drm/amd/display: support spdif

On Tue, Oct 08, 2019 at 03:37:41PM +0200, Pavel Machek wrote:
> Hi!
>
> > [ Upstream commit b5a41620bb88efb9fb31a4fa5e652e3d5bead7d4 ]
> >
> > [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)
>
> I'm sorry, but I don't understand this changelog. Code below modifies
> whitespace, adds a debug output, and uses local variable for
> pool->audio_count.
>
> Does not seem to be a bugfix, and does not seem to do anything with
> staging.

That's what the original changelog had in it, so I kept it.

thanks,

greg k-h

2019-10-08 15:35:08

by Bhawanpreet Lakha

[permalink] [raw]
Subject: Re: [PATCH 4.19 033/106] drm/amd/display: support spdif

+Harry

You're completely right. This was part of a larger patch dealing with
embargoed code and is meaningless without the embargoed code. It
should've been caught and never gone upstream. We've already put some
new processes in place to deal with patches like this going forward.

This isn't a good candidate for stable trees but shouldn't really hurt
anything if it's already in.

On 2019-10-08 9:37 a.m., Pavel Machek wrote:
> Hi!
>
>> [ Upstream commit b5a41620bb88efb9fb31a4fa5e652e3d5bead7d4 ]
>>
>> [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)
> I'm sorry, but I don't understand this changelog. Code below modifies
> whitespace, adds a debug output, and uses local variable for
> pool->audio_count.
>
> Does not seem to be a bugfix, and does not seem to do anything with
> staging.
>
> Best regards,
> Pavel
>
>
>> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
>> @@ -229,12 +229,10 @@ bool resource_construct(
>> DC_ERR("DC: failed to create audio!\n");
>> return false;
>> }
>> -
>> if (!aud->funcs->endpoint_valid(aud)) {
>> aud->funcs->destroy(&aud);
>> break;
>> }
>> -
>> pool->audios[i] = aud;
>> pool->audio_count++;
>> }
>> @@ -1703,24 +1701,25 @@ static struct audio *find_first_free_audio(
>> const struct resource_pool *pool,
>> enum engine_id id)
>> {
>> - int i;
>> - for (i = 0; i < pool->audio_count; i++) {
>> + int i, available_audio_count;
>> +
>> + available_audio_count = pool->audio_count;
>> +
>> + for (i = 0; i < available_audio_count; i++) {
>> if ((res_ctx->is_audio_acquired[i] == false) && (res_ctx->is_stream_enc_acquired[i] == true)) {
>> /*we have enough audio endpoint, find the matching inst*/
>> if (id != i)
>> continue;
>> -
>> return pool->audios[i];
>> }
>> }
>>
>> - /* use engine id to find free audio */
>> - if ((id < pool->audio_count) && (res_ctx->is_audio_acquired[id] == false)) {
>> + /* use engine id to find free audio */
>> + if ((id < available_audio_count) && (res_ctx->is_audio_acquired[id] == false)) {
>> return pool->audios[id];
>> }
>> -
>> /*not found the matching one, first come first serve*/
>> - for (i = 0; i < pool->audio_count; i++) {
>> + for (i = 0; i < available_audio_count; i++) {
>> if (res_ctx->is_audio_acquired[i] == false) {
>> return pool->audios[i];
>> }
>> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
>> index 7f6d724686f1a..abb559ce64085 100644
>> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
>> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
>> @@ -611,6 +611,8 @@ void dce_aud_az_configure(
>>
>> AZ_REG_WRITE(AZALIA_F0_CODEC_PIN_CONTROL_SINK_INFO1,
>> value);
>> + DC_LOG_HW_AUDIO("\n\tAUDIO:az_configure: index: %u data, 0x%x, displayName %s: \n",
>> + audio->inst, value, audio_info->display_name);
>>
>> /*
>> *write the port ID:
>> @@ -922,7 +924,6 @@ static const struct audio_funcs funcs = {
>> .az_configure = dce_aud_az_configure,
>> .destroy = dce_aud_destroy,
>> };
>> -
>> void dce_aud_destroy(struct audio **audio)
>> {
>> struct dce_audio *aud = DCE_AUD(*audio);
>> @@ -953,7 +954,6 @@ struct audio *dce_audio_create(
>> audio->regs = reg;
>> audio->shifts = shifts;
>> audio->masks = masks;
>> -
>> return &audio->base;
>> }
>>