0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <linux/module.h>
0013 #include <sound/core.h>
0014 #include <sound/pcm.h>
0015 #include <sound/pcm_params.h>
0016 #include <sound/soc.h>
0017 #include <sound/dmaengine_pcm.h>
0018
0019 #include "edma-pcm.h"
0020
0021 static const struct snd_pcm_hardware edma_pcm_hardware = {
0022 .info = SNDRV_PCM_INFO_MMAP |
0023 SNDRV_PCM_INFO_MMAP_VALID |
0024 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME |
0025 SNDRV_PCM_INFO_NO_PERIOD_WAKEUP |
0026 SNDRV_PCM_INFO_INTERLEAVED,
0027 .buffer_bytes_max = 128 * 1024,
0028 .period_bytes_min = 32,
0029 .period_bytes_max = 64 * 1024,
0030 .periods_min = 2,
0031 .periods_max = 19,
0032 };
0033
0034 static const struct snd_dmaengine_pcm_config edma_dmaengine_pcm_config = {
0035 .pcm_hardware = &edma_pcm_hardware,
0036 .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
0037 .prealloc_buffer_size = 128 * 1024,
0038 };
0039
0040 int edma_pcm_platform_register(struct device *dev)
0041 {
0042 struct snd_dmaengine_pcm_config *config;
0043
0044 if (dev->of_node)
0045 return devm_snd_dmaengine_pcm_register(dev,
0046 &edma_dmaengine_pcm_config, 0);
0047
0048 config = devm_kzalloc(dev, sizeof(*config), GFP_KERNEL);
0049 if (!config)
0050 return -ENOMEM;
0051
0052 *config = edma_dmaengine_pcm_config;
0053
0054 config->chan_names[0] = "tx";
0055 config->chan_names[1] = "rx";
0056
0057 return devm_snd_dmaengine_pcm_register(dev, config, 0);
0058 }
0059 EXPORT_SYMBOL_GPL(edma_pcm_platform_register);
0060
0061 MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>");
0062 MODULE_DESCRIPTION("eDMA PCM ASoC platform driver");
0063 MODULE_LICENSE("GPL");