From: Takashi Iwai <tiwai@suse.de>
To: Paul Davis <paul@linuxaudiosystems.com>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: hdsp driver
Date: Fri, 28 Feb 2003 16:14:28 +0100 [thread overview]
Message-ID: <s5hlm00igiz.wl@alsa2.suse.de> (raw)
In-Reply-To: <200302271843.h1RIhYa04397@linuxaudiosystems.com>
[-- Attachment #1: Type: text/plain, Size: 654 bytes --]
Hi Paul,
At Thu, 27 Feb 2003 13:43:34 -0500,
Paul Davis wrote:
>
> i haven't had time today to get the patch for the hdsp ready. however,
> the new source works here (i have some CVS sync issues). i'll get it
> out to the list on monday (i'm gone for the weekend).
could you check the attached patch (to the current cvs version) for
rme9652 and hdsp?
it will replace the memory allocation using the new snd-page-alloc
module instead of snd-hammerfall-mem.
although the former doesn't allocate the buffer in advance by checking
the pci id, but it will preserve the buffers at alsasound stop or
restart operations just like the latter does.
Takashi
[-- Attachment #2: rme-mem-new.dif --]
[-- Type: application/octet-stream, Size: 8406 bytes --]
Index: alsa-kernel/scripts/Modules.dep
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/scripts/Modules.dep,v
retrieving revision 1.16
diff -u -r1.16 Modules.dep
--- alsa-kernel/scripts/Modules.dep 25 Feb 2003 14:55:50 -0000 1.16
+++ alsa-kernel/scripts/Modules.dep 27 Feb 2003 14:08:14 -0000
@@ -187,9 +187,8 @@
|snd-nm256 snd-pcm snd-ac97-codec
%dir linux/sound/pci/rme9652
-snd-hammerfall-mem
-|snd-rme9652 snd-pcm snd-hammerfall-mem
-|snd-hdsp snd-pcm snd-hammerfall-mem
+|snd-rme9652 snd-pcm
+|snd-hdsp snd-pcm snd-rawmidi
%dir linux/sound/pci/trident
snd-trident-synth @if_sequencer snd-seq-midi-emul snd-ainstr-simple
Index: alsa-kernel/pci/rme9652/Makefile
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/rme9652/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- alsa-kernel/pci/rme9652/Makefile 10 Feb 2003 09:02:18 -0000 1.7
+++ alsa-kernel/pci/rme9652/Makefile 26 Feb 2003 15:52:21 -0000
@@ -3,10 +3,9 @@
# Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz>
#
-snd-hammerfall-mem-objs := hammerfall_mem.o
snd-rme9652-objs := rme9652.o
snd-hdsp-objs := hdsp.o
# Toplevel Module Dependency
-obj-$(CONFIG_SND_RME9652) += snd-rme9652.o snd-hammerfall-mem.o
-obj-$(CONFIG_SND_HDSP) += snd-hdsp.o snd-hammerfall-mem.o
+obj-$(CONFIG_SND_RME9652) += snd-rme9652.o
+obj-$(CONFIG_SND_HDSP) += snd-hdsp.o
Index: alsa-kernel/pci/rme9652/hammerfall_mem.h
===================================================================
RCS file: alsa-kernel/pci/rme9652/hammerfall_mem.h
diff -N alsa-kernel/pci/rme9652/hammerfall_mem.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ alsa-kernel/pci/rme9652/hammerfall_mem.h 28 Feb 2003 13:28:18 -0000
@@ -0,0 +1,35 @@
+/*
+ */
+
+#include <sound/memalloc.h>
+
+static void *snd_hammerfall_get_buffer(struct pci_dev *pci, size_t size, dma_addr_t *addrp, int capture)
+{
+ struct snd_dma_device pdev;
+ struct snd_dma_buffer dmbuf;
+
+ snd_dma_device_pci(&pdev, pci, capture);
+ memset(&dmbuf, 0, sizeof(dmbuf));
+ if (! snd_dma_get_reserved(&pdev, &dmbuf)) {
+ if (snd_dma_alloc_pages(&pdev, size, &dmbuf) < 0)
+ return NULL;
+ snd_dma_set_reserved(&pdev, &dmbuf);
+ }
+ *addrp = dmbuf.addr;
+ return dmbuf.area;
+}
+
+static void snd_hammerfall_free_buffer(struct pci_dev *pci, int capture)
+{
+ struct snd_dma_device dev;
+ snd_dma_device_pci(&dev, pci, capture);
+ snd_dma_set_reserved(&dev, NULL);
+}
+
+static void snd_hammerfall_release_buffer(struct pci_dev *pci, int capture)
+{
+ struct snd_dma_device dev;
+ snd_dma_device_pci(&dev, pci, capture);
+ snd_dma_free_reserved(&dev);
+}
+
Index: alsa-kernel/pci/rme9652/hdsp.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/rme9652/hdsp.c,v
retrieving revision 1.21
diff -u -r1.21 hdsp.c
--- alsa-kernel/pci/rme9652/hdsp.c 14 Feb 2003 09:33:44 -0000 1.21
+++ alsa-kernel/pci/rme9652/hdsp.c 26 Feb 2003 15:52:11 -0000
@@ -405,12 +405,6 @@
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
-#define HDSP_PREALLOCATE_MEMORY /* via module snd-hdsp_mem */
-
-#ifdef HDSP_PREALLOCATE_MEMORY
-extern void *snd_hammerfall_get_buffer(struct pci_dev *, dma_addr_t *dmaaddr);
-extern void snd_hammerfall_free_buffer(struct pci_dev *, void *ptr);
-#endif
static struct pci_device_id snd_hdsp_ids[] __devinitdata = {
{
@@ -2084,28 +2078,16 @@
snd_info_set_text_ops(entry, hdsp, snd_hdsp_proc_read);
}
+#include "hammerfall_mem.h"
+
static void snd_hdsp_free_buffers(hdsp_t *hdsp)
{
if (hdsp->capture_buffer_unaligned) {
-#ifndef HDSP_PREALLOCATE_MEMORY
- snd_free_pci_pages(hdsp->pci,
- HDSP_DMA_AREA_BYTES,
- hdsp->capture_buffer_unaligned,
- hdsp->capture_buffer_addr);
-#else
- snd_hammerfall_free_buffer(hdsp->pci, hdsp->capture_buffer_unaligned);
-#endif
+ snd_hammerfall_release_buffer(hdsp->pci, 1);
}
if (hdsp->playback_buffer_unaligned) {
-#ifndef HDSP_PREALLOCATE_MEMORY
- snd_free_pci_pages(hdsp->pci,
- HDSP_DMA_AREA_BYTES,
- hdsp->playback_buffer_unaligned,
- hdsp->playback_buffer_addr);
-#else
- snd_hammerfall_free_buffer(hdsp->pci, hdsp->playback_buffer_unaligned);
-#endif
+ snd_hammerfall_release_buffer(hdsp->pci, 0);
}
}
@@ -2115,29 +2097,14 @@
dma_addr_t pb_addr, cb_addr;
unsigned long pb_bus, cb_bus;
-#ifndef HDSP_PREALLOCATE_MEMORY
- cb = snd_malloc_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, &cb_addr);
- pb = snd_malloc_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, &pb_addr);
-#else
- cb = snd_hammerfall_get_buffer(hdsp->pci, &cb_addr);
- pb = snd_hammerfall_get_buffer(hdsp->pci, &pb_addr);
-#endif
+ pb = snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, &pb_addr, 0);
+ cb = snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES, &cb_addr, 1);
if (cb == 0 || pb == 0) {
- if (cb) {
-#ifdef HDSP_PREALLOCATE_MEMORY
- snd_hammerfall_free_buffer(hdsp->pci, cb);
-#else
- snd_free_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, cb, cb_addr);
-#endif
- }
- if (pb) {
-#ifdef HDSP_PREALLOCATE_MEMORY
- snd_hammerfall_free_buffer(hdsp->pci, pb);
-#else
- snd_free_pci_pages(hdsp->pci, HDSP_DMA_AREA_BYTES, pb, pb_addr);
-#endif
- }
+ if (pb)
+ snd_hammerfall_free_buffer(hdsp->pci, 0);
+ if (cb)
+ snd_hammerfall_free_buffer(hdsp->pci, 1);
printk(KERN_ERR "%s: no buffers available\n", hdsp->card_name);
return -ENOMEM;
Index: alsa-kernel/pci/rme9652/rme9652.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/rme9652/rme9652.c,v
retrieving revision 1.27
diff -u -r1.27 rme9652.c
--- alsa-kernel/pci/rme9652/rme9652.c 3 Feb 2003 09:48:44 -0000 1.27
+++ alsa-kernel/pci/rme9652/rme9652.c 26 Feb 2003 15:52:04 -0000
@@ -306,12 +306,6 @@
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
-#define RME9652_PREALLOCATE_MEMORY /* via module snd-hammerfall-mem */
-
-#ifdef RME9652_PREALLOCATE_MEMORY
-extern void *snd_hammerfall_get_buffer(struct pci_dev *, dma_addr_t *dmaaddr);
-extern void snd_hammerfall_free_buffer(struct pci_dev *, void *ptr);
-#endif
static struct pci_device_id snd_rme9652_ids[] __devinitdata = {
{
@@ -1807,28 +1801,16 @@
snd_info_set_text_ops(entry, rme9652, snd_rme9652_proc_read);
}
+#include "hammerfall_mem.h"
+
static void snd_rme9652_free_buffers(rme9652_t *rme9652)
{
if (rme9652->capture_buffer_unaligned) {
-#ifndef RME9652_PREALLOCATE_MEMORY
- snd_free_pci_pages(rme9652->pci,
- RME9652_DMA_AREA_BYTES,
- rme9652->capture_buffer_unaligned,
- rme9652->capture_buffer_addr);
-#else
- snd_hammerfall_free_buffer(rme9652->pci, rme9652->capture_buffer_unaligned);
-#endif
+ snd_hammerfall_release_buffer(rme9652->pci, 1);
}
if (rme9652->playback_buffer_unaligned) {
-#ifndef RME9652_PREALLOCATE_MEMORY
- snd_free_pci_pages(rme9652->pci,
- RME9652_DMA_AREA_BYTES,
- rme9652->playback_buffer_unaligned,
- rme9652->playback_buffer_addr);
-#else
- snd_hammerfall_free_buffer(rme9652->pci, rme9652->playback_buffer_unaligned);
-#endif
+ snd_hammerfall_release_buffer(rme9652->pci, 0);
}
}
@@ -1855,29 +1837,14 @@
dma_addr_t pb_addr, cb_addr;
unsigned long pb_bus, cb_bus;
-#ifndef RME9652_PREALLOCATE_MEMORY
- cb = snd_malloc_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, &cb_addr);
- pb = snd_malloc_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, &pb_addr);
-#else
- cb = snd_hammerfall_get_buffer(rme9652->pci, &cb_addr);
- pb = snd_hammerfall_get_buffer(rme9652->pci, &pb_addr);
-#endif
+ pb = snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, &pb_addr, 0);
+ cb = snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES, &cb_addr, 1);
if (cb == 0 || pb == 0) {
- if (cb) {
-#ifdef RME9652_PREALLOCATE_MEMORY
- snd_hammerfall_free_buffer(rme9652->pci, cb);
-#else
- snd_free_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, cb, cb_addr);
-#endif
- }
- if (pb) {
-#ifdef RME9652_PREALLOCATE_MEMORY
- snd_hammerfall_free_buffer(rme9652->pci, pb);
-#else
- snd_free_pci_pages(rme9652->pci, RME9652_DMA_AREA_BYTES, pb, pb_addr);
-#endif
- }
+ if (pb)
+ snd_hammerfall_free_buffer(rme9652->pci, 0);
+ if (cb)
+ snd_hammerfall_free_buffer(rme9652->pci, 1);
printk(KERN_ERR "%s: no buffers available\n", rme9652->card_name);
return -ENOMEM;
next prev parent reply other threads:[~2003-02-28 15:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-27 18:43 hdsp driver Paul Davis
2003-02-28 15:14 ` Takashi Iwai [this message]
2003-03-03 16:11 ` Paul Davis
[not found] ` <20030303160758.C8AD014ECB@Cantor.suse.de>
2003-03-03 16:12 ` Takashi Iwai
2003-03-03 16:37 ` Paul Davis
[not found] ` <20030303163402.5154214599@Cantor.suse.de>
2003-03-03 16:40 ` Takashi Iwai
2003-03-03 16:59 ` Paul Davis
[not found] ` <20030303165638.2893E14801@Cantor.suse.de>
2003-03-03 17:08 ` Takashi Iwai
2003-03-03 19:11 ` Paul Davis
2003-03-02 20:24 ` Thomas Charbonnel
2003-03-02 23:43 ` [PATCH] HDSP rms and peak registers correct offsets (was: Re: hdsp driver) Thomas Charbonnel
2003-03-03 14:23 ` [PATCH] HDSP rms and peak registers correct offsets (was: driver) Mark Knecht
2003-03-03 14:40 ` Thomas Charbonnel
2003-03-03 15:52 ` [PATCH] HDSP rms and peak registers correct offsets (was:Re:hdsp driver) Mark Knecht
2003-03-03 14:55 ` [PATCH] HDSP rms and peak registers correct offsets (was: Re: hdsp driver) Thomas Charbonnel
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=s5hlm00igiz.wl@alsa2.suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@lists.sourceforge.net \
--cc=paul@linuxaudiosystems.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.