diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-02-22 04:49:05 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-02-22 08:21:49 -0500 |
commit | 91a38540f504cdde7cb62668f7a6d52e3bd0178b (patch) | |
tree | de286920fe5f4e5387164a5652bb1f704d553e4e /sound/soc/imx | |
parent | f7085641eeaeaab5216bab143287d2288940d9a2 (diff) |
ASoC: imx-ssi: Set dma data early
Move the call to snd_soc_dai_set_dma_data from the hw_params callback to the
startup callback. This allows us to use the dma data in the pcm driver's open
callback.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/imx')
-rw-r--r-- | sound/soc/imx/imx-ssi.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c index 01d1f749cf02..dbf43f5f0aed 100644 --- a/sound/soc/imx/imx-ssi.c +++ b/sound/soc/imx/imx-ssi.c | |||
@@ -233,6 +233,23 @@ static int imx_ssi_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, | |||
233 | return 0; | 233 | return 0; |
234 | } | 234 | } |
235 | 235 | ||
236 | static int imx_ssi_startup(struct snd_pcm_substream *substream, | ||
237 | struct snd_soc_dai *cpu_dai) | ||
238 | { | ||
239 | struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai); | ||
240 | struct imx_pcm_dma_params *dma_data; | ||
241 | |||
242 | /* Tx/Rx config */ | ||
243 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
244 | dma_data = &ssi->dma_params_tx; | ||
245 | else | ||
246 | dma_data = &ssi->dma_params_rx; | ||
247 | |||
248 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); | ||
249 | |||
250 | return 0; | ||
251 | } | ||
252 | |||
236 | /* | 253 | /* |
237 | * Should only be called when port is inactive (i.e. SSIEN = 0), | 254 | * Should only be called when port is inactive (i.e. SSIEN = 0), |
238 | * although can be called multiple times by upper layers. | 255 | * although can be called multiple times by upper layers. |
@@ -242,23 +259,17 @@ static int imx_ssi_hw_params(struct snd_pcm_substream *substream, | |||
242 | struct snd_soc_dai *cpu_dai) | 259 | struct snd_soc_dai *cpu_dai) |
243 | { | 260 | { |
244 | struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai); | 261 | struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai); |
245 | struct imx_pcm_dma_params *dma_data; | ||
246 | u32 reg, sccr; | 262 | u32 reg, sccr; |
247 | 263 | ||
248 | /* Tx/Rx config */ | 264 | /* Tx/Rx config */ |
249 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 265 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
250 | reg = SSI_STCCR; | 266 | reg = SSI_STCCR; |
251 | dma_data = &ssi->dma_params_tx; | 267 | else |
252 | } else { | ||
253 | reg = SSI_SRCCR; | 268 | reg = SSI_SRCCR; |
254 | dma_data = &ssi->dma_params_rx; | ||
255 | } | ||
256 | 269 | ||
257 | if (ssi->flags & IMX_SSI_SYN) | 270 | if (ssi->flags & IMX_SSI_SYN) |
258 | reg = SSI_STCCR; | 271 | reg = SSI_STCCR; |
259 | 272 | ||
260 | snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); | ||
261 | |||
262 | sccr = readl(ssi->base + reg) & ~SSI_STCCR_WL_MASK; | 273 | sccr = readl(ssi->base + reg) & ~SSI_STCCR_WL_MASK; |
263 | 274 | ||
264 | /* DAI data (word) size */ | 275 | /* DAI data (word) size */ |
@@ -343,6 +354,7 @@ static int imx_ssi_trigger(struct snd_pcm_substream *substream, int cmd, | |||
343 | } | 354 | } |
344 | 355 | ||
345 | static const struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = { | 356 | static const struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = { |
357 | .startup = imx_ssi_startup, | ||
346 | .hw_params = imx_ssi_hw_params, | 358 | .hw_params = imx_ssi_hw_params, |
347 | .set_fmt = imx_ssi_set_dai_fmt, | 359 | .set_fmt = imx_ssi_set_dai_fmt, |
348 | .set_clkdiv = imx_ssi_set_dai_clkdiv, | 360 | .set_clkdiv = imx_ssi_set_dai_clkdiv, |