1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 2 /* 3 * Freescale MPC5200 Audio DMA driver 3 * Freescale MPC5200 Audio DMA driver 4 */ 4 */ 5 5 6 #ifndef __SOUND_SOC_FSL_MPC5200_DMA_H__ 6 #ifndef __SOUND_SOC_FSL_MPC5200_DMA_H__ 7 #define __SOUND_SOC_FSL_MPC5200_DMA_H__ 7 #define __SOUND_SOC_FSL_MPC5200_DMA_H__ 8 8 9 #define PSC_STREAM_NAME_LEN 32 9 #define PSC_STREAM_NAME_LEN 32 10 10 11 /** 11 /** 12 * psc_ac97_stream - Data specific to a single 12 * psc_ac97_stream - Data specific to a single stream (playback or capture) 13 * @active: flag indicating if the 13 * @active: flag indicating if the stream is active 14 * @psc_dma: pointer back to parent 14 * @psc_dma: pointer back to parent psc_dma data structure 15 * @bcom_task: bestcomm task structur 15 * @bcom_task: bestcomm task structure 16 * @irq: irq number for bestcom 16 * @irq: irq number for bestcomm task 17 * @period_end: physical address of en 17 * @period_end: physical address of end of DMA region 18 * @period_next_pt: physical address of ne 18 * @period_next_pt: physical address of next DMA buffer to enqueue 19 * @period_bytes: size of DMA period in 19 * @period_bytes: size of DMA period in bytes 20 * @ac97_slot_bits: Enable bits for turnin 20 * @ac97_slot_bits: Enable bits for turning on the correct AC97 slot 21 */ 21 */ 22 struct psc_dma_stream { 22 struct psc_dma_stream { 23 struct snd_pcm_runtime *runtime; 23 struct snd_pcm_runtime *runtime; 24 int active; 24 int active; 25 struct psc_dma *psc_dma; 25 struct psc_dma *psc_dma; 26 struct bcom_task *bcom_task; 26 struct bcom_task *bcom_task; 27 int irq; 27 int irq; 28 struct snd_pcm_substream *stream; 28 struct snd_pcm_substream *stream; 29 int period_next; 29 int period_next; 30 int period_current; 30 int period_current; 31 int period_bytes; 31 int period_bytes; 32 int period_count; 32 int period_count; 33 33 34 /* AC97 state */ 34 /* AC97 state */ 35 u32 ac97_slot_bits; 35 u32 ac97_slot_bits; 36 }; 36 }; 37 37 38 /** 38 /** 39 * psc_dma - Private driver data 39 * psc_dma - Private driver data 40 * @name: short name for this device ("PSC0", 40 * @name: short name for this device ("PSC0", "PSC1", etc) 41 * @psc_regs: pointer to the PSC's registers 41 * @psc_regs: pointer to the PSC's registers 42 * @fifo_regs: pointer to the PSC's FIFO regis 42 * @fifo_regs: pointer to the PSC's FIFO registers 43 * @irq: IRQ of this PSC 43 * @irq: IRQ of this PSC 44 * @dev: struct device pointer 44 * @dev: struct device pointer 45 * @dai: the CPU DAI for this device 45 * @dai: the CPU DAI for this device 46 * @sicr: Base value used in serial interface 46 * @sicr: Base value used in serial interface control register; mode is ORed 47 * with this value. 47 * with this value. 48 * @playback: Playback stream context data 48 * @playback: Playback stream context data 49 * @capture: Capture stream context data 49 * @capture: Capture stream context data 50 */ 50 */ 51 struct psc_dma { 51 struct psc_dma { 52 char name[32]; 52 char name[32]; 53 struct mpc52xx_psc __iomem *psc_regs; 53 struct mpc52xx_psc __iomem *psc_regs; 54 struct mpc52xx_psc_fifo __iomem *fifo_ 54 struct mpc52xx_psc_fifo __iomem *fifo_regs; 55 unsigned int irq; 55 unsigned int irq; 56 struct device *dev; 56 struct device *dev; 57 spinlock_t lock; 57 spinlock_t lock; 58 struct mutex mutex; 58 struct mutex mutex; 59 u32 sicr; 59 u32 sicr; 60 uint sysclk; 60 uint sysclk; 61 int imr; 61 int imr; 62 int id; 62 int id; 63 unsigned int slots; 63 unsigned int slots; 64 64 65 /* per-stream data */ 65 /* per-stream data */ 66 struct psc_dma_stream playback; 66 struct psc_dma_stream playback; 67 struct psc_dma_stream capture; 67 struct psc_dma_stream capture; 68 68 69 /* Statistics */ 69 /* Statistics */ 70 struct { 70 struct { 71 unsigned long overrun_count; 71 unsigned long overrun_count; 72 unsigned long underrun_count; 72 unsigned long underrun_count; 73 } stats; 73 } stats; 74 }; 74 }; 75 75 76 /* Utility for retrieving psc_dma_stream struc 76 /* Utility for retrieving psc_dma_stream structure from a substream */ 77 static inline struct psc_dma_stream * 77 static inline struct psc_dma_stream * 78 to_psc_dma_stream(struct snd_pcm_substream *su 78 to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma) 79 { 79 { 80 if (substream->pstr->stream == SNDRV_P 80 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE) 81 return &psc_dma->capture; 81 return &psc_dma->capture; 82 return &psc_dma->playback; 82 return &psc_dma->playback; 83 } 83 } 84 84 85 int mpc5200_audio_dma_create(struct platform_d 85 int mpc5200_audio_dma_create(struct platform_device *op); 86 int mpc5200_audio_dma_destroy(struct platform_ 86 int mpc5200_audio_dma_destroy(struct platform_device *op); 87 87 88 #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */ 88 #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */ 89 89
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.