[alsa-devel] DMA Physical Address through "snd_pcm_lib_malloc_pages"

Takashi Iwai tiwai at suse.de
Thu Jun 24 08:37:03 CEST 2010


At Thu, 24 Jun 2010 03:50:17 +0530,
Adish Kuvelker wrote:
> 
> Hello,
> 
> I am trying to allocate memory for DMA buffer through
> "snd_pcm_lib_malloc_pages" in hw_params callout function, with prior
> use of "snd_pcm_lib_preallocate_pages_for_all". The chapter on PCM
> Interface in "writing an ALSA driver" states that if the standard
> function "snd_pcm_lib_malloc_pages" is use for allocating the DMA
> buffers then the DMA fields of dma_addr, dma_area, dma_bytes are set
> by the ALSA middle layer.
> 
> However my code walk through didn't point me to the area where this
> physical memory setting is done. My DMA channel is not serving a PCI
> device. I would be very grateful if any of you guys can point me to
> the code where this settings get done by calling
> "snd_pcm_lib_malloc_pages".

snd_pcm_lib_*_pages() works only with the preallocated buffers, and
the pre-allocation can be done with the generic struct device, as long
as the device (bus) supports dma_alloc_coherent() properly.

But this can be pretty arch-specific, so better to clarify more your
hardware if you need detailed answers...


Takashi


More information about the Alsa-devel mailing list