Re: [RFC PATCH 03/23] ASoC: qcom: sdw: add per-direction stream runtimes for multi_direction links

From: Mark Brown

Date: Sun Nov 15 2026 - 12:37:13 EST


> A SoundWire BE link with multi_direction_codecs carries codec DAIs of
> both directions, and each direction needs its own sdw_stream_runtime.
>
> Split startup, prepare, hw_free and shutdown into per-direction helpers
> and run them for both directions on such links.

> +/*
> + * Inline direction check that doesn't require snd_soc_dai_stream_valid
> + * to be exported for module use.
> + */
> +static bool sdw_dai_has_dir(struct snd_soc_dai *dai, int dir)

This looks a lot like snd_soc_stream_valid().

> +static int qcom_snd_sdw_setup_dir(struct snd_soc_pcm_runtime *rtd,
> + int dir, const char *cpu_name)
> {

> - sruntime = sdw_alloc_stream(cpu_dai->name, SDW_STREAM_PCM);
> + sruntime = sdw_alloc_stream(cpu_name, SDW_STREAM_PCM);

Both directions will end up with the same name which won't help
debugging.

> +int qcom_snd_sdw_startup(struct snd_pcm_substream *substream)
> {

> +
> + for_each_rtd_codec_dais(rtd, i, cd) {
> + if (!sdw_dai_has_dir(cd, substream->stream))
> + continue;
> + sr = snd_soc_dai_get_stream(cd, substream->stream);
> + if (!IS_ERR_OR_NULL(sr)) {
> + sdw_release_stream(sr);

sdw_find_dir_stream() (there's other copies).

--
Mark Brown <broonie@xxxxxxxxxx>