diff options
author | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-03-17 16:15:21 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-08-12 09:00:00 -0400 |
commit | f0fba2ad1b6b53d5360125c41953b7afcd6deff0 (patch) | |
tree | f6ad50905f8daa616593c978d7ae992e73241180 /sound/soc/kirkwood | |
parent | bda7d2a862e6b788bca2d02d38a07966a9c92e48 (diff) |
ASoC: multi-component - ASoC Multi-Component Support
This patch extends the ASoC API to allow sound cards to have more than one
CODEC and more than one platform DMA controller. This is achieved by dividing
some current ASoC structures that contain both driver data and device data into
structures that only either contain device data or driver data. i.e.
struct snd_soc_codec ---> struct snd_soc_codec (device data)
+-> struct snd_soc_codec_driver (driver data)
struct snd_soc_platform ---> struct snd_soc_platform (device data)
+-> struct snd_soc_platform_driver (driver data)
struct snd_soc_dai ---> struct snd_soc_dai (device data)
+-> struct snd_soc_dai_driver (driver data)
struct snd_soc_device ---> deleted
This now allows ASoC to be more tightly aligned with the Linux driver model and
also means that every ASoC codec, platform and (platform) DAI is a kernel
device. ASoC component private data is now stored as device private data.
The ASoC sound card struct snd_soc_card has also been updated to store lists
of it's components rather than a pointer to a codec and platform. The PCM
runtime struct soc_pcm_runtime now has pointers to all its components.
This patch adds DAPM support for ASoC multi-component and removes struct
snd_soc_socdev from DAPM core. All DAPM calls are now made on a card, codec
or runtime PCM level basis rather than using snd_soc_socdev.
Other notable multi-component changes:-
* Stream operations now de-reference less structures.
* close_delayed work() now runs on a DAI basis rather than looping all DAIs
in a card.
* PM suspend()/resume() operations can now handle N CODECs and Platforms
per sound card.
* Added soc_bind_dai_link() to bind the component devices to the sound card.
* Added soc_dai_link_probe() and soc_dai_link_remove() to probe and remove
DAI link components.
* sysfs entries can now be registered per component per card.
* snd_soc_new_pcms() functionailty rolled into dai_link_probe().
* snd_soc_register_codec() now does all the codec list and mutex init.
This patch changes the probe() and remove() of the CODEC drivers as follows:-
o Make CODEC driver a platform driver
o Moved all struct snd_soc_codec list, mutex, etc initialiasation to core.
o Removed all static codec pointers (drivers now support > 1 codec dev)
o snd_soc_register_pcms() now done by core.
o snd_soc_register_dai() folded into snd_soc_register_codec().
CS4270 portions:
Acked-by: Timur Tabi <timur@freescale.com>
Some TLV320aic23 and Cirrus platform fixes.
Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>
TI CODEC and OMAP fixes
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Samsung platform and misc fixes :-
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Seungwhan Youn <sw.youn@samsung.com>
MPC8610 and PPC fixes.
Signed-off-by: Timur Tabi <timur@freescale.com>
i.MX fixes and some core fixes.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
J4740 platform fixes:-
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
CC: Tony Lindgren <tony@atomide.com>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Sascha Hauer <s.hauer@pengutronix.de>
CC: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
CC: Kuninori Morimoto <morimoto.kuninori@renesas.com>
CC: Daniel Gloeckner <dg@emlix.com>
CC: Manuel Lauss <mano@roarinelk.homelinux.net>
CC: Mike Frysinger <vapier.adi@gmail.com>
CC: Arnaud Patard <apatard@mandriva.com>
CC: Wan ZongShun <mcuos.com@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/kirkwood')
-rw-r--r-- | sound/soc/kirkwood/kirkwood-dma.c | 64 | ||||
-rw-r--r-- | sound/soc/kirkwood/kirkwood-dma.h | 17 | ||||
-rw-r--r-- | sound/soc/kirkwood/kirkwood-i2s.c | 52 | ||||
-rw-r--r-- | sound/soc/kirkwood/kirkwood-i2s.h | 17 | ||||
-rw-r--r-- | sound/soc/kirkwood/kirkwood-openrd.c | 21 |
5 files changed, 78 insertions, 93 deletions
diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c index a30205be3e2b..693049d42d24 100644 --- a/sound/soc/kirkwood/kirkwood-dma.c +++ b/sound/soc/kirkwood/kirkwood-dma.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/dma-mapping.h> | 18 | #include <linux/dma-mapping.h> |
19 | #include <linux/mbus.h> | 19 | #include <linux/mbus.h> |
20 | #include <sound/soc.h> | 20 | #include <sound/soc.h> |
21 | #include "kirkwood-dma.h" | ||
22 | #include "kirkwood.h" | 21 | #include "kirkwood.h" |
23 | 22 | ||
24 | #define KIRKWOOD_RATES \ | 23 | #define KIRKWOOD_RATES \ |
@@ -123,9 +122,10 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream) | |||
123 | int err; | 122 | int err; |
124 | struct snd_pcm_runtime *runtime = substream->runtime; | 123 | struct snd_pcm_runtime *runtime = substream->runtime; |
125 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 124 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
126 | struct snd_soc_dai *cpu_dai = soc_runtime->dai->cpu_dai; | 125 | struct snd_soc_platform *platform = soc_runtime->platform; |
126 | struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; | ||
127 | struct kirkwood_dma_data *priv; | 127 | struct kirkwood_dma_data *priv; |
128 | struct kirkwood_dma_priv *prdata = cpu_dai->private_data; | 128 | struct kirkwood_dma_priv *prdata = snd_soc_platform_get_drvdata(platform); |
129 | unsigned long addr; | 129 | unsigned long addr; |
130 | 130 | ||
131 | priv = snd_soc_dai_get_dma_data(cpu_dai, substream); | 131 | priv = snd_soc_dai_get_dma_data(cpu_dai, substream); |
@@ -151,7 +151,7 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream) | |||
151 | if (err < 0) | 151 | if (err < 0) |
152 | return err; | 152 | return err; |
153 | 153 | ||
154 | if (soc_runtime->dai->cpu_dai->private_data == NULL) { | 154 | if (prdata == NULL) { |
155 | prdata = kzalloc(sizeof(struct kirkwood_dma_priv), GFP_KERNEL); | 155 | prdata = kzalloc(sizeof(struct kirkwood_dma_priv), GFP_KERNEL); |
156 | if (prdata == NULL) | 156 | if (prdata == NULL) |
157 | return -ENOMEM; | 157 | return -ENOMEM; |
@@ -165,7 +165,7 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream) | |||
165 | return -EBUSY; | 165 | return -EBUSY; |
166 | } | 166 | } |
167 | 167 | ||
168 | soc_runtime->dai->cpu_dai->private_data = prdata; | 168 | snd_soc_platform_set_drvdata(platform, prdata); |
169 | 169 | ||
170 | /* | 170 | /* |
171 | * Enable Error interrupts. We're only ack'ing them but | 171 | * Enable Error interrupts. We're only ack'ing them but |
@@ -191,8 +191,9 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream) | |||
191 | static int kirkwood_dma_close(struct snd_pcm_substream *substream) | 191 | static int kirkwood_dma_close(struct snd_pcm_substream *substream) |
192 | { | 192 | { |
193 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 193 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
194 | struct snd_soc_dai *cpu_dai = soc_runtime->dai->cpu_dai; | 194 | struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; |
195 | struct kirkwood_dma_priv *prdata = cpu_dai->private_data; | 195 | struct snd_soc_platform *platform = soc_runtime->platform; |
196 | struct kirkwood_dma_priv *prdata = snd_soc_platform_get_drvdata(platform); | ||
196 | struct kirkwood_dma_data *priv; | 197 | struct kirkwood_dma_data *priv; |
197 | 198 | ||
198 | priv = snd_soc_dai_get_dma_data(cpu_dai, substream); | 199 | priv = snd_soc_dai_get_dma_data(cpu_dai, substream); |
@@ -209,7 +210,7 @@ static int kirkwood_dma_close(struct snd_pcm_substream *substream) | |||
209 | writel(0, priv->io + KIRKWOOD_ERR_MASK); | 210 | writel(0, priv->io + KIRKWOOD_ERR_MASK); |
210 | free_irq(priv->irq, prdata); | 211 | free_irq(priv->irq, prdata); |
211 | kfree(prdata); | 212 | kfree(prdata); |
212 | soc_runtime->dai->cpu_dai->private_data = NULL; | 213 | snd_soc_platform_set_drvdata(platform, NULL); |
213 | } | 214 | } |
214 | 215 | ||
215 | return 0; | 216 | return 0; |
@@ -236,7 +237,7 @@ static int kirkwood_dma_prepare(struct snd_pcm_substream *substream) | |||
236 | { | 237 | { |
237 | struct snd_pcm_runtime *runtime = substream->runtime; | 238 | struct snd_pcm_runtime *runtime = substream->runtime; |
238 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 239 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
239 | struct snd_soc_dai *cpu_dai = soc_runtime->dai->cpu_dai; | 240 | struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; |
240 | struct kirkwood_dma_data *priv; | 241 | struct kirkwood_dma_data *priv; |
241 | unsigned long size, count; | 242 | unsigned long size, count; |
242 | 243 | ||
@@ -265,7 +266,7 @@ static snd_pcm_uframes_t kirkwood_dma_pointer(struct snd_pcm_substream | |||
265 | *substream) | 266 | *substream) |
266 | { | 267 | { |
267 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 268 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
268 | struct snd_soc_dai *cpu_dai = soc_runtime->dai->cpu_dai; | 269 | struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; |
269 | struct kirkwood_dma_data *priv; | 270 | struct kirkwood_dma_data *priv; |
270 | snd_pcm_uframes_t count; | 271 | snd_pcm_uframes_t count; |
271 | 272 | ||
@@ -320,14 +321,14 @@ static int kirkwood_dma_new(struct snd_card *card, | |||
320 | if (!card->dev->coherent_dma_mask) | 321 | if (!card->dev->coherent_dma_mask) |
321 | card->dev->coherent_dma_mask = 0xffffffff; | 322 | card->dev->coherent_dma_mask = 0xffffffff; |
322 | 323 | ||
323 | if (dai->playback.channels_min) { | 324 | if (dai->driver->playback.channels_min) { |
324 | ret = kirkwood_dma_preallocate_dma_buffer(pcm, | 325 | ret = kirkwood_dma_preallocate_dma_buffer(pcm, |
325 | SNDRV_PCM_STREAM_PLAYBACK); | 326 | SNDRV_PCM_STREAM_PLAYBACK); |
326 | if (ret) | 327 | if (ret) |
327 | return ret; | 328 | return ret; |
328 | } | 329 | } |
329 | 330 | ||
330 | if (dai->capture.channels_min) { | 331 | if (dai->driver->capture.channels_min) { |
331 | ret = kirkwood_dma_preallocate_dma_buffer(pcm, | 332 | ret = kirkwood_dma_preallocate_dma_buffer(pcm, |
332 | SNDRV_PCM_STREAM_CAPTURE); | 333 | SNDRV_PCM_STREAM_CAPTURE); |
333 | if (ret) | 334 | if (ret) |
@@ -357,25 +358,44 @@ static void kirkwood_dma_free_dma_buffers(struct snd_pcm *pcm) | |||
357 | } | 358 | } |
358 | } | 359 | } |
359 | 360 | ||
360 | struct snd_soc_platform kirkwood_soc_platform = { | 361 | static struct snd_soc_platform_driver kirkwood_soc_platform = { |
361 | .name = "kirkwood-dma", | 362 | .ops = &kirkwood_dma_ops, |
362 | .pcm_ops = &kirkwood_dma_ops, | ||
363 | .pcm_new = kirkwood_dma_new, | 363 | .pcm_new = kirkwood_dma_new, |
364 | .pcm_free = kirkwood_dma_free_dma_buffers, | 364 | .pcm_free = kirkwood_dma_free_dma_buffers, |
365 | }; | 365 | }; |
366 | EXPORT_SYMBOL_GPL(kirkwood_soc_platform); | ||
367 | 366 | ||
368 | static int __init kirkwood_soc_platform_init(void) | 367 | static int __devinit kirkwood_soc_platform_probe(struct platform_device *pdev) |
369 | { | 368 | { |
370 | return snd_soc_register_platform(&kirkwood_soc_platform); | 369 | return snd_soc_register_platform(&pdev->dev, &kirkwood_soc_platform); |
371 | } | 370 | } |
372 | module_init(kirkwood_soc_platform_init); | ||
373 | 371 | ||
374 | static void __exit kirkwood_soc_platform_exit(void) | 372 | static int __devexit kirkwood_soc_platform_remove(struct platform_device *pdev) |
375 | { | 373 | { |
376 | snd_soc_unregister_platform(&kirkwood_soc_platform); | 374 | snd_soc_unregister_platform(&pdev->dev); |
375 | return 0; | ||
376 | } | ||
377 | |||
378 | static struct platform_driver kirkwood_pcm_driver = { | ||
379 | .driver = { | ||
380 | .name = "kirkwood-pcm-audio", | ||
381 | .owner = THIS_MODULE, | ||
382 | }, | ||
383 | |||
384 | .probe = kirkwood_soc_platform_probe, | ||
385 | .remove = __devexit_p(kirkwood_soc_platform_remove), | ||
386 | }; | ||
387 | |||
388 | static int __init kirkwood_pcm_init(void) | ||
389 | { | ||
390 | return platform_driver_register(&kirkwood_pcm_driver); | ||
391 | } | ||
392 | module_init(kirkwood_pcm_init); | ||
393 | |||
394 | static void __exit kirkwood_pcm_exit(void) | ||
395 | { | ||
396 | platform_driver_unregister(&kirkwood_pcm_driver); | ||
377 | } | 397 | } |
378 | module_exit(kirkwood_soc_platform_exit); | 398 | module_exit(kirkwood_pcm_exit); |
379 | 399 | ||
380 | MODULE_AUTHOR("Arnaud Patard <apatard@mandriva.com>"); | 400 | MODULE_AUTHOR("Arnaud Patard <apatard@mandriva.com>"); |
381 | MODULE_DESCRIPTION("Marvell Kirkwood Audio DMA module"); | 401 | MODULE_DESCRIPTION("Marvell Kirkwood Audio DMA module"); |
diff --git a/sound/soc/kirkwood/kirkwood-dma.h b/sound/soc/kirkwood/kirkwood-dma.h deleted file mode 100644 index ba4454cd34f1..000000000000 --- a/sound/soc/kirkwood/kirkwood-dma.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* | ||
2 | * kirkwood-dma.h | ||
3 | * | ||
4 | * (c) 2010 Arnaud Patard <apatard@mandriva.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _KIRKWOOD_DMA_H | ||
13 | #define _KIRKWOOD_DMA_H | ||
14 | |||
15 | extern struct snd_soc_platform kirkwood_soc_platform; | ||
16 | |||
17 | #endif | ||
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index 981ffc2a13c8..9b62cba4f590 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <sound/pcm_params.h> | 20 | #include <sound/pcm_params.h> |
21 | #include <sound/soc.h> | 21 | #include <sound/soc.h> |
22 | #include <plat/audio.h> | 22 | #include <plat/audio.h> |
23 | #include "kirkwood-i2s.h" | ||
24 | #include "kirkwood.h" | 23 | #include "kirkwood.h" |
25 | 24 | ||
26 | #define DRV_NAME "kirkwood-i2s" | 25 | #define DRV_NAME "kirkwood-i2s" |
@@ -33,13 +32,10 @@ | |||
33 | SNDRV_PCM_FMTBIT_S24_LE | \ | 32 | SNDRV_PCM_FMTBIT_S24_LE | \ |
34 | SNDRV_PCM_FMTBIT_S32_LE) | 33 | SNDRV_PCM_FMTBIT_S32_LE) |
35 | 34 | ||
36 | |||
37 | struct snd_soc_dai kirkwood_i2s_dai; | ||
38 | static struct kirkwood_dma_data *priv; | ||
39 | |||
40 | static int kirkwood_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | 35 | static int kirkwood_i2s_set_fmt(struct snd_soc_dai *cpu_dai, |
41 | unsigned int fmt) | 36 | unsigned int fmt) |
42 | { | 37 | { |
38 | struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(cpu_dai); | ||
43 | unsigned long mask; | 39 | unsigned long mask; |
44 | unsigned long value; | 40 | unsigned long value; |
45 | 41 | ||
@@ -101,10 +97,20 @@ static inline void kirkwood_set_dco(void __iomem *io, unsigned long rate) | |||
101 | } while (value == 0); | 97 | } while (value == 0); |
102 | } | 98 | } |
103 | 99 | ||
100 | static int kirkwood_i2s_startup(struct snd_pcm_substream *substream, | ||
101 | struct snd_soc_dai *dai) | ||
102 | { | ||
103 | struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); | ||
104 | |||
105 | snd_soc_dai_set_dma_data(dai, substream, priv); | ||
106 | return 0; | ||
107 | } | ||
108 | |||
104 | static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream, | 109 | static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream, |
105 | struct snd_pcm_hw_params *params, | 110 | struct snd_pcm_hw_params *params, |
106 | struct snd_soc_dai *dai) | 111 | struct snd_soc_dai *dai) |
107 | { | 112 | { |
113 | struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); | ||
108 | unsigned int i2s_reg, reg; | 114 | unsigned int i2s_reg, reg; |
109 | unsigned long i2s_value, value; | 115 | unsigned long i2s_value, value; |
110 | 116 | ||
@@ -171,6 +177,7 @@ static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream, | |||
171 | static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream, | 177 | static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream, |
172 | int cmd, struct snd_soc_dai *dai) | 178 | int cmd, struct snd_soc_dai *dai) |
173 | { | 179 | { |
180 | struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); | ||
174 | unsigned long value; | 181 | unsigned long value; |
175 | 182 | ||
176 | /* | 183 | /* |
@@ -244,6 +251,7 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream, | |||
244 | static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream, | 251 | static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream, |
245 | int cmd, struct snd_soc_dai *dai) | 252 | int cmd, struct snd_soc_dai *dai) |
246 | { | 253 | { |
254 | struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); | ||
247 | unsigned long value; | 255 | unsigned long value; |
248 | 256 | ||
249 | value = readl(priv->io + KIRKWOOD_RECCTL); | 257 | value = readl(priv->io + KIRKWOOD_RECCTL); |
@@ -323,9 +331,9 @@ static int kirkwood_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | |||
323 | return 0; | 331 | return 0; |
324 | } | 332 | } |
325 | 333 | ||
326 | static int kirkwood_i2s_probe(struct platform_device *pdev, | 334 | static int kirkwood_i2s_probe(struct snd_soc_dai *dai) |
327 | struct snd_soc_dai *dai) | ||
328 | { | 335 | { |
336 | struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); | ||
329 | unsigned long value; | 337 | unsigned long value; |
330 | unsigned int reg_data; | 338 | unsigned int reg_data; |
331 | 339 | ||
@@ -359,21 +367,20 @@ static int kirkwood_i2s_probe(struct platform_device *pdev, | |||
359 | 367 | ||
360 | } | 368 | } |
361 | 369 | ||
362 | static void kirkwood_i2s_remove(struct platform_device *pdev, | 370 | static int kirkwood_i2s_remove(struct snd_soc_dai *dai) |
363 | struct snd_soc_dai *dai) | ||
364 | { | 371 | { |
372 | return 0; | ||
365 | } | 373 | } |
366 | 374 | ||
367 | static struct snd_soc_dai_ops kirkwood_i2s_dai_ops = { | 375 | static struct snd_soc_dai_ops kirkwood_i2s_dai_ops = { |
376 | .startup = kirkwood_i2s_startup, | ||
368 | .trigger = kirkwood_i2s_trigger, | 377 | .trigger = kirkwood_i2s_trigger, |
369 | .hw_params = kirkwood_i2s_hw_params, | 378 | .hw_params = kirkwood_i2s_hw_params, |
370 | .set_fmt = kirkwood_i2s_set_fmt, | 379 | .set_fmt = kirkwood_i2s_set_fmt, |
371 | }; | 380 | }; |
372 | 381 | ||
373 | 382 | ||
374 | struct snd_soc_dai kirkwood_i2s_dai = { | 383 | static struct snd_soc_dai_driver kirkwood_i2s_dai = { |
375 | .name = DRV_NAME, | ||
376 | .id = 0, | ||
377 | .probe = kirkwood_i2s_probe, | 384 | .probe = kirkwood_i2s_probe, |
378 | .remove = kirkwood_i2s_remove, | 385 | .remove = kirkwood_i2s_remove, |
379 | .playback = { | 386 | .playback = { |
@@ -388,13 +395,13 @@ struct snd_soc_dai kirkwood_i2s_dai = { | |||
388 | .formats = KIRKWOOD_I2S_FORMATS,}, | 395 | .formats = KIRKWOOD_I2S_FORMATS,}, |
389 | .ops = &kirkwood_i2s_dai_ops, | 396 | .ops = &kirkwood_i2s_dai_ops, |
390 | }; | 397 | }; |
391 | EXPORT_SYMBOL_GPL(kirkwood_i2s_dai); | ||
392 | 398 | ||
393 | static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev) | 399 | static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev) |
394 | { | 400 | { |
395 | struct resource *mem; | 401 | struct resource *mem; |
396 | struct kirkwood_asoc_platform_data *data = | 402 | struct kirkwood_asoc_platform_data *data = |
397 | pdev->dev.platform_data; | 403 | pdev->dev.platform_data; |
404 | struct kirkwood_dma_data *priv; | ||
398 | int err; | 405 | int err; |
399 | 406 | ||
400 | priv = kzalloc(sizeof(struct kirkwood_dma_data), GFP_KERNEL); | 407 | priv = kzalloc(sizeof(struct kirkwood_dma_data), GFP_KERNEL); |
@@ -403,6 +410,7 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev) | |||
403 | err = -ENOMEM; | 410 | err = -ENOMEM; |
404 | goto error; | 411 | goto error; |
405 | } | 412 | } |
413 | dev_set_drvdata(&pdev->dev, priv); | ||
406 | 414 | ||
407 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 415 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
408 | if (!mem) { | 416 | if (!mem) { |
@@ -441,10 +449,7 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev) | |||
441 | priv->dram = data->dram; | 449 | priv->dram = data->dram; |
442 | priv->burst = data->burst; | 450 | priv->burst = data->burst; |
443 | 451 | ||
444 | kirkwood_i2s_dai.capture.dma_data = priv; | 452 | return snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai); |
445 | kirkwood_i2s_dai.playback.dma_data = priv; | ||
446 | |||
447 | return snd_soc_register_dai(&kirkwood_i2s_dai); | ||
448 | 453 | ||
449 | err_ioremap: | 454 | err_ioremap: |
450 | iounmap(priv->io); | 455 | iounmap(priv->io); |
@@ -458,12 +463,13 @@ error: | |||
458 | 463 | ||
459 | static __devexit int kirkwood_i2s_dev_remove(struct platform_device *pdev) | 464 | static __devexit int kirkwood_i2s_dev_remove(struct platform_device *pdev) |
460 | { | 465 | { |
461 | if (priv) { | 466 | struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev); |
462 | iounmap(priv->io); | 467 | |
463 | release_mem_region(priv->mem->start, SZ_16K); | 468 | snd_soc_unregister_dai(&pdev->dev); |
464 | kfree(priv); | 469 | iounmap(priv->io); |
465 | } | 470 | release_mem_region(priv->mem->start, SZ_16K); |
466 | snd_soc_unregister_dai(&kirkwood_i2s_dai); | 471 | kfree(priv); |
472 | |||
467 | return 0; | 473 | return 0; |
468 | } | 474 | } |
469 | 475 | ||
diff --git a/sound/soc/kirkwood/kirkwood-i2s.h b/sound/soc/kirkwood/kirkwood-i2s.h deleted file mode 100644 index c5595c616d7a..000000000000 --- a/sound/soc/kirkwood/kirkwood-i2s.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | /* | ||
2 | * kirkwood-i2s.h | ||
3 | * | ||
4 | * (c) 2010 Arnaud Patard <apatard@mandriva.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License as published by the | ||
8 | * Free Software Foundation; either version 2 of the License, or (at your | ||
9 | * option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _KIRKWOOD_I2S_H | ||
13 | #define _KIRKWOOD_I2S_H | ||
14 | |||
15 | extern struct snd_soc_dai kirkwood_i2s_dai; | ||
16 | |||
17 | #endif | ||
diff --git a/sound/soc/kirkwood/kirkwood-openrd.c b/sound/soc/kirkwood/kirkwood-openrd.c index 0353d06bc41a..cc1a1e277edf 100644 --- a/sound/soc/kirkwood/kirkwood-openrd.c +++ b/sound/soc/kirkwood/kirkwood-openrd.c | |||
@@ -18,16 +18,14 @@ | |||
18 | #include <mach/kirkwood.h> | 18 | #include <mach/kirkwood.h> |
19 | #include <plat/audio.h> | 19 | #include <plat/audio.h> |
20 | #include <asm/mach-types.h> | 20 | #include <asm/mach-types.h> |
21 | #include "kirkwood-i2s.h" | ||
22 | #include "kirkwood-dma.h" | ||
23 | #include "../codecs/cs42l51.h" | 21 | #include "../codecs/cs42l51.h" |
24 | 22 | ||
25 | static int openrd_client_hw_params(struct snd_pcm_substream *substream, | 23 | static int openrd_client_hw_params(struct snd_pcm_substream *substream, |
26 | struct snd_pcm_hw_params *params) | 24 | struct snd_pcm_hw_params *params) |
27 | { | 25 | { |
28 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 26 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
29 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 27 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
30 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 28 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
31 | int ret; | 29 | int ret; |
32 | unsigned int freq, fmt; | 30 | unsigned int freq, fmt; |
33 | 31 | ||
@@ -66,8 +64,10 @@ static struct snd_soc_dai_link openrd_client_dai[] = { | |||
66 | { | 64 | { |
67 | .name = "CS42L51", | 65 | .name = "CS42L51", |
68 | .stream_name = "CS42L51 HiFi", | 66 | .stream_name = "CS42L51 HiFi", |
69 | .cpu_dai = &kirkwood_i2s_dai, | 67 | .cpu_dai_name = "kirkwood-i2s", |
70 | .codec_dai = &cs42l51_dai, | 68 | .platform_name = "kirkwood-pcm-audio", |
69 | .codec_dai_name = "cs42l51_hifi", | ||
70 | .codec_name = "cs42l51-codec.0-004a", | ||
71 | .ops = &openrd_client_ops, | 71 | .ops = &openrd_client_ops, |
72 | }, | 72 | }, |
73 | }; | 73 | }; |
@@ -75,16 +75,10 @@ static struct snd_soc_dai_link openrd_client_dai[] = { | |||
75 | 75 | ||
76 | static struct snd_soc_card openrd_client = { | 76 | static struct snd_soc_card openrd_client = { |
77 | .name = "OpenRD Client", | 77 | .name = "OpenRD Client", |
78 | .platform = &kirkwood_soc_platform, | ||
79 | .dai_link = openrd_client_dai, | 78 | .dai_link = openrd_client_dai, |
80 | .num_links = ARRAY_SIZE(openrd_client_dai), | 79 | .num_links = ARRAY_SIZE(openrd_client_dai), |
81 | }; | 80 | }; |
82 | 81 | ||
83 | static struct snd_soc_device openrd_client_snd_devdata = { | ||
84 | .card = &openrd_client, | ||
85 | .codec_dev = &soc_codec_device_cs42l51, | ||
86 | }; | ||
87 | |||
88 | static struct platform_device *openrd_client_snd_device; | 82 | static struct platform_device *openrd_client_snd_device; |
89 | 83 | ||
90 | static int __init openrd_client_init(void) | 84 | static int __init openrd_client_init(void) |
@@ -99,8 +93,7 @@ static int __init openrd_client_init(void) | |||
99 | return -ENOMEM; | 93 | return -ENOMEM; |
100 | 94 | ||
101 | platform_set_drvdata(openrd_client_snd_device, | 95 | platform_set_drvdata(openrd_client_snd_device, |
102 | &openrd_client_snd_devdata); | 96 | &openrd_client); |
103 | openrd_client_snd_devdata.dev = &openrd_client_snd_device->dev; | ||
104 | 97 | ||
105 | ret = platform_device_add(openrd_client_snd_device); | 98 | ret = platform_device_add(openrd_client_snd_device); |
106 | if (ret) { | 99 | if (ret) { |