Re: [PATCH v5 13/13] ASoC: qcom: q6apm: Add support for early buffer mapping on DSP
From: Srinivas Kandagatla
Date: Wed Mar 18 2026 - 04:30:09 EST
On 3/17/26 6:03 PM, Mark Brown wrote:
> On Mon, Mar 09, 2026 at 06:51:37AM +0000, Srinivas Kandagatla wrote:
>
>> +static void q6apm_dai_pcm_destruct(struct snd_soc_component *component, struct snd_pcm *pcm)
>> +{
>> + struct snd_pcm_substream *substream;
>> + struct snd_soc_pcm_runtime *soc_prtd;
>> + struct snd_soc_dai *cpu_dai;
>> + int graph_id;
>> +
>> + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream)
>> + substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
>> + else
>> + substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
>
> This looks weird, we're destructing the playback substream if the
> capture one is present and the capture stream otherwise? If that's
> correct the logic is very non-obvious, especially in the case where the
> capture stream isn't presenta and...
Looks like this is a typo in the patch it should be
if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream)
substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
else
substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
will fix this in next spin, along with converting the destruct to pcm_free
--srini
>
>> + soc_prtd = snd_soc_substream_to_rtd(substream);
>> + cpu_dai = snd_soc_rtd_to_cpu(soc_prtd, 0);
>
> ...we immediately try convert it into a runtime and CPU DAI?