Re: [PATCH v7 07/10] ASoC: qcom: Add QAIF PCM operations

From: Harendra Gautam

Date: Mon Sep 28 2026 - 05:21:47 EST


> > + dma_mem_info->vaddr = dma_alloc_coherent(component->dev,
> > + dma_mem_info->alloc_size,
> > + &dma_mem_info->dma_addr,
> > + GFP_KERNEL);
>
>
> snd_pcm_set_managed_buffer().
Thanks for the suggestion. Will switch to
snd_pcm_set_fixed_buffer_all() in a .pcm_new callback in the next
version.
>
> > +static int qaif_platform_copy(struct snd_soc_component *component,
> > + struct snd_pcm_substream *substream,
> > + int channel, unsigned long pos,
> > + struct iov_iter *buf, unsigned long bytes)
> > +{
> > + struct snd_pcm_runtime *rt = substream->runtime;
> > + size_t buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
> > + size_t channel_bytes = buffer_bytes / rt->channels;
> > + unsigned long offset;
> > + void *dma_buf;
> > + size_t copied;
>
> If the buffers are already memory mapped why do we need a copy()
> operation?
With snd_pcm_set_fixed_buffer_all() in .pcm_new the buffer will be
coherent and directly mmap-able, making copy() redundant. Will drop it
in the next version.
-Harendra