mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: linux-sound@vger.kernel.org,  linux-amlogic@lists.infradead.org,
	s.nawrocki@samsung.com,  lgirdwood@gmail.com,
	 broonie@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v1 2/2] ASoC: dapm: add support for preparing streams
Date: Mon, 06 Jan 2025 15:34:01 +0100	[thread overview]
Message-ID: <1jsepw9fl2.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <1jy0zo9fu4.fsf@starbuckisacylon.baylibre.com> (Jerome Brunet's message of "Mon, 06 Jan 2025 15:28:35 +0100")

On Mon 06 Jan 2025 at 15:28, Jerome Brunet <jbrunet@baylibre.com> wrote:

> On Mon 06 Jan 2025 at 15:13, Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote:
>
>> Codec driver can implement .hw_params and/or .prepare from struct
>> snd_soc_dai_ops. For codec-to-codec links only the former (.hw_params)
>> callback has been called.
>>
>> On platforms like Amlogic Meson8/8b/8m2 the SoC's sound card
>> (sound/soc/meson/gx-card.c) uses a codec-to-codec link for the HDMI
>> codec output because further digital routing is required after the
>> backend. The new DRM HDMI (audio) codec framework (which internally
>> uses sound/soc/codecs/hdmi-codec.c) relies on the .prepare callback
>> of the hdmi-codec to be called. Implement a call to
>> snd_soc_dai_prepare() so the .prepare callback of the hdmi-codec is
>> called on those platforms.
>>
>> For platforms or sound cards without a codec-to-codec link with
>> additional parameters (which applies to most hardware) this changes
>> nothing as the .prepare callback is already called via
>> snd_pcm_do_prepare() (as well as dpcm_fe_dai_prepare() and
>> dpcm_be_dai_prepare()) on those.
>>
>> Suggested-by: Jerome Brunet <jbrunet@baylibre.com>
>> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>
> Thanks for working on this. Overall it looks good.
>
> Not sure if the call the .prepare() should go at the beginning of
> POST_PMU, as done here, or at the end of PRE_PMU ? 
>
>> ---
>>  sound/soc/soc-dapm.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
>> index 99521c784a9b..ac8eef217dc4 100644
>> --- a/sound/soc/soc-dapm.c
>> +++ b/sound/soc/soc-dapm.c
>> @@ -4013,6 +4013,13 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
>>  		break;
>>  
>>  	case SND_SOC_DAPM_POST_PMU:
>> +		snd_soc_dapm_widget_for_each_sink_path(w, path) {
>> +			sink = path->sink->priv;
>> +
>> +			snd_soc_dai_prepare(sink, substream);

I initially missed it but I think you should do that on the source path
too

On Amlogic, the cpu side of the link does not have a .prepare() callback
but it would be incorrect to do the codec side only if it did.

>> +			ret = 0;
>> +		}
>> +
>>  		snd_soc_dapm_widget_for_each_sink_path(w, path) {
>>  			sink = path->sink->priv;

-- 
Jerome

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2025-01-06 14:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-06 14:13 [RFC PATCH v1 0/2] ASoC: prepare streams on codec-to-codec links Martin Blumenstingl
2025-01-06 14:13 ` [RFC PATCH v1 1/2] ASoC: soc-dai: add snd_soc_dai_prepare() and use it internally Martin Blumenstingl
2025-01-06 14:13 ` [RFC PATCH v1 2/2] ASoC: dapm: add support for preparing streams Martin Blumenstingl
2025-01-06 14:28   ` Jerome Brunet
2025-01-06 14:34     ` Jerome Brunet [this message]
2025-01-06 15:25       ` Mark Brown
2025-01-06 20:17     ` Martin Blumenstingl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1jsepw9fl2.fsf@starbuckisacylon.baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=s.nawrocki@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®