At Fri, 29 Jun 2012 20:34:24 +0530,
Laxman Dewangan wrote:
Hi Takashi,snd_pcm_lib_malloc_pages() should be called only from hw_params.
Thanks for sample code. It helps lot.
int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t
size)
{
struct snd_pcm_runtime *runtime;
struct snd_dma_buffer *dmab = NULL;
if (PCM_RUNTIME_CHECK(substream))
return -EINVAL;
if (snd_BUG_ON(substream->dma_buffer.dev.type ==
SNDRV_DMA_TYPE_UNKNOWN))
return -EINVAL;
runtime = substream->runtime;
if (runtime->dma_buffer_p) {
---------------Kernel crash at this point ----------
So I used the snd_dma_alloc_pages() from the driver to allocate WC memory.
Prior to that, you need to set up the dam_buffer type by calling
snd_pcm_lib_preallocate_pages() or
snd_pcm_lib_preallocate_pages_for_all() at the time to create a PCM
instance. The size can be 0 if not necessary to allocate there but
later on demand.