2009-05-24 07:12:59 +08:00
|
|
|
/*
|
|
|
|
* Freescale MPC5200 Audio DMA driver
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SOUND_SOC_FSL_MPC5200_DMA_H__
|
|
|
|
#define __SOUND_SOC_FSL_MPC5200_DMA_H__
|
|
|
|
|
2009-05-26 20:34:08 +08:00
|
|
|
#define PSC_STREAM_NAME_LEN 32
|
|
|
|
|
2009-05-24 07:12:59 +08:00
|
|
|
/**
|
2009-05-26 20:34:08 +08:00
|
|
|
* psc_ac97_stream - Data specific to a single stream (playback or capture)
|
2009-05-24 07:12:59 +08:00
|
|
|
* @active: flag indicating if the stream is active
|
2009-05-24 07:13:01 +08:00
|
|
|
* @psc_dma: pointer back to parent psc_dma data structure
|
2009-05-24 07:12:59 +08:00
|
|
|
* @bcom_task: bestcomm task structure
|
|
|
|
* @irq: irq number for bestcomm task
|
|
|
|
* @period_end: physical address of end of DMA region
|
|
|
|
* @period_next_pt: physical address of next DMA buffer to enqueue
|
|
|
|
* @period_bytes: size of DMA period in bytes
|
2009-11-07 16:34:43 +08:00
|
|
|
* @ac97_slot_bits: Enable bits for turning on the correct AC97 slot
|
2009-05-24 07:12:59 +08:00
|
|
|
*/
|
2009-05-24 07:13:01 +08:00
|
|
|
struct psc_dma_stream {
|
2009-05-26 20:34:08 +08:00
|
|
|
struct snd_pcm_runtime *runtime;
|
2009-05-24 07:12:59 +08:00
|
|
|
int active;
|
2009-05-24 07:13:01 +08:00
|
|
|
struct psc_dma *psc_dma;
|
2009-05-24 07:12:59 +08:00
|
|
|
struct bcom_task *bcom_task;
|
|
|
|
int irq;
|
|
|
|
struct snd_pcm_substream *stream;
|
2009-11-07 16:33:53 +08:00
|
|
|
int period_next;
|
|
|
|
int period_current;
|
2009-05-24 07:12:59 +08:00
|
|
|
int period_bytes;
|
2009-11-07 16:34:18 +08:00
|
|
|
int period_count;
|
2009-11-07 16:34:43 +08:00
|
|
|
|
|
|
|
/* AC97 state */
|
|
|
|
u32 ac97_slot_bits;
|
2009-05-24 07:12:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2009-05-24 07:13:01 +08:00
|
|
|
* psc_dma - Private driver data
|
2009-05-24 07:12:59 +08:00
|
|
|
* @name: short name for this device ("PSC0", "PSC1", etc)
|
|
|
|
* @psc_regs: pointer to the PSC's registers
|
|
|
|
* @fifo_regs: pointer to the PSC's FIFO registers
|
|
|
|
* @irq: IRQ of this PSC
|
|
|
|
* @dev: struct device pointer
|
|
|
|
* @dai: the CPU DAI for this device
|
|
|
|
* @sicr: Base value used in serial interface control register; mode is ORed
|
|
|
|
* with this value.
|
|
|
|
* @playback: Playback stream context data
|
|
|
|
* @capture: Capture stream context data
|
|
|
|
*/
|
2009-05-24 07:13:01 +08:00
|
|
|
struct psc_dma {
|
2009-05-24 07:12:59 +08:00
|
|
|
char name[32];
|
|
|
|
struct mpc52xx_psc __iomem *psc_regs;
|
|
|
|
struct mpc52xx_psc_fifo __iomem *fifo_regs;
|
|
|
|
unsigned int irq;
|
|
|
|
struct device *dev;
|
|
|
|
spinlock_t lock;
|
2009-07-03 01:57:25 +08:00
|
|
|
struct mutex mutex;
|
2009-05-24 07:12:59 +08:00
|
|
|
u32 sicr;
|
2009-05-26 20:34:08 +08:00
|
|
|
uint sysclk;
|
|
|
|
int imr;
|
|
|
|
int id;
|
|
|
|
unsigned int slots;
|
2009-05-24 07:12:59 +08:00
|
|
|
|
|
|
|
/* per-stream data */
|
2009-05-24 07:13:01 +08:00
|
|
|
struct psc_dma_stream playback;
|
|
|
|
struct psc_dma_stream capture;
|
2009-05-24 07:12:59 +08:00
|
|
|
|
|
|
|
/* Statistics */
|
|
|
|
struct {
|
2009-05-26 20:34:08 +08:00
|
|
|
unsigned long overrun_count;
|
|
|
|
unsigned long underrun_count;
|
2009-05-24 07:12:59 +08:00
|
|
|
} stats;
|
|
|
|
};
|
|
|
|
|
2009-11-07 16:34:31 +08:00
|
|
|
/* Utility for retrieving psc_dma_stream structure from a substream */
|
2010-06-14 14:03:34 +08:00
|
|
|
static inline struct psc_dma_stream *
|
2009-11-07 16:34:31 +08:00
|
|
|
to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma)
|
|
|
|
{
|
|
|
|
if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
|
|
|
|
return &psc_dma->capture;
|
|
|
|
return &psc_dma->playback;
|
|
|
|
}
|
|
|
|
|
2012-09-14 05:43:11 +08:00
|
|
|
int mpc5200_audio_dma_create(struct platform_device *op);
|
|
|
|
int mpc5200_audio_dma_destroy(struct platform_device *op);
|
|
|
|
|
2009-05-24 07:12:59 +08:00
|
|
|
#endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */
|