blob: 9a19e8a70c5f54a9456f98cba2947c329f0e2f94 [file] [log] [blame]
Jon Smirl89dd0842009-05-23 19:12:59 -04001/*
2 * Freescale MPC5200 Audio DMA driver
3 */
4
5#ifndef __SOUND_SOC_FSL_MPC5200_DMA_H__
6#define __SOUND_SOC_FSL_MPC5200_DMA_H__
7
8/**
9 * psc_i2s_stream - Data specific to a single stream (playback or capture)
10 * @active: flag indicating if the stream is active
11 * @psc_i2s: pointer back to parent psc_i2s data structure
12 * @bcom_task: bestcomm task structure
13 * @irq: irq number for bestcomm task
14 * @period_start: physical address of start of DMA region
15 * @period_end: physical address of end of DMA region
16 * @period_next_pt: physical address of next DMA buffer to enqueue
17 * @period_bytes: size of DMA period in bytes
18 */
19struct psc_i2s_stream {
20 int active;
21 struct psc_i2s *psc_i2s;
22 struct bcom_task *bcom_task;
23 int irq;
24 struct snd_pcm_substream *stream;
25 dma_addr_t period_start;
26 dma_addr_t period_end;
27 dma_addr_t period_next_pt;
28 dma_addr_t period_current_pt;
29 int period_bytes;
30};
31
32/**
33 * psc_i2s - Private driver data
34 * @name: short name for this device ("PSC0", "PSC1", etc)
35 * @psc_regs: pointer to the PSC's registers
36 * @fifo_regs: pointer to the PSC's FIFO registers
37 * @irq: IRQ of this PSC
38 * @dev: struct device pointer
39 * @dai: the CPU DAI for this device
40 * @sicr: Base value used in serial interface control register; mode is ORed
41 * with this value.
42 * @playback: Playback stream context data
43 * @capture: Capture stream context data
44 */
45struct psc_i2s {
46 char name[32];
47 struct mpc52xx_psc __iomem *psc_regs;
48 struct mpc52xx_psc_fifo __iomem *fifo_regs;
49 unsigned int irq;
50 struct device *dev;
51 struct snd_soc_dai dai;
52 spinlock_t lock;
53 u32 sicr;
54
55 /* per-stream data */
56 struct psc_i2s_stream playback;
57 struct psc_i2s_stream capture;
58
59 /* Statistics */
60 struct {
61 int overrun_count;
62 int underrun_count;
63 } stats;
64};
65
66
67int psc_i2s_startup(struct snd_pcm_substream *substream,
68 struct snd_soc_dai *dai);
69
70int psc_i2s_hw_free(struct snd_pcm_substream *substream,
71 struct snd_soc_dai *dai);
72
73void psc_i2s_shutdown(struct snd_pcm_substream *substream,
74 struct snd_soc_dai *dai);
75
76int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
77 struct snd_soc_dai *dai);
78
79extern struct snd_soc_platform psc_i2s_pcm_soc_platform;
80
81#endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */