aboutsummaryrefslogtreecommitdiffstats
path: root/sound/arm
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-11-26 09:08:54 -0500
committerTakashi Iwai <tiwai@suse.de>2009-11-27 04:15:24 -0500
commitd6797322231af98b9bb4afb175dd614cf511e5f7 (patch)
treecbeb990703df277452611c2e3ea9f4c45ff9c5e6 /sound/arm
parent6985c8877a711c7c307af05203858cb7c3c89d0d (diff)
ALSA: Remove old DMA-mmap code from arm/devdma.c
The call of dma_mmap_coherent() is done in the PCM core now. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/arm')
-rw-r--r--sound/arm/Makefile2
-rw-r--r--sound/arm/aaci.c16
-rw-r--r--sound/arm/devdma.c80
-rw-r--r--sound/arm/devdma.h3
4 files changed, 6 insertions, 95 deletions
diff --git a/sound/arm/Makefile b/sound/arm/Makefile
index 5a549ed6c8aa..8c0c851d4641 100644
--- a/sound/arm/Makefile
+++ b/sound/arm/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o 5obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o
6snd-aaci-objs := aaci.o devdma.o 6snd-aaci-objs := aaci.o
7 7
8obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o 8obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o
9snd-pxa2xx-pcm-objs := pxa2xx-pcm.o 9snd-pxa2xx-pcm-objs := pxa2xx-pcm.o
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 1f0f8213e2d5..e59372887f36 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -30,7 +30,6 @@
30#include <sound/pcm_params.h> 30#include <sound/pcm_params.h>
31 31
32#include "aaci.h" 32#include "aaci.h"
33#include "devdma.h"
34 33
35#define DRIVER_NAME "aaci-pl041" 34#define DRIVER_NAME "aaci-pl041"
36 35
@@ -492,7 +491,7 @@ static int aaci_pcm_hw_free(struct snd_pcm_substream *substream)
492 /* 491 /*
493 * Clear out the DMA and any allocated buffers. 492 * Clear out the DMA and any allocated buffers.
494 */ 493 */
495 devdma_hw_free(NULL, substream); 494 snd_pcm_lib_free_pages(substream);
496 495
497 return 0; 496 return 0;
498} 497}
@@ -505,8 +504,8 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream,
505 504
506 aaci_pcm_hw_free(substream); 505 aaci_pcm_hw_free(substream);
507 506
508 err = devdma_hw_alloc(NULL, substream, 507 err = snd_pcm_lib_malloc_pages(substream,
509 params_buffer_bytes(params)); 508 params_buffer_bytes(params));
510 if (err < 0) 509 if (err < 0)
511 goto out; 510 goto out;
512 511
@@ -551,11 +550,6 @@ static snd_pcm_uframes_t aaci_pcm_pointer(struct snd_pcm_substream *substream)
551 return bytes_to_frames(runtime, bytes); 550 return bytes_to_frames(runtime, bytes);
552} 551}
553 552
554static int aaci_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma)
555{
556 return devdma_mmap(NULL, substream, vma);
557}
558
559 553
560/* 554/*
561 * Playback specific ALSA stuff 555 * Playback specific ALSA stuff
@@ -722,7 +716,6 @@ static struct snd_pcm_ops aaci_playback_ops = {
722 .prepare = aaci_pcm_prepare, 716 .prepare = aaci_pcm_prepare,
723 .trigger = aaci_pcm_playback_trigger, 717 .trigger = aaci_pcm_playback_trigger,
724 .pointer = aaci_pcm_pointer, 718 .pointer = aaci_pcm_pointer,
725 .mmap = aaci_pcm_mmap,
726}; 719};
727 720
728static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, 721static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream,
@@ -850,7 +843,6 @@ static struct snd_pcm_ops aaci_capture_ops = {
850 .prepare = aaci_pcm_capture_prepare, 843 .prepare = aaci_pcm_capture_prepare,
851 .trigger = aaci_pcm_capture_trigger, 844 .trigger = aaci_pcm_capture_trigger,
852 .pointer = aaci_pcm_pointer, 845 .pointer = aaci_pcm_pointer,
853 .mmap = aaci_pcm_mmap,
854}; 846};
855 847
856/* 848/*
@@ -1040,6 +1032,8 @@ static int __devinit aaci_init_pcm(struct aaci *aaci)
1040 1032
1041 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); 1033 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops);
1042 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops); 1034 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops);
1035 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1036 NULL, 0, 64 * 104);
1043 } 1037 }
1044 1038
1045 return ret; 1039 return ret;
diff --git a/sound/arm/devdma.c b/sound/arm/devdma.c
deleted file mode 100644
index 9d1e6665b546..000000000000
--- a/sound/arm/devdma.c
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * linux/sound/arm/devdma.c
3 *
4 * Copyright (C) 2003-2004 Russell King, All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ARM DMA shim for ALSA.
11 */
12#include <linux/device.h>
13#include <linux/dma-mapping.h>
14
15#include <sound/core.h>
16#include <sound/pcm.h>
17
18#include "devdma.h"
19
20void devdma_hw_free(struct device *dev, struct snd_pcm_substream *substream)
21{
22 struct snd_pcm_runtime *runtime = substream->runtime;
23 struct snd_dma_buffer *buf = runtime->dma_buffer_p;
24
25 if (runtime->dma_area == NULL)
26 return;
27
28 if (buf != &substream->dma_buffer) {
29 dma_free_coherent(buf->dev.dev, buf->bytes, buf->area, buf->addr);
30 kfree(runtime->dma_buffer_p);
31 }
32
33 snd_pcm_set_runtime_buffer(substream, NULL);
34}
35
36int devdma_hw_alloc(struct device *dev, struct snd_pcm_substream *substream, size_t size)
37{
38 struct snd_pcm_runtime *runtime = substream->runtime;
39 struct snd_dma_buffer *buf = runtime->dma_buffer_p;
40 int ret = 0;
41
42 if (buf) {
43 if (buf->bytes >= size)
44 goto out;
45 devdma_hw_free(dev, substream);
46 }
47
48 if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) {
49 buf = &substream->dma_buffer;
50 } else {
51 buf = kmalloc(sizeof(struct snd_dma_buffer), GFP_KERNEL);
52 if (!buf)
53 goto nomem;
54
55 buf->dev.type = SNDRV_DMA_TYPE_DEV;
56 buf->dev.dev = dev;
57 buf->area = dma_alloc_coherent(dev, size, &buf->addr, GFP_KERNEL);
58 buf->bytes = size;
59 buf->private_data = NULL;
60
61 if (!buf->area)
62 goto free;
63 }
64 snd_pcm_set_runtime_buffer(substream, buf);
65 ret = 1;
66 out:
67 runtime->dma_bytes = size;
68 return ret;
69
70 free:
71 kfree(buf);
72 nomem:
73 return -ENOMEM;
74}
75
76int devdma_mmap(struct device *dev, struct snd_pcm_substream *substream, struct vm_area_struct *vma)
77{
78 struct snd_pcm_runtime *runtime = substream->runtime;
79 return dma_mmap_coherent(dev, vma, runtime->dma_area, runtime->dma_addr, runtime->dma_bytes);
80}
diff --git a/sound/arm/devdma.h b/sound/arm/devdma.h
deleted file mode 100644
index d025329c8a0f..000000000000
--- a/sound/arm/devdma.h
+++ /dev/null
@@ -1,3 +0,0 @@
1void devdma_hw_free(struct device *dev, struct snd_pcm_substream *substream);
2int devdma_hw_alloc(struct device *dev, struct snd_pcm_substream *substream, size_t size);
3int devdma_mmap(struct device *dev, struct snd_pcm_substream *substream, struct vm_area_struct *vma);