Commit 9fe17b5d47d3d3c85b35623dea8f571a184134c0

Authored by Takashi Iwai
1 parent 6a45f78225

ALSA: pcm - Use pgprot_noncached() for MIPS non-coherent archs

MIPS non-coherent archs need the noncached pgprot in mmap of PCM buffers.
But, since the coherency needs to be checked dynamically via
plat_device_is_coherent(), we need an ugly check dependent on MIPS
in ALSA core code.

This should be cleaned up in MIPS arch side (e.g. creating
dma_mmap_coherent()) in near future.

Tested-by: Wu Zhangjin <wuzhangjin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

Showing 1 changed file with 7 additions and 0 deletions Side-by-side Diff

sound/core/pcm_native.c
... ... @@ -36,6 +36,9 @@
36 36 #include <sound/timer.h>
37 37 #include <sound/minors.h>
38 38 #include <asm/io.h>
  39 +#if defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
  40 +#include <dma-coherence.h>
  41 +#endif
39 42  
40 43 /*
41 44 * Compatibility
... ... @@ -3184,6 +3187,10 @@
3184 3187 substream->runtime->dma_area,
3185 3188 substream->runtime->dma_addr,
3186 3189 area->vm_end - area->vm_start);
  3190 +#elif defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT)
  3191 + if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV &&
  3192 + !plat_device_is_coherent(substream->dma_buffer.dev.dev))
  3193 + area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
3187 3194 #endif /* ARCH_HAS_DMA_MMAP_COHERENT */
3188 3195 /* mmap with fault handler */
3189 3196 area->vm_ops = &snd_pcm_vm_ops_data_fault;