diff options
Diffstat (limited to 'sound/arm')
-rw-r--r-- | sound/arm/Makefile | 2 | ||||
-rw-r--r-- | sound/arm/aaci.c | 35 | ||||
-rw-r--r-- | sound/arm/devdma.c | 80 | ||||
-rw-r--r-- | sound/arm/devdma.h | 3 |
4 files changed, 11 insertions, 109 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 | ||
5 | obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o | 5 | obj-$(CONFIG_SND_ARMAACI) += snd-aaci.o |
6 | snd-aaci-objs := aaci.o devdma.o | 6 | snd-aaci-objs := aaci.o |
7 | 7 | ||
8 | obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o | 8 | obj-$(CONFIG_SND_PXA2XX_PCM) += snd-pxa2xx-pcm.o |
9 | snd-pxa2xx-pcm-objs := pxa2xx-pcm.o | 9 | snd-pxa2xx-pcm-objs := pxa2xx-pcm.o |
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c index 6c160a038b23..1497dce1b04a 100644 --- a/sound/arm/aaci.c +++ b/sound/arm/aaci.c | |||
@@ -18,10 +18,7 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/err.h> | 19 | #include <linux/err.h> |
20 | #include <linux/amba/bus.h> | 20 | #include <linux/amba/bus.h> |
21 | 21 | #include <linux/io.h> | |
22 | #include <asm/io.h> | ||
23 | #include <asm/irq.h> | ||
24 | #include <asm/sizes.h> | ||
25 | 22 | ||
26 | #include <sound/core.h> | 23 | #include <sound/core.h> |
27 | #include <sound/initval.h> | 24 | #include <sound/initval.h> |
@@ -30,7 +27,6 @@ | |||
30 | #include <sound/pcm_params.h> | 27 | #include <sound/pcm_params.h> |
31 | 28 | ||
32 | #include "aaci.h" | 29 | #include "aaci.h" |
33 | #include "devdma.h" | ||
34 | 30 | ||
35 | #define DRIVER_NAME "aaci-pl041" | 31 | #define DRIVER_NAME "aaci-pl041" |
36 | 32 | ||
@@ -492,7 +488,7 @@ static int aaci_pcm_hw_free(struct snd_pcm_substream *substream) | |||
492 | /* | 488 | /* |
493 | * Clear out the DMA and any allocated buffers. | 489 | * Clear out the DMA and any allocated buffers. |
494 | */ | 490 | */ |
495 | devdma_hw_free(NULL, substream); | 491 | snd_pcm_lib_free_pages(substream); |
496 | 492 | ||
497 | return 0; | 493 | return 0; |
498 | } | 494 | } |
@@ -509,20 +505,14 @@ static int aaci_pcm_hw_params(struct snd_pcm_substream *substream, | |||
509 | aacirun->pcm_open = 0; | 505 | aacirun->pcm_open = 0; |
510 | } | 506 | } |
511 | 507 | ||
512 | err = devdma_hw_alloc(NULL, substream, | 508 | err = snd_pcm_lib_malloc_pages(substream, |
513 | params_buffer_bytes(params)); | 509 | params_buffer_bytes(params)); |
514 | if (err < 0) | 510 | if (err < 0) |
515 | goto out; | 511 | goto out; |
516 | 512 | ||
517 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 513 | err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), |
518 | err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), | 514 | params_channels(params), |
519 | params_channels(params), | 515 | aacirun->pcm->r[0].slots); |
520 | aacirun->pcm->r[0].slots); | ||
521 | else | ||
522 | err = snd_ac97_pcm_open(aacirun->pcm, params_rate(params), | ||
523 | params_channels(params), | ||
524 | aacirun->pcm->r[0].slots); | ||
525 | |||
526 | if (err) | 516 | if (err) |
527 | goto out; | 517 | goto out; |
528 | 518 | ||
@@ -538,7 +528,7 @@ static int aaci_pcm_prepare(struct snd_pcm_substream *substream) | |||
538 | struct aaci_runtime *aacirun = runtime->private_data; | 528 | struct aaci_runtime *aacirun = runtime->private_data; |
539 | 529 | ||
540 | aacirun->start = (void *)runtime->dma_area; | 530 | aacirun->start = (void *)runtime->dma_area; |
541 | aacirun->end = aacirun->start + runtime->dma_bytes; | 531 | aacirun->end = aacirun->start + snd_pcm_lib_buffer_bytes(substream); |
542 | aacirun->ptr = aacirun->start; | 532 | aacirun->ptr = aacirun->start; |
543 | aacirun->period = | 533 | aacirun->period = |
544 | aacirun->bytes = frames_to_bytes(runtime, runtime->period_size); | 534 | aacirun->bytes = frames_to_bytes(runtime, runtime->period_size); |
@@ -555,11 +545,6 @@ static snd_pcm_uframes_t aaci_pcm_pointer(struct snd_pcm_substream *substream) | |||
555 | return bytes_to_frames(runtime, bytes); | 545 | return bytes_to_frames(runtime, bytes); |
556 | } | 546 | } |
557 | 547 | ||
558 | static int aaci_pcm_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *vma) | ||
559 | { | ||
560 | return devdma_mmap(NULL, substream, vma); | ||
561 | } | ||
562 | |||
563 | 548 | ||
564 | /* | 549 | /* |
565 | * Playback specific ALSA stuff | 550 | * Playback specific ALSA stuff |
@@ -726,7 +711,6 @@ static struct snd_pcm_ops aaci_playback_ops = { | |||
726 | .prepare = aaci_pcm_prepare, | 711 | .prepare = aaci_pcm_prepare, |
727 | .trigger = aaci_pcm_playback_trigger, | 712 | .trigger = aaci_pcm_playback_trigger, |
728 | .pointer = aaci_pcm_pointer, | 713 | .pointer = aaci_pcm_pointer, |
729 | .mmap = aaci_pcm_mmap, | ||
730 | }; | 714 | }; |
731 | 715 | ||
732 | static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, | 716 | static int aaci_pcm_capture_hw_params(struct snd_pcm_substream *substream, |
@@ -854,7 +838,6 @@ static struct snd_pcm_ops aaci_capture_ops = { | |||
854 | .prepare = aaci_pcm_capture_prepare, | 838 | .prepare = aaci_pcm_capture_prepare, |
855 | .trigger = aaci_pcm_capture_trigger, | 839 | .trigger = aaci_pcm_capture_trigger, |
856 | .pointer = aaci_pcm_pointer, | 840 | .pointer = aaci_pcm_pointer, |
857 | .mmap = aaci_pcm_mmap, | ||
858 | }; | 841 | }; |
859 | 842 | ||
860 | /* | 843 | /* |
@@ -1044,6 +1027,8 @@ static int __devinit aaci_init_pcm(struct aaci *aaci) | |||
1044 | 1027 | ||
1045 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); | 1028 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &aaci_playback_ops); |
1046 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops); | 1029 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &aaci_capture_ops); |
1030 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | ||
1031 | NULL, 0, 64 * 104); | ||
1047 | } | 1032 | } |
1048 | 1033 | ||
1049 | return ret; | 1034 | 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 | |||
20 | void 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 | |||
36 | int 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 | |||
76 | int 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 @@ | |||
1 | void devdma_hw_free(struct device *dev, struct snd_pcm_substream *substream); | ||
2 | int devdma_hw_alloc(struct device *dev, struct snd_pcm_substream *substream, size_t size); | ||
3 | int devdma_mmap(struct device *dev, struct snd_pcm_substream *substream, struct vm_area_struct *vma); | ||