Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 //
0003 // dmaengine.c - Samsung dmaengine wrapper
0004 //
0005 // Author: Mark Brown <broonie@linaro.org>
0006 // Copyright 2013 Linaro
0007 
0008 #include <linux/module.h>
0009 #include <sound/core.h>
0010 #include <sound/pcm.h>
0011 #include <sound/pcm_params.h>
0012 #include <sound/dmaengine_pcm.h>
0013 #include <sound/soc.h>
0014 
0015 #include "dma.h"
0016 
0017 int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter,
0018                        const char *tx, const char *rx,
0019                        struct device *dma_dev)
0020 {
0021     struct snd_dmaengine_pcm_config *pcm_conf;
0022 
0023     pcm_conf = devm_kzalloc(dev, sizeof(*pcm_conf), GFP_KERNEL);
0024     if (!pcm_conf)
0025         return -ENOMEM;
0026 
0027     pcm_conf->prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;
0028     pcm_conf->compat_filter_fn = filter;
0029     pcm_conf->dma_dev = dma_dev;
0030 
0031     pcm_conf->chan_names[SNDRV_PCM_STREAM_PLAYBACK] = tx;
0032     pcm_conf->chan_names[SNDRV_PCM_STREAM_CAPTURE] = rx;
0033 
0034     return devm_snd_dmaengine_pcm_register(dev, pcm_conf,
0035                 SND_DMAENGINE_PCM_FLAG_COMPAT);
0036 }
0037 EXPORT_SYMBOL_GPL(samsung_asoc_dma_platform_register);
0038 
0039 MODULE_AUTHOR("Mark Brown <broonie@linaro.org>");
0040 MODULE_DESCRIPTION("Samsung dmaengine ASoC driver");
0041 MODULE_LICENSE("GPL");