diff options
Diffstat (limited to 'sound/soc/spear/spear_pcm.c')
-rw-r--r-- | sound/soc/spear/spear_pcm.c | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c index 4707f2b862c3..0e5a8f35d0ad 100644 --- a/sound/soc/spear/spear_pcm.c +++ b/sound/soc/spear/spear_pcm.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <sound/pcm.h> | 18 | #include <sound/pcm.h> |
19 | #include <sound/soc.h> | 19 | #include <sound/soc.h> |
20 | #include <sound/spear_dma.h> | 20 | #include <sound/spear_dma.h> |
21 | #include "spear_pcm.h" | ||
21 | 22 | ||
22 | static const struct snd_pcm_hardware spear_pcm_hardware = { | 23 | static const struct snd_pcm_hardware spear_pcm_hardware = { |
23 | .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 24 | .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
@@ -31,49 +32,24 @@ static const struct snd_pcm_hardware spear_pcm_hardware = { | |||
31 | .fifo_size = 0, /* fifo size in bytes */ | 32 | .fifo_size = 0, /* fifo size in bytes */ |
32 | }; | 33 | }; |
33 | 34 | ||
34 | static struct dma_chan *spear_pcm_request_chan(struct snd_soc_pcm_runtime *rtd, | ||
35 | struct snd_pcm_substream *substream) | ||
36 | { | ||
37 | struct spear_dma_data *dma_data; | ||
38 | |||
39 | dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | ||
40 | |||
41 | return snd_dmaengine_pcm_request_channel(dma_data->filter, dma_data); | ||
42 | } | ||
43 | |||
44 | static const struct snd_dmaengine_pcm_config spear_dmaengine_pcm_config = { | 35 | static const struct snd_dmaengine_pcm_config spear_dmaengine_pcm_config = { |
45 | .pcm_hardware = &spear_pcm_hardware, | 36 | .pcm_hardware = &spear_pcm_hardware, |
46 | .compat_request_channel = spear_pcm_request_chan, | ||
47 | .prealloc_buffer_size = 16 * 1024, | 37 | .prealloc_buffer_size = 16 * 1024, |
48 | }; | 38 | }; |
49 | 39 | ||
50 | static int spear_soc_platform_probe(struct platform_device *pdev) | 40 | int devm_spear_pcm_platform_register(struct device *dev, |
41 | struct snd_dmaengine_pcm_config *config, | ||
42 | bool (*filter)(struct dma_chan *chan, void *slave)) | ||
51 | { | 43 | { |
52 | return snd_dmaengine_pcm_register(&pdev->dev, | 44 | *config = spear_dmaengine_pcm_config; |
53 | &spear_dmaengine_pcm_config, | 45 | config->compat_filter_fn = filter; |
46 | |||
47 | return snd_dmaengine_pcm_register(dev, config, | ||
54 | SND_DMAENGINE_PCM_FLAG_NO_DT | | 48 | SND_DMAENGINE_PCM_FLAG_NO_DT | |
55 | SND_DMAENGINE_PCM_FLAG_COMPAT); | 49 | SND_DMAENGINE_PCM_FLAG_COMPAT); |
56 | } | 50 | } |
57 | 51 | EXPORT_SYMBOL_GPL(devm_spear_pcm_platform_register); | |
58 | static int spear_soc_platform_remove(struct platform_device *pdev) | ||
59 | { | ||
60 | snd_dmaengine_pcm_unregister(&pdev->dev); | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static struct platform_driver spear_pcm_driver = { | ||
65 | .driver = { | ||
66 | .name = "spear-pcm-audio", | ||
67 | .owner = THIS_MODULE, | ||
68 | }, | ||
69 | |||
70 | .probe = spear_soc_platform_probe, | ||
71 | .remove = spear_soc_platform_remove, | ||
72 | }; | ||
73 | |||
74 | module_platform_driver(spear_pcm_driver); | ||
75 | 52 | ||
76 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); | 53 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); |
77 | MODULE_DESCRIPTION("SPEAr PCM DMA module"); | 54 | MODULE_DESCRIPTION("SPEAr PCM DMA module"); |
78 | MODULE_LICENSE("GPL"); | 55 | MODULE_LICENSE("GPL"); |
79 | MODULE_ALIAS("platform:spear-pcm-audio"); | ||