Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: tiansm@lemote.com
To: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Subject: [PATCH 16/16] alsa sound support for mips
Date: Sun, 15 Apr 2007 23:26:05 +0800	[thread overview]
Message-ID: <11766507674145-git-send-email-tiansm@lemote.com> (raw)
In-Reply-To: <11766507672043-git-send-email-tiansm@lemote.com>

From: Fuxin Zhang <zhangfx@lemote.com>

Signed-off-by: Fuxin Zhang <zhangfx@lemote.com>
---
 sound/core/pcm_native.c |   10 ++++++++++
 sound/core/sgbuf.c      |    9 +++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 3e276fc..9005bac 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -3145,7 +3145,11 @@ static struct page *snd_pcm_mmap_data_nopage(struct vm_area_struct *area,
 			return NOPAGE_OOM; /* XXX: is this really due to OOM? */
 	} 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);
 	if (type)
@@ -3261,6 +3265,12 @@ static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area)
 	substream = pcm_file->substream;
 	snd_assert(substream != NULL, 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:
diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c
index cefd228..535f0bc 100644
--- a/sound/core/sgbuf.c
+++ b/sound/core/sgbuf.c
@@ -91,12 +91,21 @@ void *snd_malloc_sgbuf_pages(struct device *device,
 		}
 		sgbuf->table[i].buf = tmpb.area;
 		sgbuf->table[i].addr = tmpb.addr;
+#if defined(__mips__) && defined(CONFIG_DMA_NONCOHERENT)
+		sgbuf->page_table[i] = virt_to_page(CAC_ADDR(tmpb.area));
+#else
 		sgbuf->page_table[i] = virt_to_page(tmpb.area);
+#endif
 		sgbuf->pages++;
 	}
 
 	sgbuf->size = size;
+#if defined(__mips__) && defined(CONFIG_DMA_NONCOHERENT)
+	/* maybe we should use uncached accelerated mode */
+	dmab->area = vmap(sgbuf->page_table, sgbuf->pages, VM_MAP | VM_IO, pgprot_noncached(PAGE_KERNEL));
+#else
 	dmab->area = vmap(sgbuf->page_table, sgbuf->pages, VM_MAP, PAGE_KERNEL);
+#endif
 	if (! dmab->area)
 		goto _failed;
 	return dmab->area;
-- 
1.4.4.1

  reply	other threads:[~2007-04-15 15:31 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-15 15:25 lemote-fulong patch update tiansm
2007-04-15 15:25 ` [PATCH 1/16] new files for lemote fulong mini-PC support tiansm
2007-04-15 15:25   ` [PATCH 2/16] arch related Makefile update for lemote fulong mini-PC tiansm
2007-04-15 15:25     ` [PATCH 3/16] Kconfig " tiansm
2007-04-15 15:25       ` [PATCH 4/16] TO_PHYS_MASK for loongson2 tiansm
2007-04-15 15:25         ` [PATCH 5/16] add MACH_GROUP_LEMOTE & MACH_LEMOTE_FULONG tiansm
2007-04-15 15:25           ` [PATCH 6/16] define Hit_Invalidate_I to Index_Invalidate_I for loongson2 tiansm
2007-04-15 15:25             ` [PATCH 7/16] add Loongson processor definitions tiansm
2007-04-15 15:25               ` [PATCH 8/16] define MODULE_PROC_FAMILY for Loongson2 tiansm
2007-04-15 15:25                 ` [PATCH 9/16] add serial port definition for lemote fulong tiansm
2007-04-15 15:25                   ` [PATCH 10/16] make cpu_probe recognize Loongson2 tiansm
2007-04-15 15:26                     ` [PATCH 11/16] add Loongson support to /proc/cpuinfo tiansm
2007-04-15 15:26                       ` [PATCH 12/16] cheat for support of more than 256MB memory tiansm
2007-04-15 15:26                         ` [PATCH 13/16] define MODULE_PROC_FAMILY for Loongson2 tiansm
2007-04-15 15:26                           ` [PATCH 14/16] tlb handling support for Loongson2 processor tiansm
2007-04-15 15:26                             ` [PATCH 15/16] work around for more than 256MB memory support tiansm
2007-04-15 15:26                               ` tiansm [this message]
2007-04-18 13:54                                 ` [PATCH 16/16] alsa sound support for mips Ralf Baechle
2007-04-18 14:13                                   ` Fuxin Zhang
2007-04-20  9:39                                     ` Atsushi Nemoto
2007-04-18 12:11             ` [PATCH 6/16] define Hit_Invalidate_I to Index_Invalidate_I for loongson2 Ralf Baechle
2007-04-18 13:51               ` Fuxin Zhang
2007-04-18 13:56                 ` Fuxin Zhang
2007-04-18 12:02         ` [PATCH 4/16] TO_PHYS_MASK " Ralf Baechle
2007-04-18 12:06       ` [PATCH 3/16] Kconfig update for lemote fulong mini-PC Ralf Baechle
2007-04-18 13:32         ` Fuxin Zhang
2007-04-18 15:28           ` Uhler, Mike
2007-04-18 15:28             ` Uhler, Mike
2007-04-18 15:43             ` Fuxin Zhang
2007-04-18 16:38             ` Ralf Baechle
2007-04-18 22:27               ` Uhler, Mike
2007-04-18 22:27                 ` Uhler, Mike
2007-04-19  0:34                 ` Ralf Baechle
2007-04-15 22:28     ` [PATCH 2/16] arch related Makefile " Thiemo Seufer
2007-04-16  7:37       ` Tian
2007-04-16  8:48       ` Fuxin Zhang
2007-04-16  8:49       ` Zhang Fuxin
2007-04-16 12:44         ` Thiemo Seufer
2007-04-16 14:01           ` Ralf Baechle
2007-04-16 15:10           ` Zhang Fuxin
  -- strict thread matches above, loose matches on Subject: below --
2007-04-04 14:38 [PATCH 16/16] alsa sound support for mips zhangfx

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11766507674145-git-send-email-tiansm@lemote.com \
    --to=tiansm@lemote.com \
    --cc=linux-mips@linux-mips.org \
    --cc=zhangfx@lemote.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox