brintos

brintos / linux-shallow public Read only

0
0
Text · 2.4 KiB · d7ee33b Raw
89 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2/*3 * Freescale MPC5200 Audio DMA driver4 */5 6#ifndef __SOUND_SOC_FSL_MPC5200_DMA_H__7#define __SOUND_SOC_FSL_MPC5200_DMA_H__8 9#define PSC_STREAM_NAME_LEN 3210 11/**12 * psc_ac97_stream - Data specific to a single stream (playback or capture)13 * @active:		flag indicating if the stream is active14 * @psc_dma:		pointer back to parent psc_dma data structure15 * @bcom_task:		bestcomm task structure16 * @irq:		irq number for bestcomm task17 * @period_end:		physical address of end of DMA region18 * @period_next_pt:	physical address of next DMA buffer to enqueue19 * @period_bytes:	size of DMA period in bytes20 * @ac97_slot_bits:	Enable bits for turning on the correct AC97 slot21 */22struct psc_dma_stream {23	struct snd_pcm_runtime *runtime;24	int active;25	struct psc_dma *psc_dma;26	struct bcom_task *bcom_task;27	int irq;28	struct snd_pcm_substream *stream;29	int period_next;30	int period_current;31	int period_bytes;32	int period_count;33 34	/* AC97 state */35	u32 ac97_slot_bits;36};37 38/**39 * psc_dma - Private driver data40 * @name: short name for this device ("PSC0", "PSC1", etc)41 * @psc_regs: pointer to the PSC's registers42 * @fifo_regs: pointer to the PSC's FIFO registers43 * @irq: IRQ of this PSC44 * @dev: struct device pointer45 * @dai: the CPU DAI for this device46 * @sicr: Base value used in serial interface control register; mode is ORed47 *        with this value.48 * @playback: Playback stream context data49 * @capture: Capture stream context data50 */51struct psc_dma {52	char name[32];53	struct mpc52xx_psc __iomem *psc_regs;54	struct mpc52xx_psc_fifo __iomem *fifo_regs;55	unsigned int irq;56	struct device *dev;57	spinlock_t lock;58	struct mutex mutex;59	u32 sicr;60	uint sysclk;61	int imr;62	int id;63	unsigned int slots;64 65	/* per-stream data */66	struct psc_dma_stream playback;67	struct psc_dma_stream capture;68 69	/* Statistics */70	struct {71		unsigned long overrun_count;72		unsigned long underrun_count;73	} stats;74};75 76/* Utility for retrieving psc_dma_stream structure from a substream */77static inline struct psc_dma_stream *78to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma)79{80	if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)81		return &psc_dma->capture;82	return &psc_dma->playback;83}84 85int mpc5200_audio_dma_create(struct platform_device *op);86int mpc5200_audio_dma_destroy(struct platform_device *op);87 88#endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */89