aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/nuc900
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@slimlogic.co.uk>2010-03-17 16:15:21 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-08-12 09:00:00 -0400
commitf0fba2ad1b6b53d5360125c41953b7afcd6deff0 (patch)
treef6ad50905f8daa616593c978d7ae992e73241180 /sound/soc/nuc900
parentbda7d2a862e6b788bca2d02d38a07966a9c92e48 (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/nuc900')
-rw-r--r--sound/soc/nuc900/nuc900-ac97.c12
-rw-r--r--sound/soc/nuc900/nuc900-audio.c16
-rw-r--r--sound/soc/nuc900/nuc900-audio.h4
-rw-r--r--sound/soc/nuc900/nuc900-pcm.c38
4 files changed, 37 insertions, 33 deletions
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c
index caa7c901bc2e..02b64a17dec2 100644
--- a/sound/soc/nuc900/nuc900-ac97.c
+++ b/sound/soc/nuc900/nuc900-ac97.c
@@ -297,8 +297,7 @@ static struct snd_soc_dai_ops nuc900_ac97_dai_ops = {
297 .trigger = nuc900_ac97_trigger, 297 .trigger = nuc900_ac97_trigger,
298}; 298};
299 299
300struct snd_soc_dai nuc900_ac97_dai = { 300static struct snd_soc_dai_driver nuc900_ac97_dai = {
301 .name = "nuc900-ac97",
302 .probe = nuc900_ac97_probe, 301 .probe = nuc900_ac97_probe,
303 .remove = nuc900_ac97_remove, 302 .remove = nuc900_ac97_remove,
304 .ac97_control = 1, 303 .ac97_control = 1,
@@ -316,7 +315,6 @@ struct snd_soc_dai nuc900_ac97_dai = {
316 }, 315 },
317 .ops = &nuc900_ac97_dai_ops, 316 .ops = &nuc900_ac97_dai_ops,
318} 317}
319EXPORT_SYMBOL_GPL(nuc900_ac97_dai);
320 318
321static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev) 319static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev)
322{ 320{
@@ -365,9 +363,7 @@ static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev)
365 363
366 nuc900_ac97_data = nuc900_audio; 364 nuc900_ac97_data = nuc900_audio;
367 365
368 nuc900_audio->dev = nuc900_ac97_dai.dev = &pdev->dev; 366 ret = snd_soc_register_dai(&pdev->dev, &nuc900_ac97_dai);
369
370 ret = snd_soc_register_dai(&nuc900_ac97_dai);
371 if (ret) 367 if (ret)
372 goto out3; 368 goto out3;
373 369
@@ -390,7 +386,7 @@ out0:
390static int __devexit nuc900_ac97_drvremove(struct platform_device *pdev) 386static int __devexit nuc900_ac97_drvremove(struct platform_device *pdev)
391{ 387{
392 388
393 snd_soc_unregister_dai(&nuc900_ac97_dai); 389 snd_soc_unregister_dai(&pdev->dev);
394 390
395 clk_put(nuc900_ac97_data->clk); 391 clk_put(nuc900_ac97_data->clk);
396 iounmap(nuc900_ac97_data->mmio); 392 iounmap(nuc900_ac97_data->mmio);
@@ -404,7 +400,7 @@ static int __devexit nuc900_ac97_drvremove(struct platform_device *pdev)
404 400
405static struct platform_driver nuc900_ac97_driver = { 401static struct platform_driver nuc900_ac97_driver = {
406 .driver = { 402 .driver = {
407 .name = "nuc900-audio", 403 .name = "nuc900-ac97",
408 .owner = THIS_MODULE, 404 .owner = THIS_MODULE,
409 }, 405 },
410 .probe = nuc900_ac97_drvprobe, 406 .probe = nuc900_ac97_drvprobe,
diff --git a/sound/soc/nuc900/nuc900-audio.c b/sound/soc/nuc900/nuc900-audio.c
index 72e6f518f7b2..161f5b667d7b 100644
--- a/sound/soc/nuc900/nuc900-audio.c
+++ b/sound/soc/nuc900/nuc900-audio.c
@@ -20,26 +20,21 @@
20#include <sound/soc.h> 20#include <sound/soc.h>
21#include <sound/soc-dapm.h> 21#include <sound/soc-dapm.h>
22 22
23#include "../codecs/ac97.h"
24#include "nuc900-audio.h" 23#include "nuc900-audio.h"
25 24
26static struct snd_soc_dai_link nuc900evb_ac97_dai = { 25static struct snd_soc_dai_link nuc900evb_ac97_dai = {
27 .name = "AC97", 26 .name = "AC97",
28 .stream_name = "AC97 HiFi", 27 .stream_name = "AC97 HiFi",
29 .cpu_dai = &nuc900_ac97_dai, 28 .cpu_dai_name = "nuc900-ac97",
30 .codec_dai = &ac97_dai, 29 .codec_dai_name = "ac97-hifi",
30 .codec_name = "ac97-codec",
31 .platform_name = "nuc900-pcm-audio",
31}; 32};
32 33
33static struct snd_soc_card nuc900evb_audio_machine = { 34static struct snd_soc_card nuc900evb_audio_machine = {
34 .name = "NUC900EVB_AC97", 35 .name = "NUC900EVB_AC97",
35 .dai_link = &nuc900evb_ac97_dai, 36 .dai_link = &nuc900evb_ac97_dai,
36 .num_links = 1, 37 .num_links = 1,
37 .platform = &nuc900_soc_platform,
38};
39
40static struct snd_soc_device nuc900evb_ac97_devdata = {
41 .card = &nuc900evb_audio_machine,
42 .codec_dev = &soc_codec_dev_ac97,
43}; 38};
44 39
45static struct platform_device *nuc900evb_asoc_dev; 40static struct platform_device *nuc900evb_asoc_dev;
@@ -54,9 +49,8 @@ static int __init nuc900evb_audio_init(void)
54 goto out; 49 goto out;
55 50
56 /* nuc900 board audio device */ 51 /* nuc900 board audio device */
57 platform_set_drvdata(nuc900evb_asoc_dev, &nuc900evb_ac97_devdata); 52 platform_set_drvdata(nuc900evb_asoc_dev, &nuc900evb_audio_machine);
58 53
59 nuc900evb_ac97_devdata.dev = &nuc900evb_asoc_dev->dev;
60 ret = platform_device_add(nuc900evb_asoc_dev); 54 ret = platform_device_add(nuc900evb_asoc_dev);
61 55
62 if (ret) { 56 if (ret) {
diff --git a/sound/soc/nuc900/nuc900-audio.h b/sound/soc/nuc900/nuc900-audio.h
index 3038f519729f..aeed8ead2b2b 100644
--- a/sound/soc/nuc900/nuc900-audio.h
+++ b/sound/soc/nuc900/nuc900-audio.h
@@ -110,8 +110,4 @@ struct nuc900_audio {
110 110
111}; 111};
112 112
113extern struct nuc900_audio *nuc900_ac97_data;
114extern struct snd_soc_dai nuc900_ac97_dai;
115extern struct snd_soc_platform nuc900_soc_platform;
116
117#endif /*end _NUC900_AUDIO_H */ 113#endif /*end _NUC900_AUDIO_H */
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c
index e81e803b3a63..195d1ac94771 100644
--- a/sound/soc/nuc900/nuc900-pcm.c
+++ b/sound/soc/nuc900/nuc900-pcm.c
@@ -328,26 +328,44 @@ static int nuc900_dma_new(struct snd_card *card,
328 return 0; 328 return 0;
329} 329}
330 330
331struct snd_soc_platform nuc900_soc_platform = { 331static struct snd_soc_platform_driver nuc900_soc_platform = {
332 .name = "nuc900-dma", 332 .ops = &nuc900_dma_ops,
333 .pcm_ops = &nuc900_dma_ops,
334 .pcm_new = nuc900_dma_new, 333 .pcm_new = nuc900_dma_new,
335 .pcm_free = nuc900_dma_free_dma_buffers, 334 .pcm_free = nuc900_dma_free_dma_buffers,
336} 335}
337EXPORT_SYMBOL_GPL(nuc900_soc_platform);
338 336
339static int __init nuc900_soc_platform_init(void) 337static int __devinit nuc900_soc_platform_probe(struct platform_device *pdev)
340{ 338{
341 return snd_soc_register_platform(&nuc900_soc_platform); 339 return snd_soc_register_platform(&pdev->dev, &nuc900_soc_platform);
342} 340}
343 341
344static void __exit nuc900_soc_platform_exit(void) 342static int __devexit nuc900_soc_platform_remove(struct platform_device *pdev)
345{ 343{
346 snd_soc_unregister_platform(&nuc900_soc_platform); 344 snd_soc_unregister_platform(&pdev->dev);
345 return 0;
347} 346}
348 347
349module_init(nuc900_soc_platform_init); 348static struct platform_driver nuc900_pcm_driver = {
350module_exit(nuc900_soc_platform_exit); 349 .driver = {
350 .name = "nuc900-pcm-audio",
351 .owner = THIS_MODULE,
352 },
353
354 .probe = nuc900_soc_platform_probe,
355 .remove = __devexit_p(nuc900_soc_platform_remove),
356};
357
358static int __init nuc900_pcm_init(void)
359{
360 return platform_driver_register(&nuc900_pcm_driver);
361}
362module_init(nuc900_pcm_init);
363
364static void __exit nuc900_pcm_exit(void)
365{
366 platform_driver_unregister(&nuc900_pcm_driver);
367}
368module_exit(nuc900_pcm_exit);
351 369
352MODULE_AUTHOR("Wan ZongShun, <mcuos.com@gmail.com>"); 370MODULE_AUTHOR("Wan ZongShun, <mcuos.com@gmail.com>");
353MODULE_DESCRIPTION("nuc900 Audio DMA module"); 371MODULE_DESCRIPTION("nuc900 Audio DMA module");