2012-06-21 15:54:52 +05:30
/*
* ALSA PCM interface for ST SPEAr Processors
*
* sound / soc / spear / spear_pcm . c
*
* Copyright ( C ) 2012 ST Microelectronics
2014-09-09 12:27:19 +05:30
* Rajeev Kumar < rajeevkumar . linux @ gmail . com >
2012-06-21 15:54:52 +05:30
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed " as is " without any
* warranty of any kind , whether express or implied .
*/
# include <linux/module.h>
# include <linux/dmaengine.h>
# include <linux/platform_device.h>
# include <sound/dmaengine_pcm.h>
# include <sound/pcm.h>
# include <sound/soc.h>
# include <sound/spear_dma.h>
2013-12-10 12:35:24 -07:00
# include "spear_pcm.h"
2012-06-21 15:54:52 +05:30
2013-04-20 19:29:07 +02:00
static const struct snd_pcm_hardware spear_pcm_hardware = {
2012-06-21 15:54:52 +05:30
. info = ( SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME ) ,
. buffer_bytes_max = 16 * 1024 , /* max buffer size */
. period_bytes_min = 2 * 1024 , /* 1 msec data minimum period size */
. period_bytes_max = 2 * 1024 , /* maximum period size */
. periods_min = 1 , /* min # periods */
. periods_max = 8 , /* max # of periods */
. fifo_size = 0 , /* fifo size in bytes */
} ;
2013-04-20 19:29:07 +02:00
static const struct snd_dmaengine_pcm_config spear_dmaengine_pcm_config = {
. pcm_hardware = & spear_pcm_hardware ,
. prealloc_buffer_size = 16 * 1024 ,
2012-06-21 15:54:52 +05:30
} ;
2013-12-10 12:35:25 -07:00
int devm_spear_pcm_platform_register ( struct device * dev ,
struct snd_dmaengine_pcm_config * config ,
bool ( * filter ) ( struct dma_chan * chan , void * slave ) )
2012-06-21 15:54:52 +05:30
{
2013-12-10 12:35:25 -07:00
* config = spear_dmaengine_pcm_config ;
config - > compat_filter_fn = filter ;
2015-08-30 08:08:15 +08:00
return devm_snd_dmaengine_pcm_register ( dev , config ,
2013-04-20 19:29:07 +02:00
SND_DMAENGINE_PCM_FLAG_NO_DT |
SND_DMAENGINE_PCM_FLAG_COMPAT ) ;
2012-06-21 15:54:52 +05:30
}
2013-12-10 12:35:24 -07:00
EXPORT_SYMBOL_GPL ( devm_spear_pcm_platform_register ) ;
2012-06-21 15:54:52 +05:30
2014-09-09 12:27:19 +05:30
MODULE_AUTHOR ( " Rajeev Kumar <rajeevkumar.linux@gmail.com> " ) ;
2012-06-21 15:54:52 +05:30
MODULE_DESCRIPTION ( " SPEAr PCM DMA module " ) ;
MODULE_LICENSE ( " GPL " ) ;