1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * imx-pcm-dma-mx2.c -- ALSA Soc Audio Layer
5 * Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de>
7 * This code is based on code copyrighted by Freescale,
8 * Liam Girdwood, Javier Martin and probably others.
10 #include <linux/platform_device.h>
11 #include <linux/dmaengine.h>
12 #include <linux/types.h>
13 #include <linux/module.h>
15 #include <sound/core.h>
16 #include <sound/pcm.h>
17 #include <sound/soc.h>
18 #include <sound/dmaengine_pcm.h>
22 static bool filter(struct dma_chan
*chan
, void *param
)
24 if (!imx_dma_is_general_purpose(chan
))
27 chan
->private = param
;
32 static const struct snd_dmaengine_pcm_config imx_dmaengine_pcm_config
= {
33 .prepare_slave_config
= snd_dmaengine_pcm_prepare_slave_config
,
34 .compat_filter_fn
= filter
,
37 int imx_pcm_dma_init(struct platform_device
*pdev
, size_t size
)
39 struct snd_dmaengine_pcm_config
*config
;
41 config
= devm_kzalloc(&pdev
->dev
,
42 sizeof(struct snd_dmaengine_pcm_config
), GFP_KERNEL
);
45 *config
= imx_dmaengine_pcm_config
;
47 return devm_snd_dmaengine_pcm_register(&pdev
->dev
,
49 SND_DMAENGINE_PCM_FLAG_COMPAT
);
51 EXPORT_SYMBOL_GPL(imx_pcm_dma_init
);
53 MODULE_LICENSE("GPL");