1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#include <linux/module.h>
21#include <sound/core.h>
22#include <sound/pcm.h>
23#include <sound/pcm_params.h>
24#include <sound/soc.h>
25#include <sound/dmaengine_pcm.h>
26#include <linux/edma.h>
27
28#include "edma-pcm.h"
29
30static const struct snd_pcm_hardware edma_pcm_hardware = {
31 .info = SNDRV_PCM_INFO_MMAP |
32 SNDRV_PCM_INFO_MMAP_VALID |
33 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME |
34 SNDRV_PCM_INFO_NO_PERIOD_WAKEUP |
35 SNDRV_PCM_INFO_INTERLEAVED,
36 .buffer_bytes_max = 128 * 1024,
37 .period_bytes_min = 32,
38 .period_bytes_max = 64 * 1024,
39 .periods_min = 2,
40 .periods_max = 19,
41};
42
43static const struct snd_dmaengine_pcm_config edma_dmaengine_pcm_config = {
44 .pcm_hardware = &edma_pcm_hardware,
45 .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
46 .compat_filter_fn = edma_filter_fn,
47 .prealloc_buffer_size = 128 * 1024,
48};
49
50int edma_pcm_platform_register(struct device *dev)
51{
52 return devm_snd_dmaengine_pcm_register(dev, &edma_dmaengine_pcm_config,
53 SND_DMAENGINE_PCM_FLAG_COMPAT);
54}
55EXPORT_SYMBOL_GPL(edma_pcm_platform_register);
56
57MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>");
58MODULE_DESCRIPTION("eDMA PCM ASoC platform driver");
59MODULE_LICENSE("GPL");
60