1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Freescale MPC5200 Audio DMA driver
6 #ifndef __SOUND_SOC_FSL_MPC5200_DMA_H__
7 #define __SOUND_SOC_FSL_MPC5200_DMA_H__
9 #define PSC_STREAM_NAME_LEN 32
12 * psc_ac97_stream - Data specific to a single stream (playback or capture)
13 * @active: flag indicating if the stream is active
14 * @psc_dma: pointer back to parent psc_dma data structure
15 * @bcom_task: bestcomm task structure
16 * @irq: irq number for bestcomm task
17 * @period_end: physical address of end of DMA region
18 * @period_next_pt: physical address of next DMA buffer to enqueue
19 * @period_bytes: size of DMA period in bytes
20 * @ac97_slot_bits: Enable bits for turning on the correct AC97 slot
22 struct psc_dma_stream {
23 struct snd_pcm_runtime *runtime;
25 struct psc_dma *psc_dma;
26 struct bcom_task *bcom_task;
28 struct snd_pcm_substream *stream;
39 * psc_dma - Private driver data
40 * @name: short name for this device ("PSC0", "PSC1", etc)
41 * @psc_regs: pointer to the PSC's registers
42 * @fifo_regs: pointer to the PSC's FIFO registers
43 * @irq: IRQ of this PSC
44 * @dev: struct device pointer
45 * @dai: the CPU DAI for this device
46 * @sicr: Base value used in serial interface control register; mode is ORed
48 * @playback: Playback stream context data
49 * @capture: Capture stream context data
53 struct mpc52xx_psc __iomem *psc_regs;
54 struct mpc52xx_psc_fifo __iomem *fifo_regs;
66 struct psc_dma_stream playback;
67 struct psc_dma_stream capture;
71 unsigned long overrun_count;
72 unsigned long underrun_count;
76 /* Utility for retrieving psc_dma_stream structure from a substream */
77 static inline struct psc_dma_stream *
78 to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma)
80 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
81 return &psc_dma->capture;
82 return &psc_dma->playback;
85 int mpc5200_audio_dma_create(struct platform_device *op);
86 int mpc5200_audio_dma_destroy(struct platform_device *op);
88 #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */