ASoC: Basic split of mpc5200 DMA code out of mpc5200_psc_i2s
[safe/jmp/linux-2.6] / sound / soc / fsl / mpc5200_dma.h
1 /*
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  */
19 struct 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  */
45 struct 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
67 int psc_i2s_startup(struct snd_pcm_substream *substream,
68                            struct snd_soc_dai *dai);
69
70 int psc_i2s_hw_free(struct snd_pcm_substream *substream,
71                            struct snd_soc_dai *dai);
72
73 void psc_i2s_shutdown(struct snd_pcm_substream *substream,
74                              struct snd_soc_dai *dai);
75
76 int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
77                            struct snd_soc_dai *dai);
78
79 extern struct snd_soc_platform psc_i2s_pcm_soc_platform;
80
81 #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */