linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MIPS: Fixups of ALSA memory maps
@ 2009-11-16 16:48 Wu Zhangjin
  2009-11-16 17:06 ` Ralf Baechle
  2009-11-16 17:12 ` Takashi Iwai
  0 siblings, 2 replies; 13+ messages in thread
From: Wu Zhangjin @ 2009-11-16 16:48 UTC (permalink / raw)
  To: Ralf Baechle, Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, linux-mips, linux-kernel, Wu Zhangjin, Wu Zhangjin

Hi, All

Seems this is MIPS specific, but it's not that easy to move this patch
into the arch/mips part, So, any better solution?

Thanks & Regards,
       Wu Zhangjin

------------------------

The user application mmap audio dma regions must be dma-coherent. This
patch fix it.

Without this patch, artsd will fail on boot, and mplayer will exit with
"Segmentation fault". (this happens on YeeLoong netbook, fuloong2f
mini pc with snd_cs5535 audio card)

This is originally from the to-mips branch of
http://dev.lemote.com/code/linux_loongson, and contributed by Yanhua
from Lemote Inc.

Reported-by: qiaochong <qiaochong@gmail.com>
Signed-off-by: Wu Zhangjin <wuzj@lemote.com>
---
 sound/core/pcm_native.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index ab73edf..2779b9a 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3087,7 +3087,11 @@ static int snd_pcm_mmap_data_fault(struct vm_area_struct *area,
 			return VM_FAULT_SIGBUS;
 	} else {
 		vaddr = runtime->dma_area + offset;
+#if defined(__mips__) && defined(CONFIG_DMA_NONCOHERENT)
+		page = virt_to_page(CAC_ADDR(vaddr));
+#else
 		page = virt_to_page(vaddr);
+#endif
 	}
 	get_page(page);
 	vmf->page = page;
@@ -3202,6 +3206,11 @@ static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area)
 	if (PCM_RUNTIME_CHECK(substream))
 		return -ENXIO;
 
+#if defined(__mips__) && defined(CONFIG_DMA_NONCOHERENT)
+	/* all mmap using uncached mode */
+	area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
+	area->vm_flags |= (VM_RESERVED | VM_IO);
+#endif
 	offset = area->vm_pgoff << PAGE_SHIFT;
 	switch (offset) {
 	case SNDRV_PCM_MMAP_OFFSET_STATUS:
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-11-26 14:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-16 16:48 [PATCH] MIPS: Fixups of ALSA memory maps Wu Zhangjin
2009-11-16 17:06 ` Ralf Baechle
2009-11-16 17:14   ` Takashi Iwai
2009-11-17 13:50     ` Ralf Baechle
2009-11-16 17:12 ` Takashi Iwai
2009-11-16 17:43   ` Ralf Baechle
2009-11-17  9:29     ` Takashi Iwai
2009-11-18 14:20       ` Ralf Baechle
2009-11-18 17:47         ` Takashi Iwai
2009-11-21 12:31           ` Wu Zhangjin
2009-11-23  8:56             ` Takashi Iwai
2009-11-23 12:36               ` Ralf Baechle
2009-11-26 14:51                 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).