1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun //
3*4882a593Smuzhiyun // dmaengine.c - Samsung dmaengine wrapper
4*4882a593Smuzhiyun //
5*4882a593Smuzhiyun // Author: Mark Brown <broonie@linaro.org>
6*4882a593Smuzhiyun // Copyright 2013 Linaro
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun #include <linux/module.h>
9*4882a593Smuzhiyun #include <sound/core.h>
10*4882a593Smuzhiyun #include <sound/pcm.h>
11*4882a593Smuzhiyun #include <sound/pcm_params.h>
12*4882a593Smuzhiyun #include <sound/dmaengine_pcm.h>
13*4882a593Smuzhiyun #include <sound/soc.h>
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun #include "dma.h"
16*4882a593Smuzhiyun
samsung_asoc_dma_platform_register(struct device * dev,dma_filter_fn filter,const char * tx,const char * rx,struct device * dma_dev)17*4882a593Smuzhiyun int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter,
18*4882a593Smuzhiyun const char *tx, const char *rx,
19*4882a593Smuzhiyun struct device *dma_dev)
20*4882a593Smuzhiyun {
21*4882a593Smuzhiyun struct snd_dmaengine_pcm_config *pcm_conf;
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun pcm_conf = devm_kzalloc(dev, sizeof(*pcm_conf), GFP_KERNEL);
24*4882a593Smuzhiyun if (!pcm_conf)
25*4882a593Smuzhiyun return -ENOMEM;
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun pcm_conf->prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;
28*4882a593Smuzhiyun pcm_conf->compat_filter_fn = filter;
29*4882a593Smuzhiyun pcm_conf->dma_dev = dma_dev;
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun pcm_conf->chan_names[SNDRV_PCM_STREAM_PLAYBACK] = tx;
32*4882a593Smuzhiyun pcm_conf->chan_names[SNDRV_PCM_STREAM_CAPTURE] = rx;
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun return devm_snd_dmaengine_pcm_register(dev, pcm_conf,
35*4882a593Smuzhiyun SND_DMAENGINE_PCM_FLAG_COMPAT);
36*4882a593Smuzhiyun }
37*4882a593Smuzhiyun EXPORT_SYMBOL_GPL(samsung_asoc_dma_platform_register);
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun MODULE_AUTHOR("Mark Brown <broonie@linaro.org>");
40*4882a593Smuzhiyun MODULE_DESCRIPTION("Samsung dmaengine ASoC driver");
41*4882a593Smuzhiyun MODULE_LICENSE("GPL");
42