aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/au1x
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/au1x
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/au1x')
-rw-r--r--sound/soc/au1x/db1200.c35
-rw-r--r--sound/soc/au1x/dbdma2.c19
-rw-r--r--sound/soc/au1x/psc-ac97.c20
-rw-r--r--sound/soc/au1x/psc-i2s.c21
-rw-r--r--sound/soc/au1x/psc.h3
5 files changed, 30 insertions, 68 deletions
diff --git a/sound/soc/au1x/db1200.c b/sound/soc/au1x/db1200.c
index cdf7be1b9b91..8780c90107fc 100644
--- a/sound/soc/au1x/db1200.c
+++ b/sound/soc/au1x/db1200.c
@@ -19,7 +19,6 @@
19#include <asm/mach-au1x00/au1xxx_dbdma.h> 19#include <asm/mach-au1x00/au1xxx_dbdma.h>
20#include <asm/mach-db1x00/bcsr.h> 20#include <asm/mach-db1x00/bcsr.h>
21 21
22#include "../codecs/ac97.h"
23#include "../codecs/wm8731.h" 22#include "../codecs/wm8731.h"
24#include "psc.h" 23#include "psc.h"
25 24
@@ -28,20 +27,16 @@
28static struct snd_soc_dai_link db1200_ac97_dai = { 27static struct snd_soc_dai_link db1200_ac97_dai = {
29 .name = "AC97", 28 .name = "AC97",
30 .stream_name = "AC97 HiFi", 29 .stream_name = "AC97 HiFi",
31 .cpu_dai = &au1xpsc_ac97_dai, 30 .cpu_dai_name = "au1xpsc-ac97",
32 .codec_dai = &ac97_dai, 31 .codec_dai_name = "ac97-hifi",
32 .platform_name = "au1xpsc-pcm-audio",
33 .codec_name = "ac97-codec",
33}; 34};
34 35
35static struct snd_soc_card db1200_ac97_machine = { 36static struct snd_soc_card db1200_ac97_machine = {
36 .name = "DB1200_AC97", 37 .name = "DB1200_AC97",
37 .dai_link = &db1200_ac97_dai, 38 .dai_link = &db1200_ac97_dai,
38 .num_links = 1, 39 .num_links = 1,
39 .platform = &au1xpsc_soc_platform,
40};
41
42static struct snd_soc_device db1200_ac97_devdata = {
43 .card = &db1200_ac97_machine,
44 .codec_dev = &soc_codec_dev_ac97,
45}; 40};
46 41
47/*------------------------- I2S PART ---------------------------*/ 42/*------------------------- I2S PART ---------------------------*/
@@ -49,8 +44,8 @@ static struct snd_soc_device db1200_ac97_devdata = {
49static int db1200_i2s_startup(struct snd_pcm_substream *substream) 44static int db1200_i2s_startup(struct snd_pcm_substream *substream)
50{ 45{
51 struct snd_soc_pcm_runtime *rtd = substream->private_data; 46 struct snd_soc_pcm_runtime *rtd = substream->private_data;
52 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 47 struct snd_soc_dai *codec_dai = rtd->codec_dai;
53 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 48 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
54 int ret; 49 int ret;
55 50
56 /* WM8731 has its own 12MHz crystal */ 51 /* WM8731 has its own 12MHz crystal */
@@ -80,8 +75,10 @@ static struct snd_soc_ops db1200_i2s_wm8731_ops = {
80static struct snd_soc_dai_link db1200_i2s_dai = { 75static struct snd_soc_dai_link db1200_i2s_dai = {
81 .name = "WM8731", 76 .name = "WM8731",
82 .stream_name = "WM8731 PCM", 77 .stream_name = "WM8731 PCM",
83 .cpu_dai = &au1xpsc_i2s_dai, 78 .cpu_dai_name = "au1xpsc",
84 .codec_dai = &wm8731_dai, 79 .codec_dai_name = "wm8731-hifi"
80 .platform_name = "au1xpsc-pcm-audio",
81 .codec_name = "wm8731-codec.0-001a",
85 .ops = &db1200_i2s_wm8731_ops, 82 .ops = &db1200_i2s_wm8731_ops,
86}; 83};
87 84
@@ -89,12 +86,6 @@ static struct snd_soc_card db1200_i2s_machine = {
89 .name = "DB1200_I2S", 86 .name = "DB1200_I2S",
90 .dai_link = &db1200_i2s_dai, 87 .dai_link = &db1200_i2s_dai,
91 .num_links = 1, 88 .num_links = 1,
92 .platform = &au1xpsc_soc_platform,
93};
94
95static struct snd_soc_device db1200_i2s_devdata = {
96 .card = &db1200_i2s_machine,
97 .codec_dev = &soc_codec_dev_wm8731,
98}; 89};
99 90
100/*------------------------- COMMON PART ---------------------------*/ 91/*------------------------- COMMON PART ---------------------------*/
@@ -112,12 +103,10 @@ static int __init db1200_audio_load(void)
112 103
113 /* DB1200 board setup set PSC1MUX to preferred audio device */ 104 /* DB1200 board setup set PSC1MUX to preferred audio device */
114 if (bcsr_read(BCSR_RESETS) & BCSR_RESETS_PSC1MUX) 105 if (bcsr_read(BCSR_RESETS) & BCSR_RESETS_PSC1MUX)
115 platform_set_drvdata(db1200_asoc_dev, &db1200_i2s_devdata); 106 platform_set_drvdata(db1200_asoc_dev, &db1200_i2s_machine);
116 else 107 else
117 platform_set_drvdata(db1200_asoc_dev, &db1200_ac97_devdata); 108 platform_set_drvdata(db1200_asoc_dev, &db1200_ac97_machine);
118 109
119 db1200_ac97_devdata.dev = &db1200_asoc_dev->dev;
120 db1200_i2s_devdata.dev = &db1200_asoc_dev->dev;
121 ret = platform_device_add(db1200_asoc_dev); 110 ret = platform_device_add(db1200_asoc_dev);
122 111
123 if (ret) { 112 if (ret) {
diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c
index 6d9f4c624949..00fdb9cbfc2d 100644
--- a/sound/soc/au1x/dbdma2.c
+++ b/sound/soc/au1x/dbdma2.c
@@ -329,7 +329,7 @@ static int au1xpsc_pcm_new(struct snd_card *card,
329 return 0; 329 return 0;
330} 330}
331 331
332static int au1xpsc_pcm_probe(struct platform_device *pdev) 332static int au1xpsc_pcm_probe(struct snd_soc_platform *platform)
333{ 333{
334 if (!au1xpsc_audio_pcmdma[PCM_TX] || !au1xpsc_audio_pcmdma[PCM_RX]) 334 if (!au1xpsc_audio_pcmdma[PCM_TX] || !au1xpsc_audio_pcmdma[PCM_RX])
335 return -ENODEV; 335 return -ENODEV;
@@ -337,17 +337,10 @@ static int au1xpsc_pcm_probe(struct platform_device *pdev)
337 return 0; 337 return 0;
338} 338}
339 339
340static int au1xpsc_pcm_remove(struct platform_device *pdev)
341{
342 return 0;
343}
344
345/* au1xpsc audio platform */ 340/* au1xpsc audio platform */
346struct snd_soc_platform au1xpsc_soc_platform = { 341struct snd_soc_platform_driver au1xpsc_soc_platform = {
347 .name = "au1xpsc-pcm-dbdma",
348 .probe = au1xpsc_pcm_probe, 342 .probe = au1xpsc_pcm_probe,
349 .remove = au1xpsc_pcm_remove, 343 .ops = &au1xpsc_pcm_ops,
350 .pcm_ops = &au1xpsc_pcm_ops,
351 .pcm_new = au1xpsc_pcm_new, 344 .pcm_new = au1xpsc_pcm_new,
352 .pcm_free = au1xpsc_pcm_free_dma_buffers, 345 .pcm_free = au1xpsc_pcm_free_dma_buffers,
353}; 346};
@@ -387,7 +380,7 @@ static int __devinit au1xpsc_pcm_drvprobe(struct platform_device *pdev)
387 } 380 }
388 (au1xpsc_audio_pcmdma[PCM_RX])->ddma_id = r->start; 381 (au1xpsc_audio_pcmdma[PCM_RX])->ddma_id = r->start;
389 382
390 ret = snd_soc_register_platform(&au1xpsc_soc_platform); 383 ret = snd_soc_register_platform(&pdev->dev, &au1xpsc_soc_platform);
391 if (!ret) 384 if (!ret)
392 return ret; 385 return ret;
393 386
@@ -404,7 +397,7 @@ static int __devexit au1xpsc_pcm_drvremove(struct platform_device *pdev)
404{ 397{
405 int i; 398 int i;
406 399
407 snd_soc_unregister_platform(&au1xpsc_soc_platform); 400 snd_soc_unregister_platform(&pdev->dev);
408 401
409 for (i = 0; i < 2; i++) { 402 for (i = 0; i < 2; i++) {
410 if (au1xpsc_audio_pcmdma[i]) { 403 if (au1xpsc_audio_pcmdma[i]) {
@@ -419,7 +412,7 @@ static int __devexit au1xpsc_pcm_drvremove(struct platform_device *pdev)
419 412
420static struct platform_driver au1xpsc_pcm_driver = { 413static struct platform_driver au1xpsc_pcm_driver = {
421 .driver = { 414 .driver = {
422 .name = "au1xpsc-pcm", 415 .name = "au1xpsc-pcm-audio",
423 .owner = THIS_MODULE, 416 .owner = THIS_MODULE,
424 }, 417 },
425 .probe = au1xpsc_pcm_drvprobe, 418 .probe = au1xpsc_pcm_drvprobe,
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c
index d14a5a91a465..6a9516cbe424 100644
--- a/sound/soc/au1x/psc-ac97.c
+++ b/sound/soc/au1x/psc-ac97.c
@@ -315,27 +315,19 @@ static int au1xpsc_ac97_trigger(struct snd_pcm_substream *substream,
315 return ret; 315 return ret;
316} 316}
317 317
318static int au1xpsc_ac97_probe(struct platform_device *pdev, 318static int au1xpsc_ac97_probe(struct snd_soc_dai *dai)
319 struct snd_soc_dai *dai)
320{ 319{
321 return au1xpsc_ac97_workdata ? 0 : -ENODEV; 320 return au1xpsc_ac97_workdata ? 0 : -ENODEV;
322} 321}
323 322
324static void au1xpsc_ac97_remove(struct platform_device *pdev,
325 struct snd_soc_dai *dai)
326{
327}
328
329static struct snd_soc_dai_ops au1xpsc_ac97_dai_ops = { 323static struct snd_soc_dai_ops au1xpsc_ac97_dai_ops = {
330 .trigger = au1xpsc_ac97_trigger, 324 .trigger = au1xpsc_ac97_trigger,
331 .hw_params = au1xpsc_ac97_hw_params, 325 .hw_params = au1xpsc_ac97_hw_params,
332}; 326};
333 327
334struct snd_soc_dai au1xpsc_ac97_dai = { 328struct snd_soc_dai_driver au1xpsc_ac97_dai = {
335 .name = "au1xpsc_ac97",
336 .ac97_control = 1, 329 .ac97_control = 1,
337 .probe = au1xpsc_ac97_probe, 330 .probe = au1xpsc_ac97_probe,
338 .remove = au1xpsc_ac97_remove,
339 .playback = { 331 .playback = {
340 .rates = AC97_RATES, 332 .rates = AC97_RATES,
341 .formats = AC97_FMTS, 333 .formats = AC97_FMTS,
@@ -395,7 +387,7 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev)
395 au_writel(PSC_SEL_PS_AC97MODE | sel, PSC_SEL(wd)); 387 au_writel(PSC_SEL_PS_AC97MODE | sel, PSC_SEL(wd));
396 au_sync(); 388 au_sync();
397 389
398 ret = snd_soc_register_dai(&au1xpsc_ac97_dai); 390 ret = snd_soc_register_dai(&pdev->dev, &au1xpsc_ac97_dai);
399 if (ret) 391 if (ret)
400 goto out1; 392 goto out1;
401 393
@@ -406,7 +398,7 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev)
406 return 0; 398 return 0;
407 } 399 }
408 400
409 snd_soc_unregister_dai(&au1xpsc_ac97_dai); 401 snd_soc_unregister_dai(&pdev->dev);
410out1: 402out1:
411 release_mem_region(r->start, resource_size(r)); 403 release_mem_region(r->start, resource_size(r));
412out0: 404out0:
@@ -422,7 +414,7 @@ static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev)
422 if (wd->dmapd) 414 if (wd->dmapd)
423 au1xpsc_pcm_destroy(wd->dmapd); 415 au1xpsc_pcm_destroy(wd->dmapd);
424 416
425 snd_soc_unregister_dai(&au1xpsc_ac97_dai); 417 snd_soc_unregister_dai(&pdev->dev);
426 418
427 /* disable PSC completely */ 419 /* disable PSC completely */
428 au_writel(0, AC97_CFG(wd)); 420 au_writel(0, AC97_CFG(wd));
@@ -485,7 +477,7 @@ static struct dev_pm_ops au1xpscac97_pmops = {
485 477
486static struct platform_driver au1xpsc_ac97_driver = { 478static struct platform_driver au1xpsc_ac97_driver = {
487 .driver = { 479 .driver = {
488 .name = "au1xpsc_ac97", 480 .name = "au1xpsc-ac97",
489 .owner = THIS_MODULE, 481 .owner = THIS_MODULE,
490 .pm = AU1XPSCAC97_PMOPS, 482 .pm = AU1XPSCAC97_PMOPS,
491 }, 483 },
diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c
index 6083fe7799fa..94e560a8756d 100644
--- a/sound/soc/au1x/psc-i2s.c
+++ b/sound/soc/au1x/psc-i2s.c
@@ -263,27 +263,19 @@ static int au1xpsc_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
263 return ret; 263 return ret;
264} 264}
265 265
266static int au1xpsc_i2s_probe(struct platform_device *pdev, 266static int au1xpsc_i2s_probe(struct snd_soc_dai *dai)
267 struct snd_soc_dai *dai)
268{ 267{
269 return au1xpsc_i2s_workdata ? 0 : -ENODEV; 268 return au1xpsc_i2s_workdata ? 0 : -ENODEV;
270} 269}
271 270
272static void au1xpsc_i2s_remove(struct platform_device *pdev,
273 struct snd_soc_dai *dai)
274{
275}
276
277static struct snd_soc_dai_ops au1xpsc_i2s_dai_ops = { 271static struct snd_soc_dai_ops au1xpsc_i2s_dai_ops = {
278 .trigger = au1xpsc_i2s_trigger, 272 .trigger = au1xpsc_i2s_trigger,
279 .hw_params = au1xpsc_i2s_hw_params, 273 .hw_params = au1xpsc_i2s_hw_params,
280 .set_fmt = au1xpsc_i2s_set_fmt, 274 .set_fmt = au1xpsc_i2s_set_fmt,
281}; 275};
282 276
283struct snd_soc_dai au1xpsc_i2s_dai = { 277static struct snd_soc_dai_driver au1xpsc_i2s_dai = {
284 .name = "au1xpsc_i2s",
285 .probe = au1xpsc_i2s_probe, 278 .probe = au1xpsc_i2s_probe,
286 .remove = au1xpsc_i2s_remove,
287 .playback = { 279 .playback = {
288 .rates = AU1XPSC_I2S_RATES, 280 .rates = AU1XPSC_I2S_RATES,
289 .formats = AU1XPSC_I2S_FMTS, 281 .formats = AU1XPSC_I2S_FMTS,
@@ -298,7 +290,6 @@ struct snd_soc_dai au1xpsc_i2s_dai = {
298 }, 290 },
299 .ops = &au1xpsc_i2s_dai_ops, 291 .ops = &au1xpsc_i2s_dai_ops,
300}; 292};
301EXPORT_SYMBOL(au1xpsc_i2s_dai);
302 293
303static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev) 294static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev)
304{ 295{
@@ -346,7 +337,7 @@ static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev)
346 * time out. 337 * time out.
347 */ 338 */
348 339
349 ret = snd_soc_register_dai(&au1xpsc_i2s_dai); 340 ret = snd_soc_register_dai(&pdev->dev, &au1xpsc_i2s_dai);
350 if (ret) 341 if (ret)
351 goto out1; 342 goto out1;
352 343
@@ -358,7 +349,7 @@ static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev)
358 return 0; 349 return 0;
359 } 350 }
360 351
361 snd_soc_unregister_dai(&au1xpsc_i2s_dai); 352 snd_soc_unregister_dai(&pdev->dev);
362out1: 353out1:
363 release_mem_region(r->start, resource_size(r)); 354 release_mem_region(r->start, resource_size(r));
364out0: 355out0:
@@ -374,7 +365,7 @@ static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev)
374 if (wd->dmapd) 365 if (wd->dmapd)
375 au1xpsc_pcm_destroy(wd->dmapd); 366 au1xpsc_pcm_destroy(wd->dmapd);
376 367
377 snd_soc_unregister_dai(&au1xpsc_i2s_dai); 368 snd_soc_unregister_dai(&pdev->dev);
378 369
379 au_writel(0, I2S_CFG(wd)); 370 au_writel(0, I2S_CFG(wd));
380 au_sync(); 371 au_sync();
@@ -436,7 +427,7 @@ static struct dev_pm_ops au1xpsci2s_pmops = {
436 427
437static struct platform_driver au1xpsc_i2s_driver = { 428static struct platform_driver au1xpsc_i2s_driver = {
438 .driver = { 429 .driver = {
439 .name = "au1xpsc_i2s", 430 .name = "au1xpsc",
440 .owner = THIS_MODULE, 431 .owner = THIS_MODULE,
441 .pm = AU1XPSCI2S_PMOPS, 432 .pm = AU1XPSCI2S_PMOPS,
442 }, 433 },
diff --git a/sound/soc/au1x/psc.h b/sound/soc/au1x/psc.h
index 093775d4dc3e..f281443fd52f 100644
--- a/sound/soc/au1x/psc.h
+++ b/sound/soc/au1x/psc.h
@@ -16,9 +16,6 @@
16#ifndef _AU1X_PCM_H 16#ifndef _AU1X_PCM_H
17#define _AU1X_PCM_H 17#define _AU1X_PCM_H
18 18
19extern struct snd_soc_dai au1xpsc_ac97_dai;
20extern struct snd_soc_dai au1xpsc_i2s_dai;
21extern struct snd_soc_platform au1xpsc_soc_platform;
22extern struct snd_ac97_bus_ops soc_ac97_ops; 19extern struct snd_ac97_bus_ops soc_ac97_ops;
23 20
24/* DBDMA helpers */ 21/* DBDMA helpers */