blob: c9bd8542cd3f8764b149fa0a092133f218c79c9b [file] [log] [blame]
/*
* Copyright (C) 2013 Marvell International Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/device.h>
#include <linux/init.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/dmaengine_pcm.h>
#include <linux/dma/pxa-dma.h>
static const struct snd_pcm_hardware pxa_pcm_hardware = {
.info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE |
SNDRV_PCM_INFO_RESUME,
.formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.period_bytes_min = 32,
.period_bytes_max = 8192 - 32,
.periods_min = 1,
.periods_max = 256, //PAGE_SIZE/sizeof(pxa_dma_desc),
.buffer_bytes_max = 128 * 1024,
.fifo_size = 32,
};
static const struct snd_dmaengine_pcm_config pxa_dmaengine_pcm_config = {
.pcm_hardware = &pxa_pcm_hardware,
.prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
.prealloc_buffer_size = 128 * 1024,
};
int pxa_pcm_platform_register(struct device *dev)
{
return snd_dmaengine_pcm_register(dev, &pxa_dmaengine_pcm_config, 0);
}
EXPORT_SYMBOL_GPL(pxa_pcm_platform_register);
void pxa_pcm_platform_unregister(struct device *dev)
{
snd_dmaengine_pcm_unregister(dev);
}
EXPORT_SYMBOL_GPL(pxa_pcm_platform_unregister);
MODULE_LICENSE("GPL");