Merge tag 'for-linus-5.13-ofs-1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / sound / soc / fsl / imx-pcm.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de>
4  *
5  * This code is based on code copyrighted by Freescale,
6  * Liam Girdwood, Javier Martin and probably others.
7  */
8
9 #ifndef _IMX_PCM_H
10 #define _IMX_PCM_H
11
12 #include <linux/platform_data/dma-imx.h>
13
14 /*
15  * Do not change this as the FIQ handler depends on this size
16  */
17 #define IMX_SSI_DMABUF_SIZE     (64 * 1024)
18
19 #define IMX_DEFAULT_DMABUF_SIZE (64 * 1024)
20 #define IMX_SAI_DMABUF_SIZE     (64 * 1024)
21 #define IMX_SPDIF_DMABUF_SIZE   (64 * 1024)
22 #define IMX_ESAI_DMABUF_SIZE    (256 * 1024)
23
24 static inline void
25 imx_pcm_dma_params_init_data(struct imx_dma_data *dma_data,
26         int dma, enum sdma_peripheral_type peripheral_type)
27 {
28         dma_data->dma_request = dma;
29         dma_data->priority = DMA_PRIO_HIGH;
30         dma_data->peripheral_type = peripheral_type;
31 }
32
33 struct imx_pcm_fiq_params {
34         int irq;
35         void __iomem *base;
36
37         /* Pointer to original ssi driver to setup tx rx sizes */
38         struct snd_dmaengine_dai_dma_data *dma_params_rx;
39         struct snd_dmaengine_dai_dma_data *dma_params_tx;
40 };
41
42 #if IS_ENABLED(CONFIG_SND_SOC_IMX_PCM_DMA)
43 int imx_pcm_dma_init(struct platform_device *pdev, size_t size);
44 #else
45 static inline int imx_pcm_dma_init(struct platform_device *pdev, size_t size)
46 {
47         return -ENODEV;
48 }
49 #endif
50
51 #if IS_ENABLED(CONFIG_SND_SOC_IMX_PCM_FIQ)
52 int imx_pcm_fiq_init(struct platform_device *pdev,
53                 struct imx_pcm_fiq_params *params);
54 void imx_pcm_fiq_exit(struct platform_device *pdev);
55 #else
56 static inline int imx_pcm_fiq_init(struct platform_device *pdev,
57                 struct imx_pcm_fiq_params *params)
58 {
59         return -ENODEV;
60 }
61
62 static inline void imx_pcm_fiq_exit(struct platform_device *pdev)
63 {
64 }
65 #endif
66
67 #endif /* _IMX_PCM_H */