From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Alexey Klimov <alexey.klimov@linaro.org>,
Ravi Hothi <ravi.hothi@oss.qualcomm.com>,
linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 02/23] ASoC: soc-pcm: add multi_direction_codecs link flag
Date: Sun, 15 Nov 2026 21:04:10 +0000 [thread overview]
Message-ID: <85e400f9-eb56-4d8e-b791-ad00cbbdaea5@oss.qualcomm.com> (raw)
In-Reply-To: <179476416982.140154.13934302514044276070.b4-review@b4>
On 11/15/26 5:36 PM, Mark Brown wrote:
>> Speaker protection needs the amplifiers' V/I sense capture running
>> whenever the speakers play. Putting the capture codec DAIs on the
>> playback BE link ties the two together, but the core skips codec DAIs
>> whose direction does not match the substream.
>
>> Add a multi_direction_codecs link flag. When set, the core also calls
>> .hw_params and .hw_free on codec DAIs of the other direction, with the
>> substream direction switched to theirs for the call under pcm_mutex,
>> and sends the matching stream events so their widgets power up and
>> down. An optional multi_direction_params_fixup callback lets the
>> machine driver set the parameters for those DAIs. Links without the
>> flag are unchanged.
>
>> +3. Optionally calls ``.multi_direction_params_fixup`` so the machine
>> + driver can rewrite rate/format/channels on a per-codec copy of the
>
> Probably worth mentioning the ordering with regard to other fixups.
>
>> @@ -986,6 +986,9 @@ static int __soc_pcm_prepare(struct snd_soc_pcm_runtime *rtd,
>>
>> snd_soc_dapm_stream_event(rtd, substream->stream,
>> SND_SOC_DAPM_STREAM_START);
>> + if (rtd->dai_link->multi_direction_codecs)
>> + snd_soc_dapm_stream_event(rtd, substream->stream ^ 1,
>> + SND_SOC_DAPM_STREAM_START);
>
> This will update every DAI, including CPU DAIs. That will mean that a
> CPU DAI could be flagged as actively capturing due to playback or vice
> versa.
Correct, we should limit this to codec dais, will fix that in v2.
>
>> +static int soc_pcm_dai_hw_params_at_stream(struct snd_soc_dai *dai,
>> + struct snd_pcm_substream *substream,
>> + struct snd_pcm_hw_params *params,
>> + int stream)
>> +{
>> + int saved_stream = substream->stream;
>> + int ret;
>> +
>> + if (stream == saved_stream)
>> + return snd_soc_dai_hw_params(dai, substream, params);
>> +
>> + substream->stream = stream;
>> + ret = snd_soc_dai_hw_params(dai, substream, params);
>
> We flipped stream but nothing else, if hw_params checks things in the
> substream->runtime things will get confused. Usually everything is just
> checking params though.
I think the documentation should capture this and the codec dai that is
supports multi-directional should be ready to handle this.
I will add a comment about this both here and Documentation.
>
>> @@ -1061,9 +1117,20 @@ static int soc_pcm_hw_clean(struct snd_soc_pcm_runtime *rtd,
>> snd_soc_pcm_component_hw_free(substream, rollback);
>>
>> /* now free hw params for the DAIs */
>> - for_each_rtd_dais(rtd, i, dai)
>> - if (snd_soc_dai_stream_valid(dai, substream->stream))
>> - snd_soc_dai_hw_free(dai, substream, rollback);
>> + for_each_rtd_dais(rtd, i, dai) {
>
> This has flipping that __soc_pcm_hw_params() doesn't unless I'm
> something?
Yes, this needs to be split like what we do for hw_params, splitting
both cpu and codec dais. Will fix in v2.
--srini
>
next prev parent reply other threads:[~2026-11-15 21:04 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 17:14 [RFC PATCH 00/23] ASoC: qcom: AudioReach Active speaker protection for WSA884x Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 01/23] ASoC: soc-core: allow default ch_maps on links with more than 8 DAIs Srinivas Kandagatla
2026-11-15 17:36 ` Mark Brown
2026-11-15 21:04 ` Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 02/23] ASoC: soc-pcm: add multi_direction_codecs link flag Srinivas Kandagatla
2026-11-15 17:36 ` Mark Brown
2026-11-15 21:04 ` Srinivas Kandagatla [this message]
2026-10-23 17:14 ` [RFC PATCH 03/23] ASoC: qcom: sdw: add per-direction stream runtimes for multi_direction links Srinivas Kandagatla
2026-11-15 17:36 ` Mark Brown
2026-11-15 21:04 ` Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 04/23] ASoC: dt-bindings: qcom,wsa8840: allow one sound DAI cell Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 05/23] ASoC: codecs: wsa884x: add VI sense capture DAI Srinivas Kandagatla
2026-11-15 17:36 ` Mark Brown
2026-11-15 21:03 ` Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 06/23] ASoC: codecs: wsa884x: register the die temperature as a thermal zone Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 07/23] ASoC: qcom: audioreach: add control link support to graphs Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 08/23] ASoC: qcom: audioreach: run VI module in calibration mode with per-speaker events Srinivas Kandagatla
2026-11-15 17:36 ` Mark Brown
2026-11-15 21:04 ` Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 09/23] ASoC: qcom: q6apm-dai: add S32_LE format support Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 10/23] ASoC: qcom: audioreach: support up to four speakers in VI feedback Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 11/23] ASoC: qcom: audioreach: cache VI calibration results per speaker Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 12/23] ASoC: qcom: audioreach: make the speaker protection operation mode configurable Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 13/23] ASoC: qcom: audioreach: send cached R0/T0 to the VI module in normal mode Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 14/23] ASoC: qcom: audioreach: send static cfg blobs to speaker protection modules Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 15/23] ASoC: qcom: audioreach: add speaker protection mixer controls Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 16/23] ASoC: qcom: audioreach: pin SPEAKER_PROTECTION_VI media format Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 17/23] ASoC: qcom: audioreach: add live speaker temperature (T0) readback Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 18/23] ASoC: qcom: audioreach: add speaker protection calibration state control Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 19/23] ASoC: qcom: audioreach: keep the last VI calibration result until the DSP reports Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 20/23] ASoC: qcom: x1e80100: carry WSA VI feedback on the WSA Playback BE link Srinivas Kandagatla
2026-11-15 17:36 ` Mark Brown
2026-11-15 21:03 ` Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 21/23] ASoC: qcom: x1e80100: register WSA speaker thermal zones for speaker protection Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 22/23] arm64: dts: qcom: glymur-crd: add WSA speaker protection VI feedback Srinivas Kandagatla
2026-10-28 13:38 ` Konrad Dybcio
2026-10-28 21:59 ` Srinivas Kandagatla
2026-10-29 8:17 ` Konrad Dybcio
2026-10-23 17:14 ` [RFC PATCH 23/23] arm64: dts: qcom: mahua-t14s: " Srinivas Kandagatla
2026-10-28 12:39 ` [RFC PATCH 00/23] ASoC: qcom: AudioReach Active speaker protection for WSA884x Mark Brown
2026-10-28 16:31 ` Fabian Renn-Giles
2026-10-28 21:56 ` Srinivas Kandagatla
2026-11-15 22:07 ` Srinivas Kandagatla
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=85e400f9-eb56-4d8e-b791-ad00cbbdaea5@oss.qualcomm.com \
--to=srinivas.kandagatla@oss.qualcomm.com \
--cc=alexey.klimov@linaro.org \
--cc=andersson@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=ravi.hothi@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=tiwai@suse.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®