Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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