ASoC: imx: Setup dma data in DAI probe
authorLars-Peter Clausen <lars@metafoo.de>
Mon, 15 Apr 2013 17:19:58 +0000 (19:19 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 17 Apr 2013 13:26:27 +0000 (14:26 +0100)
This allows us to access the DAI DMA data when we create the PCM. We'll use
this when converting imx to generic DMA engine PCM driver.

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>
sound/soc/fsl/fsl_ssi.c
sound/soc/fsl/imx-ssi.c

index 8a7eac4bf6518bbf3e0de78fd450b5407ac2f433..ab27ffab83f3627d5a4f2a9262c0770bd1b78e6f 100644 (file)
@@ -425,12 +425,6 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
                ssi_private->second_stream = substream;
        }
 
-       if (ssi_private->ssi_on_imx)
-               snd_soc_dai_set_dma_data(dai, substream,
-                       (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
-                               &ssi_private->dma_params_tx :
-                               &ssi_private->dma_params_rx);
-
        return 0;
 }
 
@@ -552,6 +546,18 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
        }
 }
 
+static int fsl_ssi_dai_probe(struct snd_soc_dai *dai)
+{
+       struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(dai);
+
+       if (ssi_private->ssi_on_imx) {
+               dai->playback_dma_data = &ssi_private->dma_params_tx;
+               dai->capture_dma_data = &ssi_private->dma_params_rx;
+       }
+
+       return 0;
+}
+
 static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
        .startup        = fsl_ssi_startup,
        .hw_params      = fsl_ssi_hw_params,
@@ -561,6 +567,7 @@ static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
 
 /* Template for the CPU dai driver structure */
 static struct snd_soc_dai_driver fsl_ssi_dai_template = {
+       .probe = fsl_ssi_dai_probe,
        .playback = {
                /* The SSI does not support monaural audio. */
                .channels_min = 2,
index 7c84eb123d76d58bdf2d4508087453892f0fe22d..9128b7b26ecfdd266222eaa3d6b7a957acc56e4b 100644 (file)
@@ -232,23 +232,6 @@ static int imx_ssi_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
        return 0;
 }
 
-static int imx_ssi_startup(struct snd_pcm_substream *substream,
-                          struct snd_soc_dai *cpu_dai)
-{
-       struct imx_ssi *ssi = snd_soc_dai_get_drvdata(cpu_dai);
-       struct snd_dmaengine_dai_dma_data *dma_data;
-
-       /* Tx/Rx config */
-       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-               dma_data = &ssi->dma_params_tx;
-       else
-               dma_data = &ssi->dma_params_rx;
-
-       snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data);
-
-       return 0;
-}
-
 /*
  * Should only be called when port is inactive (i.e. SSIEN = 0),
  * although can be called multiple times by upper layers.
@@ -353,7 +336,6 @@ static int imx_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
 }
 
 static const struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = {
-       .startup        = imx_ssi_startup,
        .hw_params      = imx_ssi_hw_params,
        .set_fmt        = imx_ssi_set_dai_fmt,
        .set_clkdiv     = imx_ssi_set_dai_clkdiv,
@@ -373,6 +355,10 @@ static int imx_ssi_dai_probe(struct snd_soc_dai *dai)
                SSI_SFCSR_RFWM0(ssi->dma_params_rx.maxburst);
        writel(val, ssi->base + SSI_SFCSR);
 
+       /* Tx/Rx config */
+       dai->playback_dma_data = &ssi->dma_params_tx;
+       dai->capture_dma_data = &ssi->dma_params_rx;
+
        return 0;
 }
 
This page took 0.028995 seconds and 5 git commands to generate.