1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  *  Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com
4  *  Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
5  */
6 
7 #include <linux/module.h>
8 #include <sound/core.h>
9 #include <sound/pcm.h>
10 #include <sound/pcm_params.h>
11 #include <sound/soc.h>
12 #include <sound/dmaengine_pcm.h>
13 
14 #include "udma-pcm.h"
15 
16 static const struct snd_pcm_hardware udma_pcm_hardware = {
17 	.info			= SNDRV_PCM_INFO_MMAP |
18 				  SNDRV_PCM_INFO_MMAP_VALID |
19 				  SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME |
20 				  SNDRV_PCM_INFO_NO_PERIOD_WAKEUP |
21 				  SNDRV_PCM_INFO_INTERLEAVED,
22 	.buffer_bytes_max	= SIZE_MAX,
23 	.period_bytes_min	= 32,
24 	.period_bytes_max	= SZ_64K,
25 	.periods_min		= 2,
26 	.periods_max		= UINT_MAX,
27 };
28 
29 static const struct snd_dmaengine_pcm_config udma_dmaengine_pcm_config = {
30 	.pcm_hardware = &udma_pcm_hardware,
31 	.prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
32 };
33 
udma_pcm_platform_register(struct device * dev)34 int udma_pcm_platform_register(struct device *dev)
35 {
36 	return devm_snd_dmaengine_pcm_register(dev, &udma_dmaengine_pcm_config,
37 					       0);
38 }
39 EXPORT_SYMBOL_GPL(udma_pcm_platform_register);
40 
41 MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>");
42 MODULE_DESCRIPTION("UDMA PCM ASoC platform driver");
43 MODULE_LICENSE("GPL v2");
44