Commit | Line | Data |
---|---|---|
89dd0842 JS |
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 | ||
dbcc3475 JS |
8 | #define PSC_STREAM_NAME_LEN 32 |
9 | ||
89dd0842 | 10 | /** |
dbcc3475 | 11 | * psc_ac97_stream - Data specific to a single stream (playback or capture) |
89dd0842 | 12 | * @active: flag indicating if the stream is active |
cebe7767 | 13 | * @psc_dma: pointer back to parent psc_dma data structure |
89dd0842 JS |
14 | * @bcom_task: bestcomm task structure |
15 | * @irq: irq number for bestcomm task | |
89dd0842 JS |
16 | * @period_end: physical address of end of DMA region |
17 | * @period_next_pt: physical address of next DMA buffer to enqueue | |
18 | * @period_bytes: size of DMA period in bytes | |
c939e5c8 | 19 | * @ac97_slot_bits: Enable bits for turning on the correct AC97 slot |
89dd0842 | 20 | */ |
cebe7767 | 21 | struct psc_dma_stream { |
dbcc3475 | 22 | struct snd_pcm_runtime *runtime; |
89dd0842 | 23 | int active; |
cebe7767 | 24 | struct psc_dma *psc_dma; |
89dd0842 JS |
25 | struct bcom_task *bcom_task; |
26 | int irq; | |
27 | struct snd_pcm_substream *stream; | |
8f159d72 GL |
28 | int period_next; |
29 | int period_current; | |
89dd0842 | 30 | int period_bytes; |
c4878274 | 31 | int period_count; |
c939e5c8 GL |
32 | |
33 | /* AC97 state */ | |
34 | u32 ac97_slot_bits; | |
89dd0842 JS |
35 | }; |
36 | ||
37 | /** | |
cebe7767 | 38 | * psc_dma - Private driver data |
89dd0842 JS |
39 | * @name: short name for this device ("PSC0", "PSC1", etc) |
40 | * @psc_regs: pointer to the PSC's registers | |
41 | * @fifo_regs: pointer to the PSC's FIFO registers | |
42 | * @irq: IRQ of this PSC | |
43 | * @dev: struct device pointer | |
44 | * @dai: the CPU DAI for this device | |
45 | * @sicr: Base value used in serial interface control register; mode is ORed | |
46 | * with this value. | |
47 | * @playback: Playback stream context data | |
48 | * @capture: Capture stream context data | |
49 | */ | |
cebe7767 | 50 | struct psc_dma { |
89dd0842 JS |
51 | char name[32]; |
52 | struct mpc52xx_psc __iomem *psc_regs; | |
53 | struct mpc52xx_psc_fifo __iomem *fifo_regs; | |
54 | unsigned int irq; | |
55 | struct device *dev; | |
89dd0842 | 56 | spinlock_t lock; |
0827d6ba | 57 | struct mutex mutex; |
89dd0842 | 58 | u32 sicr; |
dbcc3475 JS |
59 | uint sysclk; |
60 | int imr; | |
61 | int id; | |
62 | unsigned int slots; | |
89dd0842 JS |
63 | |
64 | /* per-stream data */ | |
cebe7767 JS |
65 | struct psc_dma_stream playback; |
66 | struct psc_dma_stream capture; | |
89dd0842 JS |
67 | |
68 | /* Statistics */ | |
69 | struct { | |
dbcc3475 JS |
70 | unsigned long overrun_count; |
71 | unsigned long underrun_count; | |
89dd0842 JS |
72 | } stats; |
73 | }; | |
74 | ||
1d8222e8 | 75 | /* Utility for retrieving psc_dma_stream structure from a substream */ |
f487537c | 76 | static inline struct psc_dma_stream * |
1d8222e8 GL |
77 | to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma) |
78 | { | |
79 | if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) | |
80 | return &psc_dma->capture; | |
81 | return &psc_dma->playback; | |
82 | } | |
83 | ||
f515b673 EM |
84 | int mpc5200_audio_dma_create(struct platform_device *op); |
85 | int mpc5200_audio_dma_destroy(struct platform_device *op); | |
86 | ||
89dd0842 | 87 | #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */ |