Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2)  * ALSA PCM interface for ST SPEAr Processors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * sound/soc/spear/spear_pcm.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright (C) 2012 ST Microelectronics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Rajeev Kumar<rajeevkumar.linux@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * This file is licensed under the terms of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  * License version 2. This program is licensed "as is" without any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  * warranty of any kind, whether express or implied.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/dmaengine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <sound/dmaengine_pcm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <sound/pcm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <sound/soc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <sound/spear_dma.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include "spear_pcm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) static const struct snd_pcm_hardware spear_pcm_hardware = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 		 SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 		 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	.buffer_bytes_max = 16 * 1024, /* max buffer size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	.period_bytes_min = 2 * 1024, /* 1 msec data minimum period size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	.period_bytes_max = 2 * 1024, /* maximum period size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	.periods_min = 1, /* min # periods */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	.periods_max = 8, /* max # of periods */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	.fifo_size = 0, /* fifo size in bytes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) static const struct snd_dmaengine_pcm_config spear_dmaengine_pcm_config = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	.pcm_hardware = &spear_pcm_hardware,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	.prealloc_buffer_size = 16 * 1024,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) int devm_spear_pcm_platform_register(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 			struct snd_dmaengine_pcm_config *config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 			bool (*filter)(struct dma_chan *chan, void *slave))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	*config = spear_dmaengine_pcm_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	config->compat_filter_fn = filter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	return devm_snd_dmaengine_pcm_register(dev, config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 		SND_DMAENGINE_PCM_FLAG_NO_DT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 		SND_DMAENGINE_PCM_FLAG_COMPAT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) EXPORT_SYMBOL_GPL(devm_spear_pcm_platform_register);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) MODULE_DESCRIPTION("SPEAr PCM DMA module");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) MODULE_LICENSE("GPL");