aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/atmel
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/atmel')
-rw-r--r--sound/soc/atmel/Kconfig5
-rw-r--r--sound/soc/atmel/atmel-pcm.c59
-rw-r--r--sound/soc/atmel/atmel-pcm.h3
-rw-r--r--sound/soc/atmel/atmel_ssc_dai.c151
-rw-r--r--sound/soc/atmel/atmel_ssc_dai.h3
-rw-r--r--sound/soc/atmel/playpaq_wm8510.c77
-rw-r--r--sound/soc/atmel/sam9g20_wm8731.c86
-rw-r--r--sound/soc/atmel/snd-soc-afeb9260.c50
8 files changed, 232 insertions, 202 deletions
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
index e720d5e6f04c..bee3c94f58b0 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -16,7 +16,8 @@ config SND_ATMEL_SOC_SSC
16 16
17config SND_AT91_SOC_SAM9G20_WM8731 17config SND_AT91_SOC_SAM9G20_WM8731
18 tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board" 18 tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board"
19 depends on ATMEL_SSC && ARCH_AT91SAM9G20 && SND_ATMEL_SOC 19 depends on ATMEL_SSC && ARCH_AT91SAM9G20 && SND_ATMEL_SOC && \
20 AT91_PROGRAMMABLE_CLOCKS
20 select SND_ATMEL_SOC_SSC 21 select SND_ATMEL_SOC_SSC
21 select SND_SOC_WM8731 22 select SND_SOC_WM8731
22 help 23 help
@@ -25,7 +26,7 @@ config SND_AT91_SOC_SAM9G20_WM8731
25 26
26config SND_AT32_SOC_PLAYPAQ 27config SND_AT32_SOC_PLAYPAQ
27 tristate "SoC Audio support for PlayPaq with WM8510" 28 tristate "SoC Audio support for PlayPaq with WM8510"
28 depends on SND_ATMEL_SOC && BOARD_PLAYPAQ 29 depends on SND_ATMEL_SOC && BOARD_PLAYPAQ && AT91_PROGRAMMABLE_CLOCKS
29 select SND_ATMEL_SOC_SSC 30 select SND_ATMEL_SOC_SSC
30 select SND_SOC_WM8510 31 select SND_SOC_WM8510
31 help 32 help
diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c
index dc5249fba85c..d0e75323ec19 100644
--- a/sound/soc/atmel/atmel-pcm.c
+++ b/sound/soc/atmel/atmel-pcm.c
@@ -179,7 +179,7 @@ static int atmel_pcm_hw_params(struct snd_pcm_substream *substream,
179 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); 179 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
180 runtime->dma_bytes = params_buffer_bytes(params); 180 runtime->dma_bytes = params_buffer_bytes(params);
181 181
182 prtd->params = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream); 182 prtd->params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
183 prtd->params->dma_intr_handler = atmel_pcm_dma_irq; 183 prtd->params->dma_intr_handler = atmel_pcm_dma_irq;
184 184
185 prtd->dma_buffer = runtime->dma_addr; 185 prtd->dma_buffer = runtime->dma_addr;
@@ -374,14 +374,14 @@ static int atmel_pcm_new(struct snd_card *card,
374 if (!card->dev->coherent_dma_mask) 374 if (!card->dev->coherent_dma_mask)
375 card->dev->coherent_dma_mask = 0xffffffff; 375 card->dev->coherent_dma_mask = 0xffffffff;
376 376
377 if (dai->playback.channels_min) { 377 if (dai->driver->playback.channels_min) {
378 ret = atmel_pcm_preallocate_dma_buffer(pcm, 378 ret = atmel_pcm_preallocate_dma_buffer(pcm,
379 SNDRV_PCM_STREAM_PLAYBACK); 379 SNDRV_PCM_STREAM_PLAYBACK);
380 if (ret) 380 if (ret)
381 goto out; 381 goto out;
382 } 382 }
383 383
384 if (dai->capture.channels_min) { 384 if (dai->driver->capture.channels_min) {
385 pr_debug("at32-pcm:" 385 pr_debug("at32-pcm:"
386 "Allocating PCM capture DMA buffer\n"); 386 "Allocating PCM capture DMA buffer\n");
387 ret = atmel_pcm_preallocate_dma_buffer(pcm, 387 ret = atmel_pcm_preallocate_dma_buffer(pcm,
@@ -414,12 +414,9 @@ static void atmel_pcm_free_dma_buffers(struct snd_pcm *pcm)
414} 414}
415 415
416#ifdef CONFIG_PM 416#ifdef CONFIG_PM
417static int atmel_pcm_suspend(struct snd_soc_dai_link *dai_link) 417static int atmel_pcm_suspend(struct snd_soc_dai *dai)
418{ 418{
419 struct snd_pcm *pcm = dai_link->pcm; 419 struct snd_pcm_runtime *runtime = dai->runtime;
420 struct snd_pcm_str *stream = &pcm->streams[0];
421 struct snd_pcm_substream *substream = stream->substream;
422 struct snd_pcm_runtime *runtime = substream->runtime;
423 struct atmel_runtime_data *prtd; 420 struct atmel_runtime_data *prtd;
424 struct atmel_pcm_dma_params *params; 421 struct atmel_pcm_dma_params *params;
425 422
@@ -441,12 +438,9 @@ static int atmel_pcm_suspend(struct snd_soc_dai_link *dai_link)
441 return 0; 438 return 0;
442} 439}
443 440
444static int atmel_pcm_resume(struct snd_soc_dai_link *dai_link) 441static int atmel_pcm_resume(struct snd_soc_dai *dai)
445{ 442{
446 struct snd_pcm *pcm = dai_link->pcm; 443 struct snd_pcm_runtime *runtime = dai->runtime;
447 struct snd_pcm_str *stream = &pcm->streams[0];
448 struct snd_pcm_substream *substream = stream->substream;
449 struct snd_pcm_runtime *runtime = substream->runtime;
450 struct atmel_runtime_data *prtd; 444 struct atmel_runtime_data *prtd;
451 struct atmel_pcm_dma_params *params; 445 struct atmel_pcm_dma_params *params;
452 446
@@ -470,27 +464,46 @@ static int atmel_pcm_resume(struct snd_soc_dai_link *dai_link)
470#define atmel_pcm_resume NULL 464#define atmel_pcm_resume NULL
471#endif 465#endif
472 466
473struct snd_soc_platform atmel_soc_platform = { 467static struct snd_soc_platform_driver atmel_soc_platform = {
474 .name = "atmel-audio", 468 .ops = &atmel_pcm_ops,
475 .pcm_ops = &atmel_pcm_ops,
476 .pcm_new = atmel_pcm_new, 469 .pcm_new = atmel_pcm_new,
477 .pcm_free = atmel_pcm_free_dma_buffers, 470 .pcm_free = atmel_pcm_free_dma_buffers,
478 .suspend = atmel_pcm_suspend, 471 .suspend = atmel_pcm_suspend,
479 .resume = atmel_pcm_resume, 472 .resume = atmel_pcm_resume,
480}; 473};
481EXPORT_SYMBOL_GPL(atmel_soc_platform);
482 474
483static int __init atmel_pcm_modinit(void) 475static int __devinit atmel_soc_platform_probe(struct platform_device *pdev)
476{
477 return snd_soc_register_platform(&pdev->dev, &atmel_soc_platform);
478}
479
480static int __devexit atmel_soc_platform_remove(struct platform_device *pdev)
481{
482 snd_soc_unregister_platform(&pdev->dev);
483 return 0;
484}
485
486static struct platform_driver atmel_pcm_driver = {
487 .driver = {
488 .name = "atmel-pcm-audio",
489 .owner = THIS_MODULE,
490 },
491
492 .probe = atmel_soc_platform_probe,
493 .remove = __devexit_p(atmel_soc_platform_remove),
494};
495
496static int __init snd_atmel_pcm_init(void)
484{ 497{
485 return snd_soc_register_platform(&atmel_soc_platform); 498 return platform_driver_register(&atmel_pcm_driver);
486} 499}
487module_init(atmel_pcm_modinit); 500module_init(snd_atmel_pcm_init);
488 501
489static void __exit atmel_pcm_modexit(void) 502static void __exit snd_atmel_pcm_exit(void)
490{ 503{
491 snd_soc_unregister_platform(&atmel_soc_platform); 504 platform_driver_unregister(&atmel_pcm_driver);
492} 505}
493module_exit(atmel_pcm_modexit); 506module_exit(snd_atmel_pcm_exit);
494 507
495MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>"); 508MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>");
496MODULE_DESCRIPTION("Atmel PCM module"); 509MODULE_DESCRIPTION("Atmel PCM module");
diff --git a/sound/soc/atmel/atmel-pcm.h b/sound/soc/atmel/atmel-pcm.h
index ec9b2824b663..2597329302e7 100644
--- a/sound/soc/atmel/atmel-pcm.h
+++ b/sound/soc/atmel/atmel-pcm.h
@@ -74,9 +74,6 @@ struct atmel_pcm_dma_params {
74 void (*dma_intr_handler)(u32, struct snd_pcm_substream *); 74 void (*dma_intr_handler)(u32, struct snd_pcm_substream *);
75}; 75};
76 76
77extern struct snd_soc_platform atmel_soc_platform;
78
79
80/* 77/*
81 * SSC register access (since ssc_writel() / ssc_readl() require literal name) 78 * SSC register access (since ssc_writel() / ssc_readl() require literal name)
82 */ 79 */
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index c85844d4845b..eda955b15834 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -205,8 +205,7 @@ static irqreturn_t atmel_ssc_interrupt(int irq, void *dev_id)
205static int atmel_ssc_startup(struct snd_pcm_substream *substream, 205static int atmel_ssc_startup(struct snd_pcm_substream *substream,
206 struct snd_soc_dai *dai) 206 struct snd_soc_dai *dai)
207{ 207{
208 struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); 208 struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
209 struct atmel_ssc_info *ssc_p = &ssc_info[rtd->dai->cpu_dai->id];
210 int dir_mask; 209 int dir_mask;
211 210
212 pr_debug("atmel_ssc_startup: SSC_SR=0x%u\n", 211 pr_debug("atmel_ssc_startup: SSC_SR=0x%u\n",
@@ -235,8 +234,7 @@ static int atmel_ssc_startup(struct snd_pcm_substream *substream,
235static void atmel_ssc_shutdown(struct snd_pcm_substream *substream, 234static void atmel_ssc_shutdown(struct snd_pcm_substream *substream,
236 struct snd_soc_dai *dai) 235 struct snd_soc_dai *dai)
237{ 236{
238 struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); 237 struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
239 struct atmel_ssc_info *ssc_p = &ssc_info[rtd->dai->cpu_dai->id];
240 struct atmel_pcm_dma_params *dma_params; 238 struct atmel_pcm_dma_params *dma_params;
241 int dir, dir_mask; 239 int dir, dir_mask;
242 240
@@ -338,7 +336,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
338 struct snd_soc_dai *dai) 336 struct snd_soc_dai *dai)
339{ 337{
340 struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); 338 struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
341 int id = rtd->dai->cpu_dai->id; 339 int id = dai->id;
342 struct atmel_ssc_info *ssc_p = &ssc_info[id]; 340 struct atmel_ssc_info *ssc_p = &ssc_info[id];
343 struct atmel_pcm_dma_params *dma_params; 341 struct atmel_pcm_dma_params *dma_params;
344 int dir, channels, bits; 342 int dir, channels, bits;
@@ -368,7 +366,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
368 * function. It should not be used for other purposes 366 * function. It should not be used for other purposes
369 * as it is common to all substreams. 367 * as it is common to all substreams.
370 */ 368 */
371 snd_soc_dai_set_dma_data(rtd->dai->cpu_dai, substream, dma_params); 369 snd_soc_dai_set_dma_data(rtd->cpu_dai, substream, dma_params);
372 370
373 channels = params_channels(params); 371 channels = params_channels(params);
374 372
@@ -605,8 +603,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
605static int atmel_ssc_prepare(struct snd_pcm_substream *substream, 603static int atmel_ssc_prepare(struct snd_pcm_substream *substream,
606 struct snd_soc_dai *dai) 604 struct snd_soc_dai *dai)
607{ 605{
608 struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); 606 struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
609 struct atmel_ssc_info *ssc_p = &ssc_info[rtd->dai->cpu_dai->id];
610 struct atmel_pcm_dma_params *dma_params; 607 struct atmel_pcm_dma_params *dma_params;
611 int dir; 608 int dir;
612 609
@@ -675,7 +672,7 @@ static int atmel_ssc_resume(struct snd_soc_dai *cpu_dai)
675 /* re-enable interrupts */ 672 /* re-enable interrupts */
676 ssc_writel(ssc_p->ssc->regs, IER, ssc_p->ssc_state.ssc_imr); 673 ssc_writel(ssc_p->ssc->regs, IER, ssc_p->ssc_state.ssc_imr);
677 674
678 /* Re-enable recieve and transmit as appropriate */ 675 /* Re-enable receive and transmit as appropriate */
679 cr = 0; 676 cr = 0;
680 cr |= 677 cr |=
681 (ssc_p->ssc_state.ssc_sr & SSC_BIT(SR_RXEN)) ? SSC_BIT(CR_RXEN) : 0; 678 (ssc_p->ssc_state.ssc_sr & SSC_BIT(SR_RXEN)) ? SSC_BIT(CR_RXEN) : 0;
@@ -690,6 +687,32 @@ static int atmel_ssc_resume(struct snd_soc_dai *cpu_dai)
690# define atmel_ssc_resume NULL 687# define atmel_ssc_resume NULL
691#endif /* CONFIG_PM */ 688#endif /* CONFIG_PM */
692 689
690static int atmel_ssc_probe(struct snd_soc_dai *dai)
691{
692 struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
693 int ret = 0;
694
695 snd_soc_dai_set_drvdata(dai, ssc_p);
696
697 /*
698 * Request SSC device
699 */
700 ssc_p->ssc = ssc_request(dai->id);
701 if (IS_ERR(ssc_p->ssc)) {
702 printk(KERN_ERR "ASoC: Failed to request SSC %d\n", dai->id);
703 ret = PTR_ERR(ssc_p->ssc);
704 }
705
706 return ret;
707}
708
709static int atmel_ssc_remove(struct snd_soc_dai *dai)
710{
711 struct atmel_ssc_info *ssc_p = snd_soc_dai_get_drvdata(dai);
712
713 ssc_free(ssc_p->ssc);
714 return 0;
715}
693 716
694#define ATMEL_SSC_RATES (SNDRV_PCM_RATE_8000_96000) 717#define ATMEL_SSC_RATES (SNDRV_PCM_RATE_8000_96000)
695 718
@@ -705,9 +728,11 @@ static struct snd_soc_dai_ops atmel_ssc_dai_ops = {
705 .set_clkdiv = atmel_ssc_set_dai_clkdiv, 728 .set_clkdiv = atmel_ssc_set_dai_clkdiv,
706}; 729};
707 730
708struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = { 731static struct snd_soc_dai_driver atmel_ssc_dai[NUM_SSC_DEVICES] = {
709 { .name = "atmel-ssc0", 732 {
710 .id = 0, 733 .name = "atmel-ssc-dai.0",
734 .probe = atmel_ssc_probe,
735 .remove = atmel_ssc_remove,
711 .suspend = atmel_ssc_suspend, 736 .suspend = atmel_ssc_suspend,
712 .resume = atmel_ssc_resume, 737 .resume = atmel_ssc_resume,
713 .playback = { 738 .playback = {
@@ -721,11 +746,12 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
721 .rates = ATMEL_SSC_RATES, 746 .rates = ATMEL_SSC_RATES,
722 .formats = ATMEL_SSC_FORMATS,}, 747 .formats = ATMEL_SSC_FORMATS,},
723 .ops = &atmel_ssc_dai_ops, 748 .ops = &atmel_ssc_dai_ops,
724 .private_data = &ssc_info[0],
725 }, 749 },
726#if NUM_SSC_DEVICES == 3 750#if NUM_SSC_DEVICES == 3
727 { .name = "atmel-ssc1", 751 {
728 .id = 1, 752 .name = "atmel-ssc-dai.1",
753 .probe = atmel_ssc_probe,
754 .remove = atmel_ssc_remove,
729 .suspend = atmel_ssc_suspend, 755 .suspend = atmel_ssc_suspend,
730 .resume = atmel_ssc_resume, 756 .resume = atmel_ssc_resume,
731 .playback = { 757 .playback = {
@@ -739,10 +765,11 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
739 .rates = ATMEL_SSC_RATES, 765 .rates = ATMEL_SSC_RATES,
740 .formats = ATMEL_SSC_FORMATS,}, 766 .formats = ATMEL_SSC_FORMATS,},
741 .ops = &atmel_ssc_dai_ops, 767 .ops = &atmel_ssc_dai_ops,
742 .private_data = &ssc_info[1],
743 }, 768 },
744 { .name = "atmel-ssc2", 769 {
745 .id = 2, 770 .name = "atmel-ssc-dai.2",
771 .probe = atmel_ssc_probe,
772 .remove = atmel_ssc_remove,
746 .suspend = atmel_ssc_suspend, 773 .suspend = atmel_ssc_suspend,
747 .resume = atmel_ssc_resume, 774 .resume = atmel_ssc_resume,
748 .playback = { 775 .playback = {
@@ -756,23 +783,95 @@ struct snd_soc_dai atmel_ssc_dai[NUM_SSC_DEVICES] = {
756 .rates = ATMEL_SSC_RATES, 783 .rates = ATMEL_SSC_RATES,
757 .formats = ATMEL_SSC_FORMATS,}, 784 .formats = ATMEL_SSC_FORMATS,},
758 .ops = &atmel_ssc_dai_ops, 785 .ops = &atmel_ssc_dai_ops,
759 .private_data = &ssc_info[2],
760 }, 786 },
761#endif 787#endif
762}; 788};
763EXPORT_SYMBOL_GPL(atmel_ssc_dai);
764 789
765static int __init atmel_ssc_modinit(void) 790static __devinit int asoc_ssc_probe(struct platform_device *pdev)
791{
792 BUG_ON(pdev->id < 0);
793 BUG_ON(pdev->id >= ARRAY_SIZE(atmel_ssc_dai));
794 return snd_soc_register_dai(&pdev->dev, &atmel_ssc_dai[pdev->id]);
795}
796
797static int __devexit asoc_ssc_remove(struct platform_device *pdev)
798{
799 snd_soc_unregister_dai(&pdev->dev);
800 return 0;
801}
802
803static struct platform_driver asoc_ssc_driver = {
804 .driver = {
805 .name = "atmel-ssc-dai",
806 .owner = THIS_MODULE,
807 },
808
809 .probe = asoc_ssc_probe,
810 .remove = __devexit_p(asoc_ssc_remove),
811};
812
813/**
814 * atmel_ssc_set_audio - Allocate the specified SSC for audio use.
815 */
816int atmel_ssc_set_audio(int ssc_id)
817{
818 struct ssc_device *ssc;
819 static struct platform_device *dma_pdev;
820 struct platform_device *ssc_pdev;
821 int ret;
822
823 if (ssc_id < 0 || ssc_id >= ARRAY_SIZE(atmel_ssc_dai))
824 return -EINVAL;
825
826 /* Allocate a dummy device for DMA if we don't have one already */
827 if (!dma_pdev) {
828 dma_pdev = platform_device_alloc("atmel-pcm-audio", -1);
829 if (!dma_pdev)
830 return -ENOMEM;
831
832 ret = platform_device_add(dma_pdev);
833 if (ret < 0) {
834 platform_device_put(dma_pdev);
835 dma_pdev = NULL;
836 return ret;
837 }
838 }
839
840 ssc_pdev = platform_device_alloc("atmel-ssc-dai", ssc_id);
841 if (!ssc_pdev) {
842 ssc_free(ssc);
843 return -ENOMEM;
844 }
845
846 /* If we can grab the SSC briefly to parent the DAI device off it */
847 ssc = ssc_request(ssc_id);
848 if (IS_ERR(ssc))
849 pr_warn("Unable to parent ASoC SSC DAI on SSC: %ld\n",
850 PTR_ERR(ssc));
851 else {
852 ssc_pdev->dev.parent = &(ssc->pdev->dev);
853 ssc_free(ssc);
854 }
855
856 ret = platform_device_add(ssc_pdev);
857 if (ret < 0)
858 platform_device_put(ssc_pdev);
859
860 return ret;
861}
862EXPORT_SYMBOL_GPL(atmel_ssc_set_audio);
863
864static int __init snd_atmel_ssc_init(void)
766{ 865{
767 return snd_soc_register_dais(atmel_ssc_dai, ARRAY_SIZE(atmel_ssc_dai)); 866 return platform_driver_register(&asoc_ssc_driver);
768} 867}
769module_init(atmel_ssc_modinit); 868module_init(snd_atmel_ssc_init);
770 869
771static void __exit atmel_ssc_modexit(void) 870static void __exit snd_atmel_ssc_exit(void)
772{ 871{
773 snd_soc_unregister_dais(atmel_ssc_dai, ARRAY_SIZE(atmel_ssc_dai)); 872 platform_driver_unregister(&asoc_ssc_driver);
774} 873}
775module_exit(atmel_ssc_modexit); 874module_exit(snd_atmel_ssc_exit);
776 875
777/* Module information */ 876/* Module information */
778MODULE_AUTHOR("Sedji Gaouaou, sedji.gaouaou@atmel.com, www.atmel.com"); 877MODULE_AUTHOR("Sedji Gaouaou, sedji.gaouaou@atmel.com, www.atmel.com");
diff --git a/sound/soc/atmel/atmel_ssc_dai.h b/sound/soc/atmel/atmel_ssc_dai.h
index 391135f9c6c1..5d4f0f9b4d9a 100644
--- a/sound/soc/atmel/atmel_ssc_dai.h
+++ b/sound/soc/atmel/atmel_ssc_dai.h
@@ -116,6 +116,7 @@ struct atmel_ssc_info {
116 struct atmel_pcm_dma_params *dma_params[2]; 116 struct atmel_pcm_dma_params *dma_params[2];
117 struct atmel_ssc_state ssc_state; 117 struct atmel_ssc_state ssc_state;
118}; 118};
119extern struct snd_soc_dai atmel_ssc_dai[]; 119
120int atmel_ssc_set_audio(int ssc);
120 121
121#endif /* _AT91_SSC_DAI_H */ 122#endif /* _AT91_SSC_DAI_H */
diff --git a/sound/soc/atmel/playpaq_wm8510.c b/sound/soc/atmel/playpaq_wm8510.c
index 9df4c68ef000..1aac2f4dbcf6 100644
--- a/sound/soc/atmel/playpaq_wm8510.c
+++ b/sound/soc/atmel/playpaq_wm8510.c
@@ -33,7 +33,6 @@
33#include <sound/pcm.h> 33#include <sound/pcm.h>
34#include <sound/pcm_params.h> 34#include <sound/pcm_params.h>
35#include <sound/soc.h> 35#include <sound/soc.h>
36#include <sound/soc-dapm.h>
37 36
38#include <mach/at32ap700x.h> 37#include <mach/at32ap700x.h>
39#include <mach/portmux.h> 38#include <mach/portmux.h>
@@ -83,7 +82,7 @@ static struct ssc_clock_data playpaq_wm8510_calc_ssc_clock(
83 struct snd_pcm_hw_params *params, 82 struct snd_pcm_hw_params *params,
84 struct snd_soc_dai *cpu_dai) 83 struct snd_soc_dai *cpu_dai)
85{ 84{
86 struct at32_ssc_info *ssc_p = cpu_dai->private_data; 85 struct at32_ssc_info *ssc_p = snd_soc_dai_get_drvdata(cpu_dai);
87 struct ssc_device *ssc = ssc_p->ssc; 86 struct ssc_device *ssc = ssc_p->ssc;
88 struct ssc_clock_data cd; 87 struct ssc_clock_data cd;
89 unsigned int rate, width_bits, channels; 88 unsigned int rate, width_bits, channels;
@@ -131,9 +130,9 @@ static int playpaq_wm8510_hw_params(struct snd_pcm_substream *substream,
131 struct snd_pcm_hw_params *params) 130 struct snd_pcm_hw_params *params)
132{ 131{
133 struct snd_soc_pcm_runtime *rtd = substream->private_data; 132 struct snd_soc_pcm_runtime *rtd = substream->private_data;
134 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 133 struct snd_soc_dai *codec_dai = rtd->codec_dai;
135 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 134 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
136 struct at32_ssc_info *ssc_p = cpu_dai->private_data; 135 struct at32_ssc_info *ssc_p = snd_soc_dai_get_drvdata(cpu_dai);
137 struct ssc_device *ssc = ssc_p->ssc; 136 struct ssc_device *ssc = ssc_p->ssc;
138 unsigned int pll_out = 0, bclk = 0, mclk_div = 0; 137 unsigned int pll_out = 0, bclk = 0, mclk_div = 0;
139 int ret; 138 int ret;
@@ -315,34 +314,36 @@ static const struct snd_soc_dapm_route intercon[] = {
315 314
316 315
317 316
318static int playpaq_wm8510_init(struct snd_soc_codec *codec) 317static int playpaq_wm8510_init(struct snd_soc_pcm_runtime *rtd)
319{ 318{
319 struct snd_soc_codec *codec = rtd->codec;
320 struct snd_soc_dapm_context *dapm = &codec->dapm;
320 int i; 321 int i;
321 322
322 /* 323 /*
323 * Add DAPM widgets 324 * Add DAPM widgets
324 */ 325 */
325 for (i = 0; i < ARRAY_SIZE(playpaq_dapm_widgets); i++) 326 for (i = 0; i < ARRAY_SIZE(playpaq_dapm_widgets); i++)
326 snd_soc_dapm_new_control(codec, &playpaq_dapm_widgets[i]); 327 snd_soc_dapm_new_control(dapm, &playpaq_dapm_widgets[i]);
327 328
328 329
329 330
330 /* 331 /*
331 * Setup audio path interconnects 332 * Setup audio path interconnects
332 */ 333 */
333 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 334 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
334 335
335 336
336 337
337 /* always connected pins */ 338 /* always connected pins */
338 snd_soc_dapm_enable_pin(codec, "Int Mic"); 339 snd_soc_dapm_enable_pin(dapm, "Int Mic");
339 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 340 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
340 snd_soc_dapm_sync(codec); 341 snd_soc_dapm_sync(dapm);
341 342
342 343
343 344
344 /* Make CSB show PLL rate */ 345 /* Make CSB show PLL rate */
345 snd_soc_dai_set_clkdiv(codec->dai, WM8510_OPCLKDIV, 346 snd_soc_dai_set_clkdiv(rtd->codec_dai, WM8510_OPCLKDIV,
346 WM8510_OPCLKDIV_1 | 4); 347 WM8510_OPCLKDIV_1 | 4);
347 348
348 return 0; 349 return 0;
@@ -353,8 +354,10 @@ static int playpaq_wm8510_init(struct snd_soc_codec *codec)
353static struct snd_soc_dai_link playpaq_wm8510_dai = { 354static struct snd_soc_dai_link playpaq_wm8510_dai = {
354 .name = "WM8510", 355 .name = "WM8510",
355 .stream_name = "WM8510 PCM", 356 .stream_name = "WM8510 PCM",
356 .cpu_dai = &at32_ssc_dai[0], 357 .cpu_dai_name= "atmel-ssc-dai.0",
357 .codec_dai = &wm8510_dai, 358 .platform_name = "atmel-pcm-audio",
359 .codec_name = "wm8510-codec.0-0x1a",
360 .codec_dai_name = "wm8510-hifi",
358 .init = playpaq_wm8510_init, 361 .init = playpaq_wm8510_init,
359 .ops = &playpaq_wm8510_ops, 362 .ops = &playpaq_wm8510_ops,
360}; 363};
@@ -363,46 +366,16 @@ static struct snd_soc_dai_link playpaq_wm8510_dai = {
363 366
364static struct snd_soc_card snd_soc_playpaq = { 367static struct snd_soc_card snd_soc_playpaq = {
365 .name = "LRS_PlayPaq_WM8510", 368 .name = "LRS_PlayPaq_WM8510",
366 .platform = &at32_soc_platform,
367 .dai_link = &playpaq_wm8510_dai, 369 .dai_link = &playpaq_wm8510_dai,
368 .num_links = 1, 370 .num_links = 1,
369}; 371};
370 372
371
372
373static struct wm8510_setup_data playpaq_wm8510_setup = {
374 .i2c_bus = 0,
375 .i2c_address = 0x1a,
376};
377
378
379
380static struct snd_soc_device playpaq_wm8510_snd_devdata = {
381 .card = &snd_soc_playpaq,
382 .codec_dev = &soc_codec_dev_wm8510,
383 .codec_data = &playpaq_wm8510_setup,
384};
385
386static struct platform_device *playpaq_snd_device; 373static struct platform_device *playpaq_snd_device;
387 374
388 375
389static int __init playpaq_asoc_init(void) 376static int __init playpaq_asoc_init(void)
390{ 377{
391 int ret = 0; 378 int ret = 0;
392 struct at32_ssc_info *ssc_p = playpaq_wm8510_dai.cpu_dai->private_data;
393 struct ssc_device *ssc = NULL;
394
395
396 /*
397 * Request SSC device
398 */
399 ssc = ssc_request(0);
400 if (IS_ERR(ssc)) {
401 ret = PTR_ERR(ssc);
402 goto err_ssc;
403 }
404 ssc_p->ssc = ssc;
405
406 379
407 /* 380 /*
408 * Configure MCLK for WM8510 381 * Configure MCLK for WM8510
@@ -439,8 +412,7 @@ static int __init playpaq_asoc_init(void)
439 goto err_device_alloc; 412 goto err_device_alloc;
440 } 413 }
441 414
442 platform_set_drvdata(playpaq_snd_device, &playpaq_wm8510_snd_devdata); 415 platform_set_drvdata(playpaq_snd_device, &snd_soc_playpaq);
443 playpaq_wm8510_snd_devdata.dev = &playpaq_snd_device->dev;
444 416
445 ret = platform_device_add(playpaq_snd_device); 417 ret = platform_device_add(playpaq_snd_device);
446 if (ret) { 418 if (ret) {
@@ -468,25 +440,12 @@ err_pll0:
468 clk_put(_gclk0); 440 clk_put(_gclk0);
469 _gclk0 = NULL; 441 _gclk0 = NULL;
470 } 442 }
471err_gclk0:
472 ssc_free(ssc);
473err_ssc:
474 return ret; 443 return ret;
475} 444}
476 445
477 446
478static void __exit playpaq_asoc_exit(void) 447static void __exit playpaq_asoc_exit(void)
479{ 448{
480 struct at32_ssc_info *ssc_p = playpaq_wm8510_dai.cpu_dai->private_data;
481 struct ssc_device *ssc;
482
483 if (ssc_p != NULL) {
484 ssc = ssc_p->ssc;
485 if (ssc != NULL)
486 ssc_free(ssc);
487 ssc_p->ssc = NULL;
488 }
489
490 if (_gclk0 != NULL) { 449 if (_gclk0 != NULL) {
491 clk_put(_gclk0); 450 clk_put(_gclk0);
492 _gclk0 = NULL; 451 _gclk0 = NULL;
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index e028744c32ce..95572d290c27 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -44,7 +44,6 @@
44#include <sound/pcm.h> 44#include <sound/pcm.h>
45#include <sound/pcm_params.h> 45#include <sound/pcm_params.h>
46#include <sound/soc.h> 46#include <sound/soc.h>
47#include <sound/soc-dapm.h>
48 47
49#include <asm/mach-types.h> 48#include <asm/mach-types.h>
50#include <mach/hardware.h> 49#include <mach/hardware.h>
@@ -69,8 +68,8 @@ static int at91sam9g20ek_hw_params(struct snd_pcm_substream *substream,
69 struct snd_pcm_hw_params *params) 68 struct snd_pcm_hw_params *params)
70{ 69{
71 struct snd_soc_pcm_runtime *rtd = substream->private_data; 70 struct snd_soc_pcm_runtime *rtd = substream->private_data;
72 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 71 struct snd_soc_dai *codec_dai = rtd->codec_dai;
73 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 72 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
74 int ret; 73 int ret;
75 74
76 /* set codec DAI configuration */ 75 /* set codec DAI configuration */
@@ -136,16 +135,18 @@ static const struct snd_soc_dapm_route intercon[] = {
136/* 135/*
137 * Logic for a wm8731 as connected on a at91sam9g20ek board. 136 * Logic for a wm8731 as connected on a at91sam9g20ek board.
138 */ 137 */
139static int at91sam9g20ek_wm8731_init(struct snd_soc_codec *codec) 138static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd)
140{ 139{
141 struct snd_soc_dai *codec_dai = &codec->dai[0]; 140 struct snd_soc_codec *codec = rtd->codec;
141 struct snd_soc_dai *codec_dai = rtd->codec_dai;
142 struct snd_soc_dapm_context *dapm = &codec->dapm;
142 int ret; 143 int ret;
143 144
144 printk(KERN_DEBUG 145 printk(KERN_DEBUG
145 "at91sam9g20ek_wm8731 " 146 "at91sam9g20ek_wm8731 "
146 ": at91sam9g20ek_wm8731_init() called\n"); 147 ": at91sam9g20ek_wm8731_init() called\n");
147 148
148 ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK, 149 ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_MCLK,
149 MCLK_RATE, SND_SOC_CLOCK_IN); 150 MCLK_RATE, SND_SOC_CLOCK_IN);
150 if (ret < 0) { 151 if (ret < 0) {
151 printk(KERN_ERR "Failed to set WM8731 SYSCLK: %d\n", ret); 152 printk(KERN_ERR "Failed to set WM8731 SYSCLK: %d\n", ret);
@@ -153,25 +154,25 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_codec *codec)
153 } 154 }
154 155
155 /* Add specific widgets */ 156 /* Add specific widgets */
156 snd_soc_dapm_new_controls(codec, at91sam9g20ek_dapm_widgets, 157 snd_soc_dapm_new_controls(dapm, at91sam9g20ek_dapm_widgets,
157 ARRAY_SIZE(at91sam9g20ek_dapm_widgets)); 158 ARRAY_SIZE(at91sam9g20ek_dapm_widgets));
158 /* Set up specific audio path interconnects */ 159 /* Set up specific audio path interconnects */
159 snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); 160 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
160 161
161 /* not connected */ 162 /* not connected */
162 snd_soc_dapm_nc_pin(codec, "RLINEIN"); 163 snd_soc_dapm_nc_pin(dapm, "RLINEIN");
163 snd_soc_dapm_nc_pin(codec, "LLINEIN"); 164 snd_soc_dapm_nc_pin(dapm, "LLINEIN");
164 165
165#ifdef ENABLE_MIC_INPUT 166#ifdef ENABLE_MIC_INPUT
166 snd_soc_dapm_enable_pin(codec, "Int Mic"); 167 snd_soc_dapm_enable_pin(dapm, "Int Mic");
167#else 168#else
168 snd_soc_dapm_nc_pin(codec, "Int Mic"); 169 snd_soc_dapm_nc_pin(dapm, "Int Mic");
169#endif 170#endif
170 171
171 /* always connected */ 172 /* always connected */
172 snd_soc_dapm_enable_pin(codec, "Ext Spk"); 173 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
173 174
174 snd_soc_dapm_sync(codec); 175 snd_soc_dapm_sync(dapm);
175 176
176 return 0; 177 return 0;
177} 178}
@@ -179,37 +180,37 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_codec *codec)
179static struct snd_soc_dai_link at91sam9g20ek_dai = { 180static struct snd_soc_dai_link at91sam9g20ek_dai = {
180 .name = "WM8731", 181 .name = "WM8731",
181 .stream_name = "WM8731 PCM", 182 .stream_name = "WM8731 PCM",
182 .cpu_dai = &atmel_ssc_dai[0], 183 .cpu_dai_name = "atmel-ssc-dai.0",
183 .codec_dai = &wm8731_dai, 184 .codec_dai_name = "wm8731-hifi",
184 .init = at91sam9g20ek_wm8731_init, 185 .init = at91sam9g20ek_wm8731_init,
186 .platform_name = "atmel-pcm-audio",
187 .codec_name = "wm8731.0-001b",
185 .ops = &at91sam9g20ek_ops, 188 .ops = &at91sam9g20ek_ops,
186}; 189};
187 190
188static struct snd_soc_card snd_soc_at91sam9g20ek = { 191static struct snd_soc_card snd_soc_at91sam9g20ek = {
189 .name = "AT91SAMG20-EK", 192 .name = "AT91SAMG20-EK",
190 .platform = &atmel_soc_platform,
191 .dai_link = &at91sam9g20ek_dai, 193 .dai_link = &at91sam9g20ek_dai,
192 .num_links = 1, 194 .num_links = 1,
193 .set_bias_level = at91sam9g20ek_set_bias_level, 195 .set_bias_level = at91sam9g20ek_set_bias_level,
194}; 196};
195 197
196static struct snd_soc_device at91sam9g20ek_snd_devdata = {
197 .card = &snd_soc_at91sam9g20ek,
198 .codec_dev = &soc_codec_dev_wm8731,
199};
200
201static struct platform_device *at91sam9g20ek_snd_device; 198static struct platform_device *at91sam9g20ek_snd_device;
202 199
203static int __init at91sam9g20ek_init(void) 200static int __init at91sam9g20ek_init(void)
204{ 201{
205 struct atmel_ssc_info *ssc_p = at91sam9g20ek_dai.cpu_dai->private_data;
206 struct ssc_device *ssc = NULL;
207 struct clk *pllb; 202 struct clk *pllb;
208 int ret; 203 int ret;
209 204
210 if (!(machine_is_at91sam9g20ek() || machine_is_at91sam9g20ek_2mmc())) 205 if (!(machine_is_at91sam9g20ek() || machine_is_at91sam9g20ek_2mmc()))
211 return -ENODEV; 206 return -ENODEV;
212 207
208 ret = atmel_ssc_set_audio(0);
209 if (ret != 0) {
210 pr_err("Failed to set SSC 0 for audio: %d\n", ret);
211 return ret;
212 }
213
213 /* 214 /*
214 * Codec MCLK is supplied by PCK0 - set it up. 215 * Codec MCLK is supplied by PCK0 - set it up.
215 */ 216 */
@@ -221,9 +222,9 @@ static int __init at91sam9g20ek_init(void)
221 } 222 }
222 223
223 pllb = clk_get(NULL, "pllb"); 224 pllb = clk_get(NULL, "pllb");
224 if (IS_ERR(mclk)) { 225 if (IS_ERR(pllb)) {
225 printk(KERN_ERR "ASoC: Failed to get PLLB\n"); 226 printk(KERN_ERR "ASoC: Failed to get PLLB\n");
226 ret = PTR_ERR(mclk); 227 ret = PTR_ERR(pllb);
227 goto err_mclk; 228 goto err_mclk;
228 } 229 }
229 ret = clk_set_parent(mclk, pllb); 230 ret = clk_set_parent(mclk, pllb);
@@ -235,39 +236,26 @@ static int __init at91sam9g20ek_init(void)
235 236
236 clk_set_rate(mclk, MCLK_RATE); 237 clk_set_rate(mclk, MCLK_RATE);
237 238
238 /*
239 * Request SSC device
240 */
241 ssc = ssc_request(0);
242 if (IS_ERR(ssc)) {
243 printk(KERN_ERR "ASoC: Failed to request SSC 0\n");
244 ret = PTR_ERR(ssc);
245 ssc = NULL;
246 goto err_ssc;
247 }
248 ssc_p->ssc = ssc;
249
250 at91sam9g20ek_snd_device = platform_device_alloc("soc-audio", -1); 239 at91sam9g20ek_snd_device = platform_device_alloc("soc-audio", -1);
251 if (!at91sam9g20ek_snd_device) { 240 if (!at91sam9g20ek_snd_device) {
252 printk(KERN_ERR "ASoC: Platform device allocation failed\n"); 241 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
253 ret = -ENOMEM; 242 ret = -ENOMEM;
243 goto err_mclk;
254 } 244 }
255 245
256 platform_set_drvdata(at91sam9g20ek_snd_device, 246 platform_set_drvdata(at91sam9g20ek_snd_device,
257 &at91sam9g20ek_snd_devdata); 247 &snd_soc_at91sam9g20ek);
258 at91sam9g20ek_snd_devdata.dev = &at91sam9g20ek_snd_device->dev;
259 248
260 ret = platform_device_add(at91sam9g20ek_snd_device); 249 ret = platform_device_add(at91sam9g20ek_snd_device);
261 if (ret) { 250 if (ret) {
262 printk(KERN_ERR "ASoC: Platform device allocation failed\n"); 251 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
263 platform_device_put(at91sam9g20ek_snd_device); 252 goto err_device_add;
264 } 253 }
265 254
266 return ret; 255 return ret;
267 256
268err_ssc: 257err_device_add:
269 ssc_free(ssc); 258 platform_device_put(at91sam9g20ek_snd_device);
270 ssc_p->ssc = NULL;
271err_mclk: 259err_mclk:
272 clk_put(mclk); 260 clk_put(mclk);
273 mclk = NULL; 261 mclk = NULL;
@@ -277,16 +265,6 @@ err:
277 265
278static void __exit at91sam9g20ek_exit(void) 266static void __exit at91sam9g20ek_exit(void)
279{ 267{
280 struct atmel_ssc_info *ssc_p = at91sam9g20ek_dai.cpu_dai->private_data;
281 struct ssc_device *ssc;
282
283 if (ssc_p != NULL) {
284 ssc = ssc_p->ssc;
285 if (ssc != NULL)
286 ssc_free(ssc);
287 ssc_p->ssc = NULL;
288 }
289
290 platform_device_unregister(at91sam9g20ek_snd_device); 268 platform_device_unregister(at91sam9g20ek_snd_device);
291 at91sam9g20ek_snd_device = NULL; 269 at91sam9g20ek_snd_device = NULL;
292 clk_put(mclk); 270 clk_put(mclk);
diff --git a/sound/soc/atmel/snd-soc-afeb9260.c b/sound/soc/atmel/snd-soc-afeb9260.c
index 23349de27313..5e4d499d8434 100644
--- a/sound/soc/atmel/snd-soc-afeb9260.c
+++ b/sound/soc/atmel/snd-soc-afeb9260.c
@@ -30,7 +30,6 @@
30#include <sound/pcm.h> 30#include <sound/pcm.h>
31#include <sound/pcm_params.h> 31#include <sound/pcm_params.h>
32#include <sound/soc.h> 32#include <sound/soc.h>
33#include <sound/soc-dapm.h>
34 33
35#include <asm/mach-types.h> 34#include <asm/mach-types.h>
36#include <mach/hardware.h> 35#include <mach/hardware.h>
@@ -46,8 +45,8 @@ static int afeb9260_hw_params(struct snd_pcm_substream *substream,
46 struct snd_pcm_hw_params *params) 45 struct snd_pcm_hw_params *params)
47{ 46{
48 struct snd_soc_pcm_runtime *rtd = substream->private_data; 47 struct snd_soc_pcm_runtime *rtd = substream->private_data;
49 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 48 struct snd_soc_dai *codec_dai = rtd->codec_dai;
50 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 49 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
51 int err; 50 int err;
52 51
53 /* Set codec DAI configuration */ 52 /* Set codec DAI configuration */
@@ -102,21 +101,23 @@ static const struct snd_soc_dapm_route audio_map[] = {
102 {"MICIN", NULL, "Mic Jack"}, 101 {"MICIN", NULL, "Mic Jack"},
103}; 102};
104 103
105static int afeb9260_tlv320aic23_init(struct snd_soc_codec *codec) 104static int afeb9260_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
106{ 105{
106 struct snd_soc_codec *codec = rtd->codec;
107 struct snd_soc_dapm_context *dapm = &codec->dapm;
107 108
108 /* Add afeb9260 specific widgets */ 109 /* Add afeb9260 specific widgets */
109 snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, 110 snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
110 ARRAY_SIZE(tlv320aic23_dapm_widgets)); 111 ARRAY_SIZE(tlv320aic23_dapm_widgets));
111 112
112 /* Set up afeb9260 specific audio path audio_map */ 113 /* Set up afeb9260 specific audio path audio_map */
113 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 114 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
114 115
115 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 116 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
116 snd_soc_dapm_enable_pin(codec, "Line In"); 117 snd_soc_dapm_enable_pin(dapm, "Line In");
117 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 118 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
118 119
119 snd_soc_dapm_sync(codec); 120 snd_soc_dapm_sync(dapm);
120 121
121 return 0; 122 return 0;
122} 123}
@@ -125,8 +126,10 @@ static int afeb9260_tlv320aic23_init(struct snd_soc_codec *codec)
125static struct snd_soc_dai_link afeb9260_dai = { 126static struct snd_soc_dai_link afeb9260_dai = {
126 .name = "TLV320AIC23", 127 .name = "TLV320AIC23",
127 .stream_name = "AIC23", 128 .stream_name = "AIC23",
128 .cpu_dai = &atmel_ssc_dai[0], 129 .cpu_dai_name = "atmel-ssc-dai.0",
129 .codec_dai = &tlv320aic23_dai, 130 .codec_dai_name = "tlv320aic23-hifi",
131 .platform_name = "atmel_pcm-audio",
132 .codec_name = "tlv320aic23-codec.0-001a",
130 .init = afeb9260_tlv320aic23_init, 133 .init = afeb9260_tlv320aic23_init,
131 .ops = &afeb9260_ops, 134 .ops = &afeb9260_ops,
132}; 135};
@@ -134,37 +137,20 @@ static struct snd_soc_dai_link afeb9260_dai = {
134/* Audio machine driver */ 137/* Audio machine driver */
135static struct snd_soc_card snd_soc_machine_afeb9260 = { 138static struct snd_soc_card snd_soc_machine_afeb9260 = {
136 .name = "AFEB9260", 139 .name = "AFEB9260",
137 .platform = &atmel_soc_platform,
138 .dai_link = &afeb9260_dai, 140 .dai_link = &afeb9260_dai,
139 .num_links = 1, 141 .num_links = 1,
140}; 142};
141 143
142/* Audio subsystem */
143static struct snd_soc_device afeb9260_snd_devdata = {
144 .card = &snd_soc_machine_afeb9260,
145 .codec_dev = &soc_codec_dev_tlv320aic23,
146};
147
148static struct platform_device *afeb9260_snd_device; 144static struct platform_device *afeb9260_snd_device;
149 145
150static int __init afeb9260_soc_init(void) 146static int __init afeb9260_soc_init(void)
151{ 147{
152 int err; 148 int err;
153 struct device *dev; 149 struct device *dev;
154 struct atmel_ssc_info *ssc_p = afeb9260_dai.cpu_dai->private_data;
155 struct ssc_device *ssc = NULL;
156 150
157 if (!(machine_is_afeb9260())) 151 if (!(machine_is_afeb9260()))
158 return -ENODEV; 152 return -ENODEV;
159 153
160 ssc = ssc_request(0);
161 if (IS_ERR(ssc)) {
162 printk(KERN_ERR "ASoC: Failed to request SSC 0\n");
163 err = PTR_ERR(ssc);
164 ssc = NULL;
165 goto err_ssc;
166 }
167 ssc_p->ssc = ssc;
168 154
169 afeb9260_snd_device = platform_device_alloc("soc-audio", -1); 155 afeb9260_snd_device = platform_device_alloc("soc-audio", -1);
170 if (!afeb9260_snd_device) { 156 if (!afeb9260_snd_device) {
@@ -172,8 +158,7 @@ static int __init afeb9260_soc_init(void)
172 return -ENOMEM; 158 return -ENOMEM;
173 } 159 }
174 160
175 platform_set_drvdata(afeb9260_snd_device, &afeb9260_snd_devdata); 161 platform_set_drvdata(afeb9260_snd_device, &snd_soc_machine_afeb9260);
176 afeb9260_snd_devdata.dev = &afeb9260_snd_device->dev;
177 err = platform_device_add(afeb9260_snd_device); 162 err = platform_device_add(afeb9260_snd_device);
178 if (err) 163 if (err)
179 goto err1; 164 goto err1;
@@ -182,11 +167,8 @@ static int __init afeb9260_soc_init(void)
182 167
183 return 0; 168 return 0;
184err1: 169err1:
185 platform_device_del(afeb9260_snd_device);
186 platform_device_put(afeb9260_snd_device); 170 platform_device_put(afeb9260_snd_device);
187err_ssc:
188 return err; 171 return err;
189
190} 172}
191 173
192static void __exit afeb9260_soc_exit(void) 174static void __exit afeb9260_soc_exit(void)