aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2009-11-07 03:34:31 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-11-07 07:40:09 -0500
commit1d8222e8df07ce4f86fb7fa80b02bdee03b57985 (patch)
tree5a82aa6b88862e0c08aa001876a5f4a1615388da /sound/soc/fsl
parentc4878274750ae0bb90c351a737ac6cdcb608e546 (diff)
ASoC/mpc5200: add to_psc_dma_stream() helper
Move the resolving of the psc_dma_stream pointer to a helper function to reduce duplicate code Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r--sound/soc/fsl/mpc5200_dma.c7
-rw-r--r--sound/soc/fsl/mpc5200_dma.h9
2 files changed, 10 insertions, 6 deletions
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index 658e3fa14663..9c88e15ce693 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -133,17 +133,12 @@ static int psc_dma_trigger(struct snd_pcm_substream *substream, int cmd)
133 struct snd_soc_pcm_runtime *rtd = substream->private_data; 133 struct snd_soc_pcm_runtime *rtd = substream->private_data;
134 struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data; 134 struct psc_dma *psc_dma = rtd->dai->cpu_dai->private_data;
135 struct snd_pcm_runtime *runtime = substream->runtime; 135 struct snd_pcm_runtime *runtime = substream->runtime;
136 struct psc_dma_stream *s; 136 struct psc_dma_stream *s = to_psc_dma_stream(substream, psc_dma);
137 struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs; 137 struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;
138 u16 imr; 138 u16 imr;
139 unsigned long flags; 139 unsigned long flags;
140 int i; 140 int i;
141 141
142 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
143 s = &psc_dma->capture;
144 else
145 s = &psc_dma->playback;
146
147 switch (cmd) { 142 switch (cmd) {
148 case SNDRV_PCM_TRIGGER_START: 143 case SNDRV_PCM_TRIGGER_START:
149 dev_dbg(psc_dma->dev, "START: stream=%i fbits=%u ps=%u #p=%u\n", 144 dev_dbg(psc_dma->dev, "START: stream=%i fbits=%u ps=%u #p=%u\n",
diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h
index c6f29e4d093c..956d6a5f5a8c 100644
--- a/sound/soc/fsl/mpc5200_dma.h
+++ b/sound/soc/fsl/mpc5200_dma.h
@@ -68,6 +68,15 @@ struct psc_dma {
68 } stats; 68 } stats;
69}; 69};
70 70
71/* Utility for retrieving psc_dma_stream structure from a substream */
72inline struct psc_dma_stream *
73to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma)
74{
75 if (substream->pstr->stream == SNDRV_PCM_STREAM_CAPTURE)
76 return &psc_dma->capture;
77 return &psc_dma->playback;
78}
79
71int mpc5200_audio_dma_create(struct of_device *op); 80int mpc5200_audio_dma_create(struct of_device *op);
72int mpc5200_audio_dma_destroy(struct of_device *op); 81int mpc5200_audio_dma_destroy(struct of_device *op);
73 82