Commit | Line | Data |
---|---|---|
db5bf412 RM |
1 | /* |
2 | * linux/sound/arm/ep93xx-pcm.c - EP93xx ALSA PCM interface | |
3 | * | |
4 | * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | |
5 | * Copyright (C) 2006 Applied Data Systems | |
6 | * | |
7 | * Rewritten for the SoC audio subsystem (Based on PXA2xx code): | |
1c5454ee | 8 | * Copyright (c) 2008 Ryan Mallon |
db5bf412 RM |
9 | * |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License version 2 as | |
12 | * published by the Free Software Foundation. | |
13 | */ | |
14 | ||
15 | #include <linux/module.h> | |
16 | #include <linux/init.h> | |
e27e8a60 | 17 | #include <linux/platform_device.h> |
51e2cc0c | 18 | #include <linux/dmaengine.h> |
db5bf412 | 19 | |
db5bf412 | 20 | #include <sound/pcm.h> |
db5bf412 | 21 | #include <sound/soc.h> |
d7a42e10 | 22 | #include <sound/dmaengine_pcm.h> |
db5bf412 | 23 | |
a3b29245 | 24 | #include <linux/platform_data/dma-ep93xx.h> |
db5bf412 | 25 | |
6f2032a1 SW |
26 | #include "ep93xx-pcm.h" |
27 | ||
db5bf412 RM |
28 | static const struct snd_pcm_hardware ep93xx_pcm_hardware = { |
29 | .info = (SNDRV_PCM_INFO_MMAP | | |
30 | SNDRV_PCM_INFO_MMAP_VALID | | |
31 | SNDRV_PCM_INFO_INTERLEAVED | | |
32 | SNDRV_PCM_INFO_BLOCK_TRANSFER), | |
db5bf412 RM |
33 | .buffer_bytes_max = 131072, |
34 | .period_bytes_min = 32, | |
35 | .period_bytes_max = 32768, | |
36 | .periods_min = 1, | |
37 | .periods_max = 32, | |
38 | .fifo_size = 32, | |
39 | }; | |
40 | ||
51e2cc0c | 41 | static bool ep93xx_pcm_dma_filter(struct dma_chan *chan, void *filter_param) |
db5bf412 | 42 | { |
51e2cc0c | 43 | struct ep93xx_dma_data *data = filter_param; |
db5bf412 | 44 | |
51e2cc0c MW |
45 | if (data->direction == ep93xx_dma_chan_direction(chan)) { |
46 | chan->private = data; | |
47 | return true; | |
db5bf412 | 48 | } |
51e2cc0c MW |
49 | |
50 | return false; | |
db5bf412 RM |
51 | } |
52 | ||
e27e8a60 LPC |
53 | static const struct snd_dmaengine_pcm_config ep93xx_dmaengine_pcm_config = { |
54 | .pcm_hardware = &ep93xx_pcm_hardware, | |
55 | .compat_filter_fn = ep93xx_pcm_dma_filter, | |
56 | .prealloc_buffer_size = 131072, | |
db5bf412 | 57 | }; |
f0fba2ad | 58 | |
6f2032a1 | 59 | int devm_ep93xx_pcm_platform_register(struct device *dev) |
f0fba2ad | 60 | { |
6f2032a1 | 61 | return devm_snd_dmaengine_pcm_register(dev, |
e27e8a60 | 62 | &ep93xx_dmaengine_pcm_config, |
e27e8a60 LPC |
63 | SND_DMAENGINE_PCM_FLAG_NO_DT | |
64 | SND_DMAENGINE_PCM_FLAG_COMPAT); | |
f0fba2ad | 65 | } |
6f2032a1 | 66 | EXPORT_SYMBOL_GPL(devm_ep93xx_pcm_platform_register); |
db5bf412 | 67 | |
1c5454ee | 68 | MODULE_AUTHOR("Ryan Mallon"); |
db5bf412 RM |
69 | MODULE_DESCRIPTION("EP93xx ALSA PCM interface"); |
70 | MODULE_LICENSE("GPL"); |