2019-06-04 15:11:33 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2010-06-04 12:11:24 +07:00
|
|
|
/*
|
|
|
|
* linux/sound/arm/ep93xx-pcm.c - EP93xx ALSA PCM interface
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
|
|
|
|
* Copyright (C) 2006 Applied Data Systems
|
|
|
|
*
|
|
|
|
* Rewritten for the SoC audio subsystem (Based on PXA2xx code):
|
2011-06-15 11:45:36 +07:00
|
|
|
* Copyright (c) 2008 Ryan Mallon
|
2010-06-04 12:11:24 +07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
2013-04-21 00:29:05 +07:00
|
|
|
#include <linux/platform_device.h>
|
2011-05-29 17:10:04 +07:00
|
|
|
#include <linux/dmaengine.h>
|
2010-06-04 12:11:24 +07:00
|
|
|
|
|
|
|
#include <sound/pcm.h>
|
|
|
|
#include <sound/soc.h>
|
2012-03-05 20:02:15 +07:00
|
|
|
#include <sound/dmaengine_pcm.h>
|
2010-06-04 12:11:24 +07:00
|
|
|
|
2012-08-24 20:12:11 +07:00
|
|
|
#include <linux/platform_data/dma-ep93xx.h>
|
2010-06-04 12:11:24 +07:00
|
|
|
|
2013-12-11 02:34:45 +07:00
|
|
|
#include "ep93xx-pcm.h"
|
|
|
|
|
2010-06-04 12:11:24 +07:00
|
|
|
static const struct snd_pcm_hardware ep93xx_pcm_hardware = {
|
|
|
|
.info = (SNDRV_PCM_INFO_MMAP |
|
|
|
|
SNDRV_PCM_INFO_MMAP_VALID |
|
|
|
|
SNDRV_PCM_INFO_INTERLEAVED |
|
|
|
|
SNDRV_PCM_INFO_BLOCK_TRANSFER),
|
|
|
|
.buffer_bytes_max = 131072,
|
|
|
|
.period_bytes_min = 32,
|
|
|
|
.period_bytes_max = 32768,
|
|
|
|
.periods_min = 1,
|
|
|
|
.periods_max = 32,
|
|
|
|
.fifo_size = 32,
|
|
|
|
};
|
|
|
|
|
2011-05-29 17:10:04 +07:00
|
|
|
static bool ep93xx_pcm_dma_filter(struct dma_chan *chan, void *filter_param)
|
2010-06-04 12:11:24 +07:00
|
|
|
{
|
2011-05-29 17:10:04 +07:00
|
|
|
struct ep93xx_dma_data *data = filter_param;
|
2010-06-04 12:11:24 +07:00
|
|
|
|
2011-05-29 17:10:04 +07:00
|
|
|
if (data->direction == ep93xx_dma_chan_direction(chan)) {
|
|
|
|
chan->private = data;
|
|
|
|
return true;
|
2010-06-04 12:11:24 +07:00
|
|
|
}
|
2011-05-29 17:10:04 +07:00
|
|
|
|
|
|
|
return false;
|
2010-06-04 12:11:24 +07:00
|
|
|
}
|
|
|
|
|
2013-04-21 00:29:05 +07:00
|
|
|
static const struct snd_dmaengine_pcm_config ep93xx_dmaengine_pcm_config = {
|
|
|
|
.pcm_hardware = &ep93xx_pcm_hardware,
|
|
|
|
.compat_filter_fn = ep93xx_pcm_dma_filter,
|
|
|
|
.prealloc_buffer_size = 131072,
|
2010-06-04 12:11:24 +07:00
|
|
|
};
|
2010-03-18 03:15:21 +07:00
|
|
|
|
2013-12-11 02:34:45 +07:00
|
|
|
int devm_ep93xx_pcm_platform_register(struct device *dev)
|
2010-03-18 03:15:21 +07:00
|
|
|
{
|
2013-12-11 02:34:45 +07:00
|
|
|
return devm_snd_dmaengine_pcm_register(dev,
|
2013-04-21 00:29:05 +07:00
|
|
|
&ep93xx_dmaengine_pcm_config,
|
|
|
|
SND_DMAENGINE_PCM_FLAG_NO_DT |
|
|
|
|
SND_DMAENGINE_PCM_FLAG_COMPAT);
|
2010-03-18 03:15:21 +07:00
|
|
|
}
|
2013-12-11 02:34:45 +07:00
|
|
|
EXPORT_SYMBOL_GPL(devm_ep93xx_pcm_platform_register);
|
2010-06-04 12:11:24 +07:00
|
|
|
|
2011-06-15 11:45:36 +07:00
|
|
|
MODULE_AUTHOR("Ryan Mallon");
|
2010-06-04 12:11:24 +07:00
|
|
|
MODULE_DESCRIPTION("EP93xx ALSA PCM interface");
|
|
|
|
MODULE_LICENSE("GPL");
|