aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-04-20 13:29:06 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-05-12 12:58:03 -0400
commit46fdd8b11d4ab58af126344dcbc0bd565174db16 (patch)
treede1bbe6bd4ccb769d6516f51efdd67b5ec6a36ff /sound
parentf722406faae2d073cc1d01063d1123c35425939e (diff)
ASoC: spear: Setup dma data in DAI probe
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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/spear/spdif_in.c12
-rw-r--r--sound/soc/spear/spdif_out.c7
2 files changed, 8 insertions, 11 deletions
diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c
index 14d57e89bcba..82c838753c06 100644
--- a/sound/soc/spear/spdif_in.c
+++ b/sound/soc/spear/spdif_in.c
@@ -49,15 +49,12 @@ static void spdif_in_configure(struct spdif_in_dev *host)
49 writel(0xF, host->io_base + SPDIF_IN_IRQ_MASK); 49 writel(0xF, host->io_base + SPDIF_IN_IRQ_MASK);
50} 50}
51 51
52static int spdif_in_startup(struct snd_pcm_substream *substream, 52static int spdif_in_dai_probe(struct snd_soc_dai *dai)
53 struct snd_soc_dai *cpu_dai)
54{ 53{
55 struct spdif_in_dev *host = snd_soc_dai_get_drvdata(cpu_dai); 54 struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai);
56 55
57 if (substream->stream != SNDRV_PCM_STREAM_CAPTURE) 56 dai->capture_dma_data = &host->dma_params;
58 return -EINVAL;
59 57
60 snd_soc_dai_set_dma_data(cpu_dai, substream, (void *)&host->dma_params);
61 return 0; 58 return 0;
62} 59}
63 60
@@ -70,7 +67,6 @@ static void spdif_in_shutdown(struct snd_pcm_substream *substream,
70 return; 67 return;
71 68
72 writel(0x0, host->io_base + SPDIF_IN_IRQ_MASK); 69 writel(0x0, host->io_base + SPDIF_IN_IRQ_MASK);
73 snd_soc_dai_set_dma_data(dai, substream, NULL);
74} 70}
75 71
76static void spdif_in_format(struct spdif_in_dev *host, u32 format) 72static 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,
151} 147}
152 148
153static struct snd_soc_dai_ops spdif_in_dai_ops = { 149static struct snd_soc_dai_ops spdif_in_dai_ops = {
154 .startup = spdif_in_startup,
155 .shutdown = spdif_in_shutdown, 150 .shutdown = spdif_in_shutdown,
156 .trigger = spdif_in_trigger, 151 .trigger = spdif_in_trigger,
157 .hw_params = spdif_in_hw_params, 152 .hw_params = spdif_in_hw_params,
158}; 153};
159 154
160struct snd_soc_dai_driver spdif_in_dai = { 155struct snd_soc_dai_driver spdif_in_dai = {
156 .probe = spdif_in_dai_probe,
161 .capture = { 157 .capture = {
162 .channels_min = 2, 158 .channels_min = 2,
163 .channels_max = 2, 159 .channels_max = 2,
diff --git a/sound/soc/spear/spdif_out.c b/sound/soc/spear/spdif_out.c
index 1e3c3dda3598..12b4f2fcb9af 100644
--- a/sound/soc/spear/spdif_out.c
+++ b/sound/soc/spear/spdif_out.c
@@ -62,8 +62,6 @@ static int spdif_out_startup(struct snd_pcm_substream *substream,
62 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) 62 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
63 return -EINVAL; 63 return -EINVAL;
64 64
65 snd_soc_dai_set_dma_data(cpu_dai, substream, (void *)&host->dma_params);
66
67 ret = clk_enable(host->clk); 65 ret = clk_enable(host->clk);
68 if (ret) 66 if (ret)
69 return ret; 67 return ret;
@@ -84,7 +82,6 @@ static void spdif_out_shutdown(struct snd_pcm_substream *substream,
84 82
85 clk_disable(host->clk); 83 clk_disable(host->clk);
86 host->running = false; 84 host->running = false;
87 snd_soc_dai_set_dma_data(dai, substream, NULL);
88} 85}
89 86
90static void spdif_out_clock(struct spdif_out_dev *host, u32 core_freq, 87static 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[] = {
245 242
246int spdif_soc_dai_probe(struct snd_soc_dai *dai) 243int spdif_soc_dai_probe(struct snd_soc_dai *dai)
247{ 244{
245 struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
246
247 dai->playback_dma_data = &host->dma_params;
248
248 return snd_soc_add_dai_controls(dai, spdif_out_controls, 249 return snd_soc_add_dai_controls(dai, spdif_out_controls,
249 ARRAY_SIZE(spdif_out_controls)); 250 ARRAY_SIZE(spdif_out_controls));
250} 251}