linux-mips
[Top] [All Lists]

Re: Soundcard problems on Cobalt Qube 2

To: rincewind@discworld.dascon.de
Subject: Re: Soundcard problems on Cobalt Qube 2
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Tue, 23 May 2006 00:27:28 +0900 (JST)
Cc: linux-mips@linux-mips.org
In-reply-to: <20060521181323.GA3740@discworld.dascon.de>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20060521181323.GA3740@discworld.dascon.de>
Sender: linux-mips-bounce@linux-mips.org
On Sun, 21 May 2006 20:13:24 +0200, rincewind@discworld.dascon.de (Michael 
Schwingen) wrote:
> I installed Debian testing and compiled a kernel.org 2.6.16.14 kernel.
> Everything works fine until I start playing sound - at that point, I get
> crash #1 below. 
> 
> Just for comparison, I tried two different soundcards - a Yamaha
> YMF744-based card, which at least plays 8-bit WAV files using aplay, but
> causes crash #2 when playing mp3 files using mocp. A ES1938-based card does
> not respond to alsamixer, and showed crash #3 when playing mp3 files using
> mocp. An Intel EEPRO100 ethernet card works just fine.
> 
> I am only really interested in getting the ICE1712 card working, but the
> other two crashes seemed quite similar, so there may be a common or similar
> problem in the drivers. I have a bit of kernel driver experience, but have
> not used DMA or interrupts until now, and have no experience on MIPS.
> 
> Do you have any idea what goes wrong, or lacking that, where I might start
> looking?

I know one problem in ALSA on mips, but not sure it is relevant to
your crash.

http://www.linux-mips.org/archives/linux-mips/2006-01/msg00327.html

And here is an updated (still ugly) patch against current git.

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 0860c5a..8f9fd64 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3110,6 +3110,10 @@ static struct page *snd_pcm_mmap_data_no
                        return NOPAGE_OOM;
        } else {
                vaddr = runtime->dma_area + offset;
+#if defined(__mips__) && defined(CONFIG_DMA_NONCOHERENT)
+               /* dma_area is nocache addr */
+               vaddr = CAC_ADDR(vaddr);
+#endif
                page = virt_to_page(vaddr);
        }
        get_page(page);
@@ -3131,6 +3135,10 @@ static struct vm_operations_struct snd_p
 static int snd_pcm_default_mmap(struct snd_pcm_substream *substream,
                                struct vm_area_struct *area)
 {
+#if defined(__mips__) && defined(CONFIG_DMA_NONCOHERENT)
+       /* use uncached access for dma_area */
+       area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
+#endif
        area->vm_ops = &snd_pcm_vm_ops_data;
        area->vm_private_data = substream;
        area->vm_flags |= VM_RESERVED;
diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c
index 74745da..c4828d7 100644
--- a/sound/core/sgbuf.c
+++ b/sound/core/sgbuf.c
@@ -95,7 +95,12 @@ void *snd_malloc_sgbuf_pages(struct devi
                }
                sgbuf->table[i].buf = tmpb.area;
                sgbuf->table[i].addr = tmpb.addr;
+#if defined(__mips__) && defined(CONFIG_DMA_NONCOHERENT)
+               /* snd_dma_malloc_pages returns nocache addr */
+               sgbuf->page_table[i] = virt_to_page(CAC_ADDR(tmpb.area));
+#else
                sgbuf->page_table[i] = virt_to_page(tmpb.area);
+#endif
                sgbuf->pages++;
        }
 

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