Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 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 | /** |
Jon Smirl | cebe776 | 2009-05-23 19:13:01 -0400 | [diff] [blame^] | 9 | * psc_dma_stream - Data specific to a single stream (playback or capture) |
Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 10 | * @active: flag indicating if the stream is active |
Jon Smirl | cebe776 | 2009-05-23 19:13:01 -0400 | [diff] [blame^] | 11 | * @psc_dma: pointer back to parent psc_dma data structure |
Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 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 | */ |
Jon Smirl | cebe776 | 2009-05-23 19:13:01 -0400 | [diff] [blame^] | 19 | struct psc_dma_stream { |
Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 20 | int active; |
Jon Smirl | cebe776 | 2009-05-23 19:13:01 -0400 | [diff] [blame^] | 21 | struct psc_dma *psc_dma; |
Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 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 | /** |
Jon Smirl | cebe776 | 2009-05-23 19:13:01 -0400 | [diff] [blame^] | 33 | * psc_dma - Private driver data |
Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 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 | */ |
Jon Smirl | cebe776 | 2009-05-23 19:13:01 -0400 | [diff] [blame^] | 45 | struct psc_dma { |
Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 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 */ |
Jon Smirl | cebe776 | 2009-05-23 19:13:01 -0400 | [diff] [blame^] | 56 | struct psc_dma_stream playback; |
| 57 | struct psc_dma_stream capture; |
Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 58 | |
| 59 | /* Statistics */ |
| 60 | struct { |
| 61 | int overrun_count; |
| 62 | int underrun_count; |
| 63 | } stats; |
| 64 | }; |
| 65 | |
| 66 | |
Jon Smirl | cebe776 | 2009-05-23 19:13:01 -0400 | [diff] [blame^] | 67 | int psc_dma_startup(struct snd_pcm_substream *substream, |
Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 68 | struct snd_soc_dai *dai); |
| 69 | |
Jon Smirl | cebe776 | 2009-05-23 19:13:01 -0400 | [diff] [blame^] | 70 | int psc_dma_hw_free(struct snd_pcm_substream *substream, |
Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 71 | struct snd_soc_dai *dai); |
| 72 | |
Jon Smirl | cebe776 | 2009-05-23 19:13:01 -0400 | [diff] [blame^] | 73 | void psc_dma_shutdown(struct snd_pcm_substream *substream, |
Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 74 | struct snd_soc_dai *dai); |
| 75 | |
Jon Smirl | cebe776 | 2009-05-23 19:13:01 -0400 | [diff] [blame^] | 76 | int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd, |
Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 77 | struct snd_soc_dai *dai); |
| 78 | |
Jon Smirl | cebe776 | 2009-05-23 19:13:01 -0400 | [diff] [blame^] | 79 | extern struct snd_soc_platform psc_dma_pcm_soc_platform; |
Jon Smirl | 89dd084 | 2009-05-23 19:12:59 -0400 | [diff] [blame] | 80 | |
| 81 | #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */ |