ASoC: spear: Setup dma data in DAI probe
authorLars-Peter Clausen <lars@metafoo.de>
Sat, 20 Apr 2013 17:29:06 +0000 (19:29 +0200)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 12 May 2013 16:58:03 +0000 (20:58 +0400)
This allows us to access the DAI DMA data when we create the PCM. We'll use
this when converting spear to generic DMA engine PCM driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/spear/spdif_in.c
sound/soc/spear/spdif_out.c

index 14d57e89bcbac5362efa85f40a41a9cf3e28f026..82c838753c0694cd2108e7fe0b04f3796644261d 100644 (file)
@@ -49,15 +49,12 @@ static void spdif_in_configure(struct spdif_in_dev *host)
        writel(0xF, host->io_base + SPDIF_IN_IRQ_MASK);
 }
 
-static int spdif_in_startup(struct snd_pcm_substream *substream,
-               struct snd_soc_dai *cpu_dai)
+static int spdif_in_dai_probe(struct snd_soc_dai *dai)
 {
-       struct spdif_in_dev *host = snd_soc_dai_get_drvdata(cpu_dai);
+       struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai);
 
-       if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
-               return -EINVAL;
+       dai->capture_dma_data = &host->dma_params;
 
-       snd_soc_dai_set_dma_data(cpu_dai, substream, (void *)&host->dma_params);
        return 0;
 }
 
@@ -70,7 +67,6 @@ static void spdif_in_shutdown(struct snd_pcm_substream *substream,
                return;
 
        writel(0x0, host->io_base + SPDIF_IN_IRQ_MASK);
-       snd_soc_dai_set_dma_data(dai, substream, NULL);
 }
 
 static void spdif_in_format(struct spdif_in_dev *host, u32 format)
@@ -151,13 +147,13 @@ static int spdif_in_trigger(struct snd_pcm_substream *substream, int cmd,
 }
 
 static struct snd_soc_dai_ops spdif_in_dai_ops = {
-       .startup        = spdif_in_startup,
        .shutdown       = spdif_in_shutdown,
        .trigger        = spdif_in_trigger,
        .hw_params      = spdif_in_hw_params,
 };
 
 struct snd_soc_dai_driver spdif_in_dai = {
+       .probe = spdif_in_dai_probe,
        .capture = {
                .channels_min = 2,
                .channels_max = 2,
index 1e3c3dda359846e07fa73f13b3538f81b3dedeb7..12b4f2fcb9afcb0d33553d0674aa5fc045b0a1ef 100644 (file)
@@ -62,8 +62,6 @@ static int spdif_out_startup(struct snd_pcm_substream *substream,
        if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
                return -EINVAL;
 
-       snd_soc_dai_set_dma_data(cpu_dai, substream, (void *)&host->dma_params);
-
        ret = clk_enable(host->clk);
        if (ret)
                return ret;
@@ -84,7 +82,6 @@ static void spdif_out_shutdown(struct snd_pcm_substream *substream,
 
        clk_disable(host->clk);
        host->running = false;
-       snd_soc_dai_set_dma_data(dai, substream, NULL);
 }
 
 static void spdif_out_clock(struct spdif_out_dev *host, u32 core_freq,
@@ -245,6 +242,10 @@ static const struct snd_kcontrol_new spdif_out_controls[] = {
 
 int spdif_soc_dai_probe(struct snd_soc_dai *dai)
 {
+       struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
+
+       dai->playback_dma_data = &host->dma_params;
+
        return snd_soc_add_dai_controls(dai, spdif_out_controls,
                                ARRAY_SIZE(spdif_out_controls));
 }
This page took 0.026877 seconds and 5 git commands to generate.