1 // SPDX-License-Identifier: GPL-2.0-only
3 * edma-pcm.c - eDMA PCM driver using dmaengine for AM3xxx, AM4xxx
5 * Copyright (C) 2014 Texas Instruments, Inc.
7 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
9 * Based on: sound/soc/tegra/tegra_pcm.c
12 #include <linux/module.h>
13 #include <sound/core.h>
14 #include <sound/pcm.h>
15 #include <sound/pcm_params.h>
16 #include <sound/soc.h>
17 #include <sound/dmaengine_pcm.h>
21 static const struct snd_pcm_hardware edma_pcm_hardware
= {
22 .info
= SNDRV_PCM_INFO_MMAP
|
23 SNDRV_PCM_INFO_MMAP_VALID
|
24 SNDRV_PCM_INFO_PAUSE
| SNDRV_PCM_INFO_RESUME
|
25 SNDRV_PCM_INFO_NO_PERIOD_WAKEUP
|
26 SNDRV_PCM_INFO_INTERLEAVED
,
27 .buffer_bytes_max
= 128 * 1024,
28 .period_bytes_min
= 32,
29 .period_bytes_max
= 64 * 1024,
31 .periods_max
= 19, /* Limit by edma dmaengine driver */
34 static const struct snd_dmaengine_pcm_config edma_dmaengine_pcm_config
= {
35 .pcm_hardware
= &edma_pcm_hardware
,
36 .prepare_slave_config
= snd_dmaengine_pcm_prepare_slave_config
,
37 .prealloc_buffer_size
= 128 * 1024,
40 int edma_pcm_platform_register(struct device
*dev
)
42 struct snd_dmaengine_pcm_config
*config
;
45 return devm_snd_dmaengine_pcm_register(dev
,
46 &edma_dmaengine_pcm_config
, 0);
48 config
= devm_kzalloc(dev
, sizeof(*config
), GFP_KERNEL
);
52 *config
= edma_dmaengine_pcm_config
;
54 config
->chan_names
[0] = "tx";
55 config
->chan_names
[1] = "rx";
57 return devm_snd_dmaengine_pcm_register(dev
, config
, 0);
59 EXPORT_SYMBOL_GPL(edma_pcm_platform_register
);
61 MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>");
62 MODULE_DESCRIPTION("eDMA PCM ASoC platform driver");
63 MODULE_LICENSE("GPL");