At Wed, 14 Apr 2010 17:00:19 +0800,
Wu Zhangjin wrote:
> On Wed, 2010-04-14 at 08:31 +0200, Takashi Iwai wrote:
> > >
> > > Before, we have added the low-level handling with pgprot_noncached() in
> > > snd_pcm_mmap() to fix it, but now, can we add MIPS specific
> > > dma_mmap_coherent() as ARM did?
> > That would be a certainly fix, yes. I have no objection, of course ;)
> > A quicky, less-intrusive one would be the patch below.
> The below patch works well, just tested it.
But, I remember vaguely that calling pgprot_noncached()
unconditionally is dangerous. It should be checked somehow, e.g. via
platform_device_is_coherent(). And, this found only in
dma-coherence.h, and adding it to pcm_native.c would become messy like
So, it'd be really better to add dma_mmap_coherent(), indeed.
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index c22ebb0..4c3edc1 100644
@@ -36,6 +36,9 @@
+#if defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
@@ -3188,6 +3191,10 @@ static int snd_pcm_default_mmap(struct snd_pcm_substream
area->vm_end - area->vm_start);
+#elif defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
+ if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV &&
+ area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
#endif /* ARCH_HAS_DMA_MMAP_COHERENT */
/* mmap with fault handler */
area->vm_ops = &snd_pcm_vm_ops_data_fault;