Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dbcc3475 authored by Jon Smirl's avatar Jon Smirl Committed by Mark Brown
Browse files

ASoC: Main rewite of the mpc5200 audio DMA code



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

Signed-off-by: default avatarJon Smirl <jonsmirl@gmail.com>
Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 0f89bdca
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ config SND_SOC_MPC8610_HPCD
config SND_SOC_MPC5200_I2S
	tristate "Freescale MPC5200 PSC in I2S mode driver"
	depends on PPC_MPC52xx && PPC_BESTCOMM
	select SND_SOC_OF_SIMPLE
	select SND_MPC52xx_DMA
	select PPC_BESTCOMM_GEN_BD
	help
+274 −168

File changed.

Preview size limit exceeded, changes collapsed.

+16 −17
Original line number Diff line number Diff line
@@ -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__ */
+42 −205

File changed.

Preview size limit exceeded, changes collapsed.

+12 −0
Original line number Diff line number Diff line
/*
 * Freescale MPC5200 PSC in I2S mode
 * ALSA SoC Digital Audio Interface (DAI) driver
 *
 */

#ifndef __SOUND_SOC_FSL_MPC52xx_PSC_I2S_H__
#define __SOUND_SOC_FSL_MPC52xx_PSC_I2S_H__

extern struct snd_soc_dai psc_i2s_dai[];

#endif /* __SOUND_SOC_FSL_MPC52xx_PSC_I2S_H__ */