1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32#include <linux/module.h>
33#include <sound/core.h>
34#include <sound/pcm.h>
35#include <sound/pcm_params.h>
36#include <sound/soc.h>
37#include <sound/dmaengine_pcm.h>
38
39#include "tegra_pcm.h"
40
41static const struct snd_pcm_hardware tegra_pcm_hardware = {
42 .info = SNDRV_PCM_INFO_MMAP |
43 SNDRV_PCM_INFO_MMAP_VALID |
44 SNDRV_PCM_INFO_INTERLEAVED,
45 .period_bytes_min = 1024,
46 .period_bytes_max = PAGE_SIZE,
47 .periods_min = 2,
48 .periods_max = 8,
49 .buffer_bytes_max = PAGE_SIZE * 8,
50 .fifo_size = 4,
51};
52
53static const struct snd_dmaengine_pcm_config tegra_dmaengine_pcm_config = {
54 .pcm_hardware = &tegra_pcm_hardware,
55 .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
56 .prealloc_buffer_size = PAGE_SIZE * 8,
57};
58
59int tegra_pcm_platform_register(struct device *dev)
60{
61 return snd_dmaengine_pcm_register(dev, &tegra_dmaengine_pcm_config, 0);
62}
63EXPORT_SYMBOL_GPL(tegra_pcm_platform_register);
64
65int tegra_pcm_platform_register_with_chan_names(struct device *dev,
66 struct snd_dmaengine_pcm_config *config,
67 char *txdmachan, char *rxdmachan)
68{
69 *config = tegra_dmaengine_pcm_config;
70 config->dma_dev = dev->parent;
71 config->chan_names[0] = txdmachan;
72 config->chan_names[1] = rxdmachan;
73
74 return snd_dmaengine_pcm_register(dev, config, 0);
75}
76EXPORT_SYMBOL_GPL(tegra_pcm_platform_register_with_chan_names);
77
78void tegra_pcm_platform_unregister(struct device *dev)
79{
80 return snd_dmaengine_pcm_unregister(dev);
81}
82EXPORT_SYMBOL_GPL(tegra_pcm_platform_unregister);
83
84MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
85MODULE_DESCRIPTION("Tegra PCM ASoC driver");
86MODULE_LICENSE("GPL");
87