linux/sound/soc/fsl/mpc5200_dma.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/*
   3 * Freescale MPC5200 Audio DMA driver
   4 */
   5
   6#ifndef __SOUND_SOC_FSL_MPC5200_DMA_H__
   7#define __SOUND_SOC_FSL_MPC5200_DMA_H__
   8
   9#define PSC_STREAM_NAME_LEN 32
  10
  11/**
  12 * psc_ac97_stream - Data specific to a single stream (playback or capture)
  13 * @active:             flag indicating if the stream is active
  14 * @psc_dma:            pointer back to parent psc_dma data structure
  15 * @bcom_task:          bestcomm task structure
  16 * @irq:                irq number for bestcomm task
  17 * @period_end:         physical address of end of DMA region
  18 * @period_next_pt:     physical address of next DMA buffer to enqueue
  19 * @period_bytes:       size of DMA period in bytes
  20 * @ac97_slot_bits:     Enable bits for turning on the correct AC97 slot
  21 */
  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 data
  40 * @name: short name for this device ("PSC0", "PSC1", etc)
  41 * @psc_regs: pointer to the PSC's registers
  42 * @fifo_regs: pointer to the PSC's FIFO registers
  43 * @irq: IRQ of this PSC
  44 * @dev: struct device pointer
  45 * @dai: the CPU DAI for this device
  46 * @sicr: Base value used in serial interface control register; mode is ORed
  47 *        with this value.
  48 * @playback: Playback stream context data
  49 * @capture: Capture stream context data
  50 */
  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