ASoC: Main rewite of the mpc5200 audio DMA code

Rewrite the mpc5200 audio DMA code to support both I2S and AC97.

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Jon Smirl
2009-05-26 08:34:08 -04:00
committed by Mark Brown
parent 0f89bdcac6
commit dbcc347562
5 changed files with 341 additions and 388 deletions

View File

@@ -5,8 +5,10 @@
#ifndef __SOUND_SOC_FSL_MPC5200_DMA_H__
#define __SOUND_SOC_FSL_MPC5200_DMA_H__
#define PSC_STREAM_NAME_LEN 32
/**
* psc_dma_stream - Data specific to a single stream (playback or capture)
* psc_ac97_stream - Data specific to a single stream (playback or capture)
* @active: flag indicating if the stream is active
* @psc_dma: pointer back to parent psc_dma data structure
* @bcom_task: bestcomm task structure
@@ -17,6 +19,9 @@
* @period_bytes: size of DMA period in bytes
*/
struct psc_dma_stream {
struct snd_pcm_runtime *runtime;
snd_pcm_uframes_t appl_ptr;
int active;
struct psc_dma *psc_dma;
struct bcom_task *bcom_task;
@@ -27,6 +32,7 @@ struct psc_dma_stream {
dma_addr_t period_next_pt;
dma_addr_t period_current_pt;
int period_bytes;
int period_size;
};
/**
@@ -48,9 +54,12 @@ struct psc_dma {
struct mpc52xx_psc_fifo __iomem *fifo_regs;
unsigned int irq;
struct device *dev;
struct snd_soc_dai dai;
spinlock_t lock;
u32 sicr;
uint sysclk;
int imr;
int id;
unsigned int slots;
/* per-stream data */
struct psc_dma_stream playback;
@@ -58,24 +67,14 @@ struct psc_dma {
/* Statistics */
struct {
int overrun_count;
int underrun_count;
unsigned long overrun_count;
unsigned long underrun_count;
} stats;
};
int mpc5200_audio_dma_create(struct of_device *op);
int mpc5200_audio_dma_destroy(struct of_device *op);
int psc_dma_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai);
int psc_dma_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai);
void psc_dma_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai);
int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai);
extern struct snd_soc_platform psc_dma_pcm_soc_platform;
extern struct snd_soc_platform mpc5200_audio_dma_platform;
#endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */