[Top] [All Lists]

[PATCH] MIPS: Fixups of ALSA memory maps

To: Ralf Baechle <>, Jaroslav Kysela <>, Takashi Iwai <>
Subject: [PATCH] MIPS: Fixups of ALSA memory maps
From: Wu Zhangjin <>
Date: Tue, 17 Nov 2009 00:48:14 +0800
Cc:,,, Wu Zhangjin <>, Wu Zhangjin <>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=XOYF/ejaRlj5gVMa9CZRhKoa8lP61V3OMvONGqrQyoU=; b=P2wvEhPrwLIuDEu9YryVFcj14iBVx315xQY7XxVcdqD2wUEy45HOWy/vgpXRWcvRv7 h2q6CFeltkdiYG3fpbVO0MWBpWqRkoS0xDTqSMHmV1xJ2SvhNb6mFlUvzVm1vrC1xEpw xTRRZ/xHZ0AzRBu9CFoWanAh9L8BaY2bIplIY=
Domainkey-signature: a=rsa-sha1; c=nofws;; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=gmxCVQfQUerrPfL8kpNK2D/RW9edDX/OM+bju8FDIwMMp7gLKf+tflcwA3xVA0GrFj syr5XJZ6iLfPf2+G/tSMJAkI+eVKebDSMBtur+qVbDEwpXm9ijpCC0P1sszsyM5ZE3A8 GC3dyjNZggx23gyZoySz+O+A5jARxpG6z81mY=
Original-recipient: rfc822;
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, and contributed by Yanhua
from Lemote Inc.

Reported-by: qiaochong <>
Signed-off-by: Wu Zhangjin <>
 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 
                        return VM_FAULT_SIGBUS;
        } else {
                vaddr = runtime->dma_area + offset;
+#if defined(__mips__) && defined(CONFIG_DMA_NONCOHERENT)
+               page = virt_to_page(CAC_ADDR(vaddr));
                page = virt_to_page(vaddr);
        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);
        offset = area->vm_pgoff << PAGE_SHIFT;
        switch (offset) {

<Prev in Thread] Current Thread [Next in Thread>