Re: [PATCH v7 13/13] ASoC: qcom: q6apm: Add support for early buffer mapping on DSP
From: Mark Brown
Date: Tue Mar 24 2026 - 15:16:31 EST
On Mon, Mar 23, 2026 at 10:38:45PM +0000, Srinivas Kandagatla wrote:
> Buffers are allocated on pcm_new and mapped in the dsp on every
> prepare call, which is inefficient and unnecessary.
>
> Add new functions q6apm_[un]map_memory_fixed_region to map it on
> to dsp only once after allocation.
> static int q6apm_dai_pcm_new(struct snd_soc_component *component, struct snd_soc_pcm_runtime *rtd)
> + if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
> + substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
> + ret = q6apm_dai_memory_map(component, substream, graph_id);
> + if (ret) {
> + if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream)
> + q6apm_unmap_memory_fixed_region(component->dev, graph_id);
This looks like it's handling bidirectional DAIs but...
> +int q6apm_map_memory_fixed_region(struct device *dev, unsigned int graph_id, phys_addr_t phys,
> + size_t sz)
> +{
> + info = idr_find(&apm->graph_info_idr, graph_id);
> + if (!info)
> + return -ENODEV;
> +
> + if (info->mem_map_handle)
> + return 0;
...we have one memory map handle per graph ID, silently ignoring
attempts to add a second one?
Attachment:
signature.asc
Description: PGP signature