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