aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl3
-rw-r--r--include/sound/core.h3
-rw-r--r--include/sound/memalloc.h2
-rw-r--r--sound/core/memalloc.c50
4 files changed, 2 insertions, 56 deletions
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
index e13c4e67029f..56723b42813e 100644
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
@@ -5073,8 +5073,7 @@ struct _snd_pcm_runtime {
5073 with <constant>SNDRV_DMA_TYPE_CONTINUOUS</constant> type and the 5073 with <constant>SNDRV_DMA_TYPE_CONTINUOUS</constant> type and the
5074 <function>snd_dma_continuous_data(GFP_KERNEL)</function> device pointer, 5074 <function>snd_dma_continuous_data(GFP_KERNEL)</function> device pointer,
5075 where <constant>GFP_KERNEL</constant> is the kernel allocation flag to 5075 where <constant>GFP_KERNEL</constant> is the kernel allocation flag to
5076 use. For the SBUS, <constant>SNDRV_DMA_TYPE_SBUS</constant> and 5076 use.
5077 <function>snd_dma_sbus_data(sbus_dev)</function> are used instead.
5078 For the PCI scatter-gather buffers, use 5077 For the PCI scatter-gather buffers, use
5079 <constant>SNDRV_DMA_TYPE_DEV_SG</constant> with 5078 <constant>SNDRV_DMA_TYPE_DEV_SG</constant> with
5080 <function>snd_dma_pci_data(pci)</function> 5079 <function>snd_dma_pci_data(pci)</function>
diff --git a/include/sound/core.h b/include/sound/core.h
index 558b96284bd2..821d5a59d28b 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -42,9 +42,6 @@
42#ifdef CONFIG_PCI 42#ifdef CONFIG_PCI
43struct pci_dev; 43struct pci_dev;
44#endif 44#endif
45#ifdef CONFIG_SBUS
46struct sbus_dev;
47#endif
48 45
49/* device allocation stuff */ 46/* device allocation stuff */
50 47
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
index ae2921d9ddcc..6a3e7558a7e6 100644
--- a/include/sound/memalloc.h
+++ b/include/sound/memalloc.h
@@ -37,7 +37,6 @@ struct snd_dma_device {
37#ifndef snd_dma_pci_data 37#ifndef snd_dma_pci_data
38#define snd_dma_pci_data(pci) (&(pci)->dev) 38#define snd_dma_pci_data(pci) (&(pci)->dev)
39#define snd_dma_isa_data() NULL 39#define snd_dma_isa_data() NULL
40#define snd_dma_sbus_data(sbus) ((struct device *)(sbus))
41#define snd_dma_continuous_data(x) ((struct device *)(unsigned long)(x)) 40#define snd_dma_continuous_data(x) ((struct device *)(unsigned long)(x))
42#endif 41#endif
43 42
@@ -49,7 +48,6 @@ struct snd_dma_device {
49#define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ 48#define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */
50#define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */ 49#define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */
51#define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */ 50#define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */
52#define SNDRV_DMA_TYPE_SBUS 4 /* SBUS continuous */
53 51
54/* 52/*
55 * info for buffer allocation 53 * info for buffer allocation
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index ccaaac45fafb..3733351a27f2 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -33,9 +33,6 @@
33#include <linux/moduleparam.h> 33#include <linux/moduleparam.h>
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <sound/memalloc.h> 35#include <sound/memalloc.h>
36#ifdef CONFIG_SBUS
37#include <asm/sbus.h>
38#endif
39 36
40 37
41MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>"); 38MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>");
@@ -180,41 +177,6 @@ static void snd_free_dev_pages(struct device *dev, size_t size, void *ptr,
180} 177}
181#endif /* CONFIG_HAS_DMA */ 178#endif /* CONFIG_HAS_DMA */
182 179
183#ifdef CONFIG_SBUS
184
185static void *snd_malloc_sbus_pages(struct device *dev, size_t size,
186 dma_addr_t *dma_addr)
187{
188 struct sbus_dev *sdev = (struct sbus_dev *)dev;
189 int pg;
190 void *res;
191
192 snd_assert(size > 0, return NULL);
193 snd_assert(dma_addr != NULL, return NULL);
194 pg = get_order(size);
195 res = dma_alloc_coherent(&sdev->ofdev.dev, PAGE_SIZE * (1 << pg),
196 dma_addr, GFP_ATOMIC);
197 if (res != NULL)
198 inc_snd_pages(pg);
199 return res;
200}
201
202static void snd_free_sbus_pages(struct device *dev, size_t size,
203 void *ptr, dma_addr_t dma_addr)
204{
205 struct sbus_dev *sdev = (struct sbus_dev *)dev;
206 int pg;
207
208 if (ptr == NULL)
209 return;
210 pg = get_order(size);
211 dec_snd_pages(pg);
212 dma_free_coherent(&sdev->ofdev.dev, PAGE_SIZE * (1 << pg),
213 ptr, dma_addr);
214}
215
216#endif /* CONFIG_SBUS */
217
218/* 180/*
219 * 181 *
220 * ALSA generic memory management 182 * ALSA generic memory management
@@ -249,11 +211,6 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,
249 dmab->area = snd_malloc_pages(size, (unsigned long)device); 211 dmab->area = snd_malloc_pages(size, (unsigned long)device);
250 dmab->addr = 0; 212 dmab->addr = 0;
251 break; 213 break;
252#ifdef CONFIG_SBUS
253 case SNDRV_DMA_TYPE_SBUS:
254 dmab->area = snd_malloc_sbus_pages(device, size, &dmab->addr);
255 break;
256#endif
257#ifdef CONFIG_HAS_DMA 214#ifdef CONFIG_HAS_DMA
258 case SNDRV_DMA_TYPE_DEV: 215 case SNDRV_DMA_TYPE_DEV:
259 dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr); 216 dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr);
@@ -322,11 +279,6 @@ void snd_dma_free_pages(struct snd_dma_buffer *dmab)
322 case SNDRV_DMA_TYPE_CONTINUOUS: 279 case SNDRV_DMA_TYPE_CONTINUOUS:
323 snd_free_pages(dmab->area, dmab->bytes); 280 snd_free_pages(dmab->area, dmab->bytes);
324 break; 281 break;
325#ifdef CONFIG_SBUS
326 case SNDRV_DMA_TYPE_SBUS:
327 snd_free_sbus_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr);
328 break;
329#endif
330#ifdef CONFIG_HAS_DMA 282#ifdef CONFIG_HAS_DMA
331 case SNDRV_DMA_TYPE_DEV: 283 case SNDRV_DMA_TYPE_DEV:
332 snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr); 284 snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr);
@@ -433,7 +385,7 @@ static int snd_mem_proc_read(struct seq_file *seq, void *offset)
433 long pages = snd_allocated_pages >> (PAGE_SHIFT-12); 385 long pages = snd_allocated_pages >> (PAGE_SHIFT-12);
434 struct snd_mem_list *mem; 386 struct snd_mem_list *mem;
435 int devno; 387 int devno;
436 static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" }; 388 static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG" };
437 389
438 mutex_lock(&list_mutex); 390 mutex_lock(&list_mutex);
439 seq_printf(seq, "pages : %li bytes (%li pages per %likB)\n", 391 seq_printf(seq, "pages : %li bytes (%li pages per %likB)\n",