diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-08 18:07:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-08 18:07:14 -0400 |
commit | f5a246eab9a268f51ba8189ea5b098a1bfff200e (patch) | |
tree | a6ff7169e0bcaca498d9aec8b0624de1b74eaecb /sound/soc/fsl | |
parent | d5bbd43d5f450c3fca058f5b85f3dfb4e8cc88c9 (diff) | |
parent | 7ff34ad80b7080fafaac8efa9ef0061708eddd51 (diff) |
Merge tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai:
"This contains pretty many small commits covering fairly large range of
files in sound/ directory. Partly because of additional API support
and partly because of constantly developed ASoC and ARM stuff.
Some highlights:
- Introduced the helper function and documentation for exposing the
channel map via control API, as discussed in Plumbers; most of PCI
drivers are covered, will follow more drivers later
- Most of drivers have been replaced with the new PM callbacks (if
the bus is supported)
- HD-audio controller got the support of runtime PM and the support
of D3 clock-stop. Also changing the power_save option in sysfs
kicks off immediately to enable / disable the power-save mode.
- Another significant code change in HD-audio is the rewrite of
firmware loading code. Other than that, most of changes in
HD-audio are continued cleanups and standardization for the generic
auto parser and bug fixes (HBR, device-specific fixups), in
addition to the support of channel-map API.
- Addition of ASoC bindings for the compressed API, used by the
mid-x86 drivers.
- Lots of cleanups and API refreshes for ASoC codec drivers and
DaVinci.
- Conversion of OMAP to dmaengine.
- New machine driver for Wolfson Microelectronics Bells.
- New CODEC driver for Wolfson Microelectronics WM0010.
- Enhancements to the ux500 and wm2000 drivers
- A new driver for DA9055 and the support for regulator bypass mode."
Fix up various arm soc header file reorg conflicts.
* tag 'sound-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (339 commits)
ALSA: hda - Add new codec ALC283 ALC290 support
ALSA: hda - avoid unneccesary indices on "Headphone Jack" controls
ALSA: hda - fix indices on boost volume on Conexant
ALSA: aloop - add locking to timer access
ALSA: hda - Fix hang caused by race during suspend.
sound: Remove unnecessary semicolon
ALSA: hda/realtek - Fix detection of ALC271X codec
ALSA: hda - Add inverted internal mic quirk for Lenovo IdeaPad U310
ALSA: hda - make Realtek/Sigmatel/Conexant use the generic unsol event
ALSA: hda - make a generic unsol event handler
ASoC: codecs: Add DA9055 codec driver
ASoC: eukrea-tlv320: Convert it to platform driver
ALSA: ASoC: add DT bindings for CS4271
ASoC: wm_hubs: Ensure volume updates are handled during class W startup
ASoC: wm5110: Adding missing volume update bits
ASoC: wm5110: Add OUT3R support
ASoC: wm5110: Add AEC loopback support
ASoC: wm5110: Rename EPOUT to HPOUT3
ASoC: arizona: Add more clock rates
ASoC: arizona: Add more DSP options for mixer input muxes
...
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r-- | sound/soc/fsl/Kconfig | 2 | ||||
-rw-r--r-- | sound/soc/fsl/eukrea-tlv320.c | 37 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_dma.c | 6 | ||||
-rw-r--r-- | sound/soc/fsl/imx-audmux.c | 3 | ||||
-rw-r--r-- | sound/soc/fsl/imx-pcm-dma.c | 5 | ||||
-rw-r--r-- | sound/soc/fsl/imx-ssi.c | 30 | ||||
-rw-r--r-- | sound/soc/fsl/mpc5200_dma.c | 24 | ||||
-rw-r--r-- | sound/soc/fsl/mpc5200_dma.h | 3 | ||||
-rw-r--r-- | sound/soc/fsl/mpc5200_psc_ac97.c | 10 | ||||
-rw-r--r-- | sound/soc/fsl/mpc5200_psc_i2s.c | 8 | ||||
-rw-r--r-- | sound/soc/fsl/mpc8610_hpcd.c | 32 | ||||
-rw-r--r-- | sound/soc/fsl/mx27vis-aic32x4.c | 42 | ||||
-rw-r--r-- | sound/soc/fsl/p1022_ds.c | 31 | ||||
-rw-r--r-- | sound/soc/fsl/pcm030-audio-fabric.c | 100 |
14 files changed, 163 insertions, 170 deletions
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index d70133086ac3..4563b28bd625 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig | |||
@@ -6,7 +6,7 @@ config SND_SOC_FSL_UTILS | |||
6 | 6 | ||
7 | menuconfig SND_POWERPC_SOC | 7 | menuconfig SND_POWERPC_SOC |
8 | tristate "SoC Audio for Freescale PowerPC CPUs" | 8 | tristate "SoC Audio for Freescale PowerPC CPUs" |
9 | depends on FSL_SOC | 9 | depends on FSL_SOC || PPC_MPC52xx |
10 | help | 10 | help |
11 | Say Y or M if you want to add support for codecs attached to | 11 | Say Y or M if you want to add support for codecs attached to |
12 | the PowerPC CPUs. | 12 | the PowerPC CPUs. |
diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c index efb9ede01208..267d5b4b63ce 100644 --- a/sound/soc/fsl/eukrea-tlv320.c +++ b/sound/soc/fsl/eukrea-tlv320.c | |||
@@ -93,9 +93,7 @@ static struct snd_soc_card eukrea_tlv320 = { | |||
93 | .num_links = 1, | 93 | .num_links = 1, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static struct platform_device *eukrea_tlv320_snd_device; | 96 | static int __devinit eukrea_tlv320_probe(struct platform_device *pdev) |
97 | |||
98 | static int __init eukrea_tlv320_init(void) | ||
99 | { | 97 | { |
100 | int ret; | 98 | int ret; |
101 | int int_port = 0, ext_port; | 99 | int int_port = 0, ext_port; |
@@ -136,29 +134,32 @@ static int __init eukrea_tlv320_init(void) | |||
136 | return 0; | 134 | return 0; |
137 | } | 135 | } |
138 | 136 | ||
139 | eukrea_tlv320_snd_device = platform_device_alloc("soc-audio", -1); | 137 | eukrea_tlv320.dev = &pdev->dev; |
140 | if (!eukrea_tlv320_snd_device) | 138 | ret = snd_soc_register_card(&eukrea_tlv320); |
141 | return -ENOMEM; | 139 | if (ret) |
142 | 140 | dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); | |
143 | platform_set_drvdata(eukrea_tlv320_snd_device, &eukrea_tlv320); | ||
144 | ret = platform_device_add(eukrea_tlv320_snd_device); | ||
145 | |||
146 | if (ret) { | ||
147 | printk(KERN_ERR "ASoC: Platform device allocation failed\n"); | ||
148 | platform_device_put(eukrea_tlv320_snd_device); | ||
149 | } | ||
150 | 141 | ||
151 | return ret; | 142 | return ret; |
152 | } | 143 | } |
153 | 144 | ||
154 | static void __exit eukrea_tlv320_exit(void) | 145 | static int __devexit eukrea_tlv320_remove(struct platform_device *pdev) |
155 | { | 146 | { |
156 | platform_device_unregister(eukrea_tlv320_snd_device); | 147 | snd_soc_unregister_card(&eukrea_tlv320); |
148 | |||
149 | return 0; | ||
157 | } | 150 | } |
158 | 151 | ||
159 | module_init(eukrea_tlv320_init); | 152 | static struct platform_driver eukrea_tlv320_driver = { |
160 | module_exit(eukrea_tlv320_exit); | 153 | .driver = { |
154 | .name = "eukrea_tlv320", | ||
155 | .owner = THIS_MODULE, | ||
156 | }, | ||
157 | .probe = eukrea_tlv320_probe, | ||
158 | .remove = __devexit_p(eukrea_tlv320_remove),}; | ||
159 | |||
160 | module_platform_driver(eukrea_tlv320_driver); | ||
161 | 161 | ||
162 | MODULE_AUTHOR("Eric Bénard <eric@eukrea.com>"); | 162 | MODULE_AUTHOR("Eric Bénard <eric@eukrea.com>"); |
163 | MODULE_DESCRIPTION("CPUIMX ALSA SoC driver"); | 163 | MODULE_DESCRIPTION("CPUIMX ALSA SoC driver"); |
164 | MODULE_LICENSE("GPL"); | 164 | MODULE_LICENSE("GPL"); |
165 | MODULE_ALIAS("platform:eukrea_tlv320"); | ||
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c index 96bb92dd174c..6feb26500580 100644 --- a/sound/soc/fsl/fsl_dma.c +++ b/sound/soc/fsl/fsl_dma.c | |||
@@ -823,12 +823,6 @@ static int fsl_dma_close(struct snd_pcm_substream *substream) | |||
823 | if (dma_private->irq) | 823 | if (dma_private->irq) |
824 | free_irq(dma_private->irq, dma_private); | 824 | free_irq(dma_private->irq, dma_private); |
825 | 825 | ||
826 | if (dma_private->ld_buf_phys) { | ||
827 | dma_unmap_single(dev, dma_private->ld_buf_phys, | ||
828 | sizeof(dma_private->link), | ||
829 | DMA_TO_DEVICE); | ||
830 | } | ||
831 | |||
832 | /* Deallocate the fsl_dma_private structure */ | 826 | /* Deallocate the fsl_dma_private structure */ |
833 | dma_free_coherent(dev, sizeof(struct fsl_dma_private), | 827 | dma_free_coherent(dev, sizeof(struct fsl_dma_private), |
834 | dma_private, dma_private->ld_buf_phys); | 828 | dma_private, dma_private->ld_buf_phys); |
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c index e7c800ebbd75..524ce6210cee 100644 --- a/sound/soc/fsl/imx-audmux.c +++ b/sound/soc/fsl/imx-audmux.c | |||
@@ -74,9 +74,6 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, | |||
74 | if (!buf) | 74 | if (!buf) |
75 | return -ENOMEM; | 75 | return -ENOMEM; |
76 | 76 | ||
77 | if (!audmux_base) | ||
78 | return -ENOSYS; | ||
79 | |||
80 | if (audmux_clk) | 77 | if (audmux_clk) |
81 | clk_prepare_enable(audmux_clk); | 78 | clk_prepare_enable(audmux_clk); |
82 | 79 | ||
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c index 89a7755b6f56..d85929b79c35 100644 --- a/sound/soc/fsl/imx-pcm-dma.c +++ b/sound/soc/fsl/imx-pcm-dma.c | |||
@@ -109,6 +109,9 @@ static int snd_imx_open(struct snd_pcm_substream *substream) | |||
109 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); | 109 | dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); |
110 | 110 | ||
111 | dma_data = kzalloc(sizeof(*dma_data), GFP_KERNEL); | 111 | dma_data = kzalloc(sizeof(*dma_data), GFP_KERNEL); |
112 | if (!dma_data) | ||
113 | return -ENOMEM; | ||
114 | |||
112 | dma_data->peripheral_type = dma_params->shared_peripheral ? | 115 | dma_data->peripheral_type = dma_params->shared_peripheral ? |
113 | IMX_DMATYPE_SSI_SP : IMX_DMATYPE_SSI; | 116 | IMX_DMATYPE_SSI_SP : IMX_DMATYPE_SSI; |
114 | dma_data->priority = DMA_PRIO_HIGH; | 117 | dma_data->priority = DMA_PRIO_HIGH; |
@@ -117,7 +120,7 @@ static int snd_imx_open(struct snd_pcm_substream *substream) | |||
117 | ret = snd_dmaengine_pcm_open(substream, filter, dma_data); | 120 | ret = snd_dmaengine_pcm_open(substream, filter, dma_data); |
118 | if (ret) { | 121 | if (ret) { |
119 | kfree(dma_data); | 122 | kfree(dma_data); |
120 | return 0; | 123 | return ret; |
121 | } | 124 | } |
122 | 125 | ||
123 | snd_dmaengine_pcm_set_data(substream, dma_data); | 126 | snd_dmaengine_pcm_set_data(substream, dma_data); |
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c index e6a17baca1ee..006f7d465ed2 100644 --- a/sound/soc/fsl/imx-ssi.c +++ b/sound/soc/fsl/imx-ssi.c | |||
@@ -380,14 +380,13 @@ static int imx_ssi_dai_probe(struct snd_soc_dai *dai) | |||
380 | static struct snd_soc_dai_driver imx_ssi_dai = { | 380 | static struct snd_soc_dai_driver imx_ssi_dai = { |
381 | .probe = imx_ssi_dai_probe, | 381 | .probe = imx_ssi_dai_probe, |
382 | .playback = { | 382 | .playback = { |
383 | /* The SSI does not support monaural audio. */ | 383 | .channels_min = 1, |
384 | .channels_min = 2, | ||
385 | .channels_max = 2, | 384 | .channels_max = 2, |
386 | .rates = SNDRV_PCM_RATE_8000_96000, | 385 | .rates = SNDRV_PCM_RATE_8000_96000, |
387 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 386 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
388 | }, | 387 | }, |
389 | .capture = { | 388 | .capture = { |
390 | .channels_min = 2, | 389 | .channels_min = 1, |
391 | .channels_max = 2, | 390 | .channels_max = 2, |
392 | .rates = SNDRV_PCM_RATE_8000_96000, | 391 | .rates = SNDRV_PCM_RATE_8000_96000, |
393 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | 392 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
@@ -524,7 +523,7 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
524 | int ret = 0; | 523 | int ret = 0; |
525 | struct snd_soc_dai_driver *dai; | 524 | struct snd_soc_dai_driver *dai; |
526 | 525 | ||
527 | ssi = kzalloc(sizeof(*ssi), GFP_KERNEL); | 526 | ssi = devm_kzalloc(&pdev->dev, sizeof(*ssi), GFP_KERNEL); |
528 | if (!ssi) | 527 | if (!ssi) |
529 | return -ENOMEM; | 528 | return -ENOMEM; |
530 | dev_set_drvdata(&pdev->dev, ssi); | 529 | dev_set_drvdata(&pdev->dev, ssi); |
@@ -537,7 +536,7 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
537 | 536 | ||
538 | ssi->irq = platform_get_irq(pdev, 0); | 537 | ssi->irq = platform_get_irq(pdev, 0); |
539 | 538 | ||
540 | ssi->clk = clk_get(&pdev->dev, NULL); | 539 | ssi->clk = devm_clk_get(&pdev->dev, NULL); |
541 | if (IS_ERR(ssi->clk)) { | 540 | if (IS_ERR(ssi->clk)) { |
542 | ret = PTR_ERR(ssi->clk); | 541 | ret = PTR_ERR(ssi->clk); |
543 | dev_err(&pdev->dev, "Cannot get the clock: %d\n", | 542 | dev_err(&pdev->dev, "Cannot get the clock: %d\n", |
@@ -552,23 +551,18 @@ static int imx_ssi_probe(struct platform_device *pdev) | |||
552 | goto failed_get_resource; | 551 | goto failed_get_resource; |
553 | } | 552 | } |
554 | 553 | ||
555 | if (!request_mem_region(res->start, resource_size(res), DRV_NAME)) { | 554 | ssi->base = devm_request_and_ioremap(&pdev->dev, res); |
556 | dev_err(&pdev->dev, "request_mem_region failed\n"); | ||
557 | ret = -EBUSY; | ||
558 | goto failed_get_resource; | ||
559 | } | ||
560 | |||
561 | ssi->base = ioremap(res->start, resource_size(res)); | ||
562 | if (!ssi->base) { | 555 | if (!ssi->base) { |
563 | dev_err(&pdev->dev, "ioremap failed\n"); | 556 | dev_err(&pdev->dev, "ioremap failed\n"); |
564 | ret = -ENODEV; | 557 | ret = -ENODEV; |
565 | goto failed_ioremap; | 558 | goto failed_register; |
566 | } | 559 | } |
567 | 560 | ||
568 | if (ssi->flags & IMX_SSI_USE_AC97) { | 561 | if (ssi->flags & IMX_SSI_USE_AC97) { |
569 | if (ac97_ssi) { | 562 | if (ac97_ssi) { |
563 | dev_err(&pdev->dev, "AC'97 SSI already registered\n"); | ||
570 | ret = -EBUSY; | 564 | ret = -EBUSY; |
571 | goto failed_ac97; | 565 | goto failed_register; |
572 | } | 566 | } |
573 | ac97_ssi = ssi; | 567 | ac97_ssi = ssi; |
574 | setup_channel_to_ac97(ssi); | 568 | setup_channel_to_ac97(ssi); |
@@ -637,15 +631,10 @@ failed_pdev_fiq_add: | |||
637 | failed_pdev_fiq_alloc: | 631 | failed_pdev_fiq_alloc: |
638 | snd_soc_unregister_dai(&pdev->dev); | 632 | snd_soc_unregister_dai(&pdev->dev); |
639 | failed_register: | 633 | failed_register: |
640 | failed_ac97: | ||
641 | iounmap(ssi->base); | ||
642 | failed_ioremap: | ||
643 | release_mem_region(res->start, resource_size(res)); | 634 | release_mem_region(res->start, resource_size(res)); |
644 | failed_get_resource: | 635 | failed_get_resource: |
645 | clk_disable_unprepare(ssi->clk); | 636 | clk_disable_unprepare(ssi->clk); |
646 | clk_put(ssi->clk); | ||
647 | failed_clk: | 637 | failed_clk: |
648 | kfree(ssi); | ||
649 | 638 | ||
650 | return ret; | 639 | return ret; |
651 | } | 640 | } |
@@ -663,11 +652,8 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev) | |||
663 | if (ssi->flags & IMX_SSI_USE_AC97) | 652 | if (ssi->flags & IMX_SSI_USE_AC97) |
664 | ac97_ssi = NULL; | 653 | ac97_ssi = NULL; |
665 | 654 | ||
666 | iounmap(ssi->base); | ||
667 | release_mem_region(res->start, resource_size(res)); | 655 | release_mem_region(res->start, resource_size(res)); |
668 | clk_disable_unprepare(ssi->clk); | 656 | clk_disable_unprepare(ssi->clk); |
669 | clk_put(ssi->clk); | ||
670 | kfree(ssi); | ||
671 | 657 | ||
672 | return 0; | 658 | return 0; |
673 | } | 659 | } |
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index 9a3f7c5ab687..9997c039bb24 100644 --- a/sound/soc/fsl/mpc5200_dma.c +++ b/sound/soc/fsl/mpc5200_dma.c | |||
@@ -370,7 +370,7 @@ static struct snd_soc_platform_driver mpc5200_audio_dma_platform = { | |||
370 | .pcm_free = &psc_dma_free, | 370 | .pcm_free = &psc_dma_free, |
371 | }; | 371 | }; |
372 | 372 | ||
373 | static int mpc5200_hpcd_probe(struct platform_device *op) | 373 | int mpc5200_audio_dma_create(struct platform_device *op) |
374 | { | 374 | { |
375 | phys_addr_t fifo; | 375 | phys_addr_t fifo; |
376 | struct psc_dma *psc_dma; | 376 | struct psc_dma *psc_dma; |
@@ -487,8 +487,9 @@ out_unmap: | |||
487 | iounmap(regs); | 487 | iounmap(regs); |
488 | return ret; | 488 | return ret; |
489 | } | 489 | } |
490 | EXPORT_SYMBOL_GPL(mpc5200_audio_dma_create); | ||
490 | 491 | ||
491 | static int mpc5200_hpcd_remove(struct platform_device *op) | 492 | int mpc5200_audio_dma_destroy(struct platform_device *op) |
492 | { | 493 | { |
493 | struct psc_dma *psc_dma = dev_get_drvdata(&op->dev); | 494 | struct psc_dma *psc_dma = dev_get_drvdata(&op->dev); |
494 | 495 | ||
@@ -510,24 +511,7 @@ static int mpc5200_hpcd_remove(struct platform_device *op) | |||
510 | 511 | ||
511 | return 0; | 512 | return 0; |
512 | } | 513 | } |
513 | 514 | EXPORT_SYMBOL_GPL(mpc5200_audio_dma_destroy); | |
514 | static struct of_device_id mpc5200_hpcd_match[] = { | ||
515 | { .compatible = "fsl,mpc5200-pcm", }, | ||
516 | {} | ||
517 | }; | ||
518 | MODULE_DEVICE_TABLE(of, mpc5200_hpcd_match); | ||
519 | |||
520 | static struct platform_driver mpc5200_hpcd_of_driver = { | ||
521 | .probe = mpc5200_hpcd_probe, | ||
522 | .remove = mpc5200_hpcd_remove, | ||
523 | .driver = { | ||
524 | .owner = THIS_MODULE, | ||
525 | .name = "mpc5200-pcm-audio", | ||
526 | .of_match_table = mpc5200_hpcd_match, | ||
527 | } | ||
528 | }; | ||
529 | |||
530 | module_platform_driver(mpc5200_hpcd_of_driver); | ||
531 | 515 | ||
532 | MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>"); | 516 | MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>"); |
533 | MODULE_DESCRIPTION("Freescale MPC5200 PSC in DMA mode ASoC Driver"); | 517 | MODULE_DESCRIPTION("Freescale MPC5200 PSC in DMA mode ASoC Driver"); |
diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h index a3c0cd5382fb..dff253fde29a 100644 --- a/sound/soc/fsl/mpc5200_dma.h +++ b/sound/soc/fsl/mpc5200_dma.h | |||
@@ -81,4 +81,7 @@ to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma) | |||
81 | return &psc_dma->playback; | 81 | return &psc_dma->playback; |
82 | } | 82 | } |
83 | 83 | ||
84 | int mpc5200_audio_dma_create(struct platform_device *op); | ||
85 | int mpc5200_audio_dma_destroy(struct platform_device *op); | ||
86 | |||
84 | #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */ | 87 | #endif /* __SOUND_SOC_FSL_MPC5200_DMA_H__ */ |
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c index ffa00a2eb770..a313c0ae36db 100644 --- a/sound/soc/fsl/mpc5200_psc_ac97.c +++ b/sound/soc/fsl/mpc5200_psc_ac97.c | |||
@@ -237,15 +237,18 @@ static const struct snd_soc_dai_ops psc_ac97_digital_ops = { | |||
237 | 237 | ||
238 | static struct snd_soc_dai_driver psc_ac97_dai[] = { | 238 | static struct snd_soc_dai_driver psc_ac97_dai[] = { |
239 | { | 239 | { |
240 | .name = "mpc5200-psc-ac97.0", | ||
240 | .ac97_control = 1, | 241 | .ac97_control = 1, |
241 | .probe = psc_ac97_probe, | 242 | .probe = psc_ac97_probe, |
242 | .playback = { | 243 | .playback = { |
244 | .stream_name = "AC97 Playback", | ||
243 | .channels_min = 1, | 245 | .channels_min = 1, |
244 | .channels_max = 6, | 246 | .channels_max = 6, |
245 | .rates = SNDRV_PCM_RATE_8000_48000, | 247 | .rates = SNDRV_PCM_RATE_8000_48000, |
246 | .formats = SNDRV_PCM_FMTBIT_S32_BE, | 248 | .formats = SNDRV_PCM_FMTBIT_S32_BE, |
247 | }, | 249 | }, |
248 | .capture = { | 250 | .capture = { |
251 | .stream_name = "AC97 Capture", | ||
249 | .channels_min = 1, | 252 | .channels_min = 1, |
250 | .channels_max = 2, | 253 | .channels_max = 2, |
251 | .rates = SNDRV_PCM_RATE_8000_48000, | 254 | .rates = SNDRV_PCM_RATE_8000_48000, |
@@ -254,8 +257,10 @@ static struct snd_soc_dai_driver psc_ac97_dai[] = { | |||
254 | .ops = &psc_ac97_analog_ops, | 257 | .ops = &psc_ac97_analog_ops, |
255 | }, | 258 | }, |
256 | { | 259 | { |
260 | .name = "mpc5200-psc-ac97.1", | ||
257 | .ac97_control = 1, | 261 | .ac97_control = 1, |
258 | .playback = { | 262 | .playback = { |
263 | .stream_name = "AC97 SPDIF", | ||
259 | .channels_min = 1, | 264 | .channels_min = 1, |
260 | .channels_max = 2, | 265 | .channels_max = 2, |
261 | .rates = SNDRV_PCM_RATE_32000 | \ | 266 | .rates = SNDRV_PCM_RATE_32000 | \ |
@@ -278,6 +283,10 @@ static int __devinit psc_ac97_of_probe(struct platform_device *op) | |||
278 | struct snd_ac97 ac97; | 283 | struct snd_ac97 ac97; |
279 | struct mpc52xx_psc __iomem *regs; | 284 | struct mpc52xx_psc __iomem *regs; |
280 | 285 | ||
286 | rc = mpc5200_audio_dma_create(op); | ||
287 | if (rc != 0) | ||
288 | return rc; | ||
289 | |||
281 | rc = snd_soc_register_dais(&op->dev, psc_ac97_dai, ARRAY_SIZE(psc_ac97_dai)); | 290 | rc = snd_soc_register_dais(&op->dev, psc_ac97_dai, ARRAY_SIZE(psc_ac97_dai)); |
282 | if (rc != 0) { | 291 | if (rc != 0) { |
283 | dev_err(&op->dev, "Failed to register DAI\n"); | 292 | dev_err(&op->dev, "Failed to register DAI\n"); |
@@ -303,6 +312,7 @@ static int __devinit psc_ac97_of_probe(struct platform_device *op) | |||
303 | 312 | ||
304 | static int __devexit psc_ac97_of_remove(struct platform_device *op) | 313 | static int __devexit psc_ac97_of_remove(struct platform_device *op) |
305 | { | 314 | { |
315 | mpc5200_audio_dma_destroy(op); | ||
306 | snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_ac97_dai)); | 316 | snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_ac97_dai)); |
307 | return 0; | 317 | return 0; |
308 | } | 318 | } |
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c index 7b530327553a..ba1f0a66358f 100644 --- a/sound/soc/fsl/mpc5200_psc_i2s.c +++ b/sound/soc/fsl/mpc5200_psc_i2s.c | |||
@@ -130,13 +130,16 @@ static const struct snd_soc_dai_ops psc_i2s_dai_ops = { | |||
130 | }; | 130 | }; |
131 | 131 | ||
132 | static struct snd_soc_dai_driver psc_i2s_dai[] = {{ | 132 | static struct snd_soc_dai_driver psc_i2s_dai[] = {{ |
133 | .name = "mpc5200-psc-i2s.0", | ||
133 | .playback = { | 134 | .playback = { |
135 | .stream_name = "I2S Playback", | ||
134 | .channels_min = 2, | 136 | .channels_min = 2, |
135 | .channels_max = 2, | 137 | .channels_max = 2, |
136 | .rates = PSC_I2S_RATES, | 138 | .rates = PSC_I2S_RATES, |
137 | .formats = PSC_I2S_FORMATS, | 139 | .formats = PSC_I2S_FORMATS, |
138 | }, | 140 | }, |
139 | .capture = { | 141 | .capture = { |
142 | .stream_name = "I2S Capture", | ||
140 | .channels_min = 2, | 143 | .channels_min = 2, |
141 | .channels_max = 2, | 144 | .channels_max = 2, |
142 | .rates = PSC_I2S_RATES, | 145 | .rates = PSC_I2S_RATES, |
@@ -156,6 +159,10 @@ static int __devinit psc_i2s_of_probe(struct platform_device *op) | |||
156 | struct psc_dma *psc_dma; | 159 | struct psc_dma *psc_dma; |
157 | struct mpc52xx_psc __iomem *regs; | 160 | struct mpc52xx_psc __iomem *regs; |
158 | 161 | ||
162 | rc = mpc5200_audio_dma_create(op); | ||
163 | if (rc != 0) | ||
164 | return rc; | ||
165 | |||
159 | rc = snd_soc_register_dais(&op->dev, psc_i2s_dai, ARRAY_SIZE(psc_i2s_dai)); | 166 | rc = snd_soc_register_dais(&op->dev, psc_i2s_dai, ARRAY_SIZE(psc_i2s_dai)); |
160 | if (rc != 0) { | 167 | if (rc != 0) { |
161 | pr_err("Failed to register DAI\n"); | 168 | pr_err("Failed to register DAI\n"); |
@@ -200,6 +207,7 @@ static int __devinit psc_i2s_of_probe(struct platform_device *op) | |||
200 | 207 | ||
201 | static int __devexit psc_i2s_of_remove(struct platform_device *op) | 208 | static int __devexit psc_i2s_of_remove(struct platform_device *op) |
202 | { | 209 | { |
210 | mpc5200_audio_dma_destroy(op); | ||
203 | snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_i2s_dai)); | 211 | snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_i2s_dai)); |
204 | return 0; | 212 | return 0; |
205 | } | 213 | } |
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index 60bcba1bc30e..9ff9318c52b9 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c | |||
@@ -192,7 +192,6 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) | |||
192 | container_of(dev, struct platform_device, dev); | 192 | container_of(dev, struct platform_device, dev); |
193 | struct device_node *np = ssi_pdev->dev.of_node; | 193 | struct device_node *np = ssi_pdev->dev.of_node; |
194 | struct device_node *codec_np = NULL; | 194 | struct device_node *codec_np = NULL; |
195 | struct platform_device *sound_device = NULL; | ||
196 | struct mpc8610_hpcd_data *machine_data; | 195 | struct mpc8610_hpcd_data *machine_data; |
197 | int ret = -ENODEV; | 196 | int ret = -ENODEV; |
198 | const char *sprop; | 197 | const char *sprop; |
@@ -341,34 +340,22 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) | |||
341 | machine_data->card.probe = mpc8610_hpcd_machine_probe; | 340 | machine_data->card.probe = mpc8610_hpcd_machine_probe; |
342 | machine_data->card.remove = mpc8610_hpcd_machine_remove; | 341 | machine_data->card.remove = mpc8610_hpcd_machine_remove; |
343 | machine_data->card.name = pdev->name; /* The platform driver name */ | 342 | machine_data->card.name = pdev->name; /* The platform driver name */ |
343 | machine_data->card.owner = THIS_MODULE; | ||
344 | machine_data->card.dev = &pdev->dev; | ||
344 | machine_data->card.num_links = 2; | 345 | machine_data->card.num_links = 2; |
345 | machine_data->card.dai_link = machine_data->dai; | 346 | machine_data->card.dai_link = machine_data->dai; |
346 | 347 | ||
347 | /* Allocate a new audio platform device structure */ | ||
348 | sound_device = platform_device_alloc("soc-audio", -1); | ||
349 | if (!sound_device) { | ||
350 | dev_err(&pdev->dev, "platform device alloc failed\n"); | ||
351 | ret = -ENOMEM; | ||
352 | goto error; | ||
353 | } | ||
354 | |||
355 | /* Associate the card data with the sound device */ | ||
356 | platform_set_drvdata(sound_device, &machine_data->card); | ||
357 | |||
358 | /* Register with ASoC */ | 348 | /* Register with ASoC */ |
359 | ret = platform_device_add(sound_device); | 349 | ret = snd_soc_register_card(&machine_data->card); |
360 | if (ret) { | 350 | if (ret) { |
361 | dev_err(&pdev->dev, "platform device add failed\n"); | 351 | dev_err(&pdev->dev, "could not register card\n"); |
362 | goto error_sound; | 352 | goto error; |
363 | } | 353 | } |
364 | dev_set_drvdata(&pdev->dev, sound_device); | ||
365 | 354 | ||
366 | of_node_put(codec_np); | 355 | of_node_put(codec_np); |
367 | 356 | ||
368 | return 0; | 357 | return 0; |
369 | 358 | ||
370 | error_sound: | ||
371 | platform_device_put(sound_device); | ||
372 | error: | 359 | error: |
373 | kfree(machine_data); | 360 | kfree(machine_data); |
374 | error_alloc: | 361 | error_alloc: |
@@ -383,17 +370,12 @@ error_alloc: | |||
383 | */ | 370 | */ |
384 | static int __devexit mpc8610_hpcd_remove(struct platform_device *pdev) | 371 | static int __devexit mpc8610_hpcd_remove(struct platform_device *pdev) |
385 | { | 372 | { |
386 | struct platform_device *sound_device = dev_get_drvdata(&pdev->dev); | 373 | struct snd_soc_card *card = platform_get_drvdata(pdev); |
387 | struct snd_soc_card *card = platform_get_drvdata(sound_device); | ||
388 | struct mpc8610_hpcd_data *machine_data = | 374 | struct mpc8610_hpcd_data *machine_data = |
389 | container_of(card, struct mpc8610_hpcd_data, card); | 375 | container_of(card, struct mpc8610_hpcd_data, card); |
390 | 376 | ||
391 | platform_device_unregister(sound_device); | 377 | snd_soc_unregister_card(card); |
392 | |||
393 | kfree(machine_data); | 378 | kfree(machine_data); |
394 | sound_device->dev.platform_data = NULL; | ||
395 | |||
396 | dev_set_drvdata(&pdev->dev, NULL); | ||
397 | 379 | ||
398 | return 0; | 380 | return 0; |
399 | } | 381 | } |
diff --git a/sound/soc/fsl/mx27vis-aic32x4.c b/sound/soc/fsl/mx27vis-aic32x4.c index f6d04ad4bb39..2b76877b1789 100644 --- a/sound/soc/fsl/mx27vis-aic32x4.c +++ b/sound/soc/fsl/mx27vis-aic32x4.c | |||
@@ -26,13 +26,13 @@ | |||
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
28 | #include <linux/gpio.h> | 28 | #include <linux/gpio.h> |
29 | #include <linux/platform_data/asoc-mx27vis.h> | ||
29 | #include <sound/core.h> | 30 | #include <sound/core.h> |
30 | #include <sound/pcm.h> | 31 | #include <sound/pcm.h> |
31 | #include <sound/soc.h> | 32 | #include <sound/soc.h> |
32 | #include <sound/soc-dapm.h> | 33 | #include <sound/soc-dapm.h> |
33 | #include <sound/tlv.h> | 34 | #include <sound/tlv.h> |
34 | #include <asm/mach-types.h> | 35 | #include <asm/mach-types.h> |
35 | #include <mach/iomux-mx27.h> | ||
36 | 36 | ||
37 | #include "../codecs/tlv320aic32x4.h" | 37 | #include "../codecs/tlv320aic32x4.h" |
38 | #include "imx-ssi.h" | 38 | #include "imx-ssi.h" |
@@ -41,20 +41,12 @@ | |||
41 | #define MX27VIS_AMP_GAIN 0 | 41 | #define MX27VIS_AMP_GAIN 0 |
42 | #define MX27VIS_AMP_MUTE 1 | 42 | #define MX27VIS_AMP_MUTE 1 |
43 | 43 | ||
44 | #define MX27VIS_PIN_G0 (GPIO_PORTF + 9) | ||
45 | #define MX27VIS_PIN_G1 (GPIO_PORTF + 8) | ||
46 | #define MX27VIS_PIN_SDL (GPIO_PORTE + 5) | ||
47 | #define MX27VIS_PIN_SDR (GPIO_PORTF + 7) | ||
48 | |||
49 | static int mx27vis_amp_gain; | 44 | static int mx27vis_amp_gain; |
50 | static int mx27vis_amp_mute; | 45 | static int mx27vis_amp_mute; |
51 | 46 | static int mx27vis_amp_gain0_gpio; | |
52 | static const int mx27vis_amp_pins[] = { | 47 | static int mx27vis_amp_gain1_gpio; |
53 | MX27VIS_PIN_G0 | GPIO_GPIO | GPIO_OUT, | 48 | static int mx27vis_amp_mutel_gpio; |
54 | MX27VIS_PIN_G1 | GPIO_GPIO | GPIO_OUT, | 49 | static int mx27vis_amp_muter_gpio; |
55 | MX27VIS_PIN_SDL | GPIO_GPIO | GPIO_OUT, | ||
56 | MX27VIS_PIN_SDR | GPIO_GPIO | GPIO_OUT, | ||
57 | }; | ||
58 | 50 | ||
59 | static int mx27vis_aic32x4_hw_params(struct snd_pcm_substream *substream, | 51 | static int mx27vis_aic32x4_hw_params(struct snd_pcm_substream *substream, |
60 | struct snd_pcm_hw_params *params) | 52 | struct snd_pcm_hw_params *params) |
@@ -109,13 +101,13 @@ static int mx27vis_amp_set(struct snd_kcontrol *kcontrol, | |||
109 | 101 | ||
110 | switch (reg) { | 102 | switch (reg) { |
111 | case MX27VIS_AMP_GAIN: | 103 | case MX27VIS_AMP_GAIN: |
112 | gpio_set_value(MX27VIS_PIN_G0, value & 1); | 104 | gpio_set_value(mx27vis_amp_gain0_gpio, value & 1); |
113 | gpio_set_value(MX27VIS_PIN_G1, value >> 1); | 105 | gpio_set_value(mx27vis_amp_gain1_gpio, value >> 1); |
114 | mx27vis_amp_gain = value; | 106 | mx27vis_amp_gain = value; |
115 | break; | 107 | break; |
116 | case MX27VIS_AMP_MUTE: | 108 | case MX27VIS_AMP_MUTE: |
117 | gpio_set_value(MX27VIS_PIN_SDL, value & 1); | 109 | gpio_set_value(mx27vis_amp_mutel_gpio, value & 1); |
118 | gpio_set_value(MX27VIS_PIN_SDR, value >> 1); | 110 | gpio_set_value(mx27vis_amp_muter_gpio, value >> 1); |
119 | mx27vis_amp_mute = value; | 111 | mx27vis_amp_mute = value; |
120 | break; | 112 | break; |
121 | } | 113 | } |
@@ -190,8 +182,19 @@ static struct snd_soc_card mx27vis_aic32x4 = { | |||
190 | 182 | ||
191 | static int __devinit mx27vis_aic32x4_probe(struct platform_device *pdev) | 183 | static int __devinit mx27vis_aic32x4_probe(struct platform_device *pdev) |
192 | { | 184 | { |
185 | struct snd_mx27vis_platform_data *pdata = pdev->dev.platform_data; | ||
193 | int ret; | 186 | int ret; |
194 | 187 | ||
188 | if (!pdata) { | ||
189 | dev_err(&pdev->dev, "No platform data supplied\n"); | ||
190 | return -EINVAL; | ||
191 | } | ||
192 | |||
193 | mx27vis_amp_gain0_gpio = pdata->amp_gain0_gpio; | ||
194 | mx27vis_amp_gain1_gpio = pdata->amp_gain1_gpio; | ||
195 | mx27vis_amp_mutel_gpio = pdata->amp_mutel_gpio; | ||
196 | mx27vis_amp_muter_gpio = pdata->amp_muter_gpio; | ||
197 | |||
195 | mx27vis_aic32x4.dev = &pdev->dev; | 198 | mx27vis_aic32x4.dev = &pdev->dev; |
196 | ret = snd_soc_register_card(&mx27vis_aic32x4); | 199 | ret = snd_soc_register_card(&mx27vis_aic32x4); |
197 | if (ret) { | 200 | if (ret) { |
@@ -213,11 +216,6 @@ static int __devinit mx27vis_aic32x4_probe(struct platform_device *pdev) | |||
213 | IMX_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0) | 216 | IMX_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0) |
214 | ); | 217 | ); |
215 | 218 | ||
216 | ret = mxc_gpio_setup_multiple_pins(mx27vis_amp_pins, | ||
217 | ARRAY_SIZE(mx27vis_amp_pins), "MX27VIS_AMP"); | ||
218 | if (ret) | ||
219 | printk(KERN_ERR "ASoC: unable to setup gpios\n"); | ||
220 | |||
221 | return ret; | 219 | return ret; |
222 | } | 220 | } |
223 | 221 | ||
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c index 50adf4032bcc..144d49603637 100644 --- a/sound/soc/fsl/p1022_ds.c +++ b/sound/soc/fsl/p1022_ds.c | |||
@@ -202,7 +202,6 @@ static int p1022_ds_probe(struct platform_device *pdev) | |||
202 | container_of(dev, struct platform_device, dev); | 202 | container_of(dev, struct platform_device, dev); |
203 | struct device_node *np = ssi_pdev->dev.of_node; | 203 | struct device_node *np = ssi_pdev->dev.of_node; |
204 | struct device_node *codec_np = NULL; | 204 | struct device_node *codec_np = NULL; |
205 | struct platform_device *sound_device = NULL; | ||
206 | struct machine_data *mdata; | 205 | struct machine_data *mdata; |
207 | int ret = -ENODEV; | 206 | int ret = -ENODEV; |
208 | const char *sprop; | 207 | const char *sprop; |
@@ -349,36 +348,23 @@ static int p1022_ds_probe(struct platform_device *pdev) | |||
349 | mdata->card.probe = p1022_ds_machine_probe; | 348 | mdata->card.probe = p1022_ds_machine_probe; |
350 | mdata->card.remove = p1022_ds_machine_remove; | 349 | mdata->card.remove = p1022_ds_machine_remove; |
351 | mdata->card.name = pdev->name; /* The platform driver name */ | 350 | mdata->card.name = pdev->name; /* The platform driver name */ |
351 | mdata->card.owner = THIS_MODULE; | ||
352 | mdata->card.dev = &pdev->dev; | ||
352 | mdata->card.num_links = 2; | 353 | mdata->card.num_links = 2; |
353 | mdata->card.dai_link = mdata->dai; | 354 | mdata->card.dai_link = mdata->dai; |
354 | 355 | ||
355 | /* Allocate a new audio platform device structure */ | ||
356 | sound_device = platform_device_alloc("soc-audio", -1); | ||
357 | if (!sound_device) { | ||
358 | dev_err(&pdev->dev, "platform device alloc failed\n"); | ||
359 | ret = -ENOMEM; | ||
360 | goto error; | ||
361 | } | ||
362 | |||
363 | /* Associate the card data with the sound device */ | ||
364 | platform_set_drvdata(sound_device, &mdata->card); | ||
365 | |||
366 | /* Register with ASoC */ | 356 | /* Register with ASoC */ |
367 | ret = platform_device_add(sound_device); | 357 | ret = snd_soc_register_card(&mdata->card); |
368 | if (ret) { | 358 | if (ret) { |
369 | dev_err(&pdev->dev, "platform device add failed\n"); | 359 | dev_err(&pdev->dev, "could not register card\n"); |
370 | goto error; | 360 | goto error; |
371 | } | 361 | } |
372 | dev_set_drvdata(&pdev->dev, sound_device); | ||
373 | 362 | ||
374 | of_node_put(codec_np); | 363 | of_node_put(codec_np); |
375 | 364 | ||
376 | return 0; | 365 | return 0; |
377 | 366 | ||
378 | error: | 367 | error: |
379 | if (sound_device) | ||
380 | platform_device_put(sound_device); | ||
381 | |||
382 | kfree(mdata); | 368 | kfree(mdata); |
383 | error_put: | 369 | error_put: |
384 | of_node_put(codec_np); | 370 | of_node_put(codec_np); |
@@ -392,17 +378,12 @@ error_put: | |||
392 | */ | 378 | */ |
393 | static int __devexit p1022_ds_remove(struct platform_device *pdev) | 379 | static int __devexit p1022_ds_remove(struct platform_device *pdev) |
394 | { | 380 | { |
395 | struct platform_device *sound_device = dev_get_drvdata(&pdev->dev); | 381 | struct snd_soc_card *card = platform_get_drvdata(pdev); |
396 | struct snd_soc_card *card = platform_get_drvdata(sound_device); | ||
397 | struct machine_data *mdata = | 382 | struct machine_data *mdata = |
398 | container_of(card, struct machine_data, card); | 383 | container_of(card, struct machine_data, card); |
399 | 384 | ||
400 | platform_device_unregister(sound_device); | 385 | snd_soc_unregister_card(card); |
401 | |||
402 | kfree(mdata); | 386 | kfree(mdata); |
403 | sound_device->dev.platform_data = NULL; | ||
404 | |||
405 | dev_set_drvdata(&pdev->dev, NULL); | ||
406 | 387 | ||
407 | return 0; | 388 | return 0; |
408 | } | 389 | } |
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c index b3af55dcde9d..4b63ec8eb372 100644 --- a/sound/soc/fsl/pcm030-audio-fabric.c +++ b/sound/soc/fsl/pcm030-audio-fabric.c | |||
@@ -12,32 +12,27 @@ | |||
12 | 12 | ||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/device.h> | 15 | #include <linux/device.h> |
17 | #include <linux/delay.h> | ||
18 | #include <linux/of_device.h> | 16 | #include <linux/of_device.h> |
19 | #include <linux/of_platform.h> | 17 | #include <linux/of_platform.h> |
20 | #include <linux/dma-mapping.h> | ||
21 | 18 | ||
22 | #include <sound/core.h> | ||
23 | #include <sound/pcm.h> | ||
24 | #include <sound/pcm_params.h> | ||
25 | #include <sound/initval.h> | ||
26 | #include <sound/soc.h> | 19 | #include <sound/soc.h> |
27 | 20 | ||
28 | #include "mpc5200_dma.h" | 21 | #include "mpc5200_dma.h" |
29 | #include "mpc5200_psc_ac97.h" | ||
30 | #include "../codecs/wm9712.h" | ||
31 | 22 | ||
32 | #define DRV_NAME "pcm030-audio-fabric" | 23 | #define DRV_NAME "pcm030-audio-fabric" |
33 | 24 | ||
25 | struct pcm030_audio_data { | ||
26 | struct snd_soc_card *card; | ||
27 | struct platform_device *codec_device; | ||
28 | }; | ||
29 | |||
34 | static struct snd_soc_dai_link pcm030_fabric_dai[] = { | 30 | static struct snd_soc_dai_link pcm030_fabric_dai[] = { |
35 | { | 31 | { |
36 | .name = "AC97", | 32 | .name = "AC97", |
37 | .stream_name = "AC97 Analog", | 33 | .stream_name = "AC97 Analog", |
38 | .codec_dai_name = "wm9712-hifi", | 34 | .codec_dai_name = "wm9712-hifi", |
39 | .cpu_dai_name = "mpc5200-psc-ac97.0", | 35 | .cpu_dai_name = "mpc5200-psc-ac97.0", |
40 | .platform_name = "mpc5200-pcm-audio", | ||
41 | .codec_name = "wm9712-codec", | 36 | .codec_name = "wm9712-codec", |
42 | }, | 37 | }, |
43 | { | 38 | { |
@@ -45,44 +40,95 @@ static struct snd_soc_dai_link pcm030_fabric_dai[] = { | |||
45 | .stream_name = "AC97 IEC958", | 40 | .stream_name = "AC97 IEC958", |
46 | .codec_dai_name = "wm9712-aux", | 41 | .codec_dai_name = "wm9712-aux", |
47 | .cpu_dai_name = "mpc5200-psc-ac97.1", | 42 | .cpu_dai_name = "mpc5200-psc-ac97.1", |
48 | .platform_name = "mpc5200-pcm-audio", | ||
49 | .codec_name = "wm9712-codec", | 43 | .codec_name = "wm9712-codec", |
50 | }, | 44 | }, |
51 | }; | 45 | }; |
52 | 46 | ||
53 | static struct snd_soc_card card = { | 47 | static struct snd_soc_card pcm030_card = { |
54 | .name = "pcm030", | 48 | .name = "pcm030", |
55 | .owner = THIS_MODULE, | 49 | .owner = THIS_MODULE, |
56 | .dai_link = pcm030_fabric_dai, | 50 | .dai_link = pcm030_fabric_dai, |
57 | .num_links = ARRAY_SIZE(pcm030_fabric_dai), | 51 | .num_links = ARRAY_SIZE(pcm030_fabric_dai), |
58 | }; | 52 | }; |
59 | 53 | ||
60 | static __init int pcm030_fabric_init(void) | 54 | static int __init pcm030_fabric_probe(struct platform_device *op) |
61 | { | 55 | { |
62 | struct platform_device *pdev; | 56 | struct device_node *np = op->dev.of_node; |
63 | int rc; | 57 | struct device_node *platform_np; |
58 | struct snd_soc_card *card = &pcm030_card; | ||
59 | struct pcm030_audio_data *pdata; | ||
60 | int ret; | ||
61 | int i; | ||
64 | 62 | ||
65 | if (!of_machine_is_compatible("phytec,pcm030")) | 63 | if (!of_machine_is_compatible("phytec,pcm030")) |
66 | return -ENODEV; | 64 | return -ENODEV; |
67 | 65 | ||
68 | pdev = platform_device_alloc("soc-audio", 1); | 66 | pdata = devm_kzalloc(&op->dev, sizeof(struct pcm030_audio_data), |
69 | if (!pdev) { | 67 | GFP_KERNEL); |
70 | pr_err("pcm030_fabric_init: platform_device_alloc() failed\n"); | 68 | if (!pdata) |
71 | return -ENODEV; | 69 | return -ENOMEM; |
72 | } | 70 | |
71 | card->dev = &op->dev; | ||
72 | platform_set_drvdata(op, pdata); | ||
73 | 73 | ||
74 | platform_set_drvdata(pdev, &card); | 74 | pdata->card = card; |
75 | 75 | ||
76 | rc = platform_device_add(pdev); | 76 | platform_np = of_parse_phandle(np, "asoc-platform", 0); |
77 | if (rc) { | 77 | if (!platform_np) { |
78 | pr_err("pcm030_fabric_init: platform_device_add() failed\n"); | 78 | dev_err(&op->dev, "ac97 not registered\n"); |
79 | platform_device_put(pdev); | ||
80 | return -ENODEV; | 79 | return -ENODEV; |
81 | } | 80 | } |
82 | return 0; | 81 | |
82 | for (i = 0; i < card->num_links; i++) | ||
83 | card->dai_link[i].platform_of_node = platform_np; | ||
84 | |||
85 | ret = request_module("snd-soc-wm9712"); | ||
86 | if (ret) | ||
87 | dev_err(&op->dev, "request_module returned: %d\n", ret); | ||
88 | |||
89 | pdata->codec_device = platform_device_alloc("wm9712-codec", -1); | ||
90 | if (!pdata->codec_device) | ||
91 | dev_err(&op->dev, "platform_device_alloc() failed\n"); | ||
92 | |||
93 | ret = platform_device_add(pdata->codec_device); | ||
94 | if (ret) | ||
95 | dev_err(&op->dev, "platform_device_add() failed: %d\n", ret); | ||
96 | |||
97 | ret = snd_soc_register_card(card); | ||
98 | if (ret) | ||
99 | dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret); | ||
100 | |||
101 | return ret; | ||
102 | } | ||
103 | |||
104 | static int __devexit pcm030_fabric_remove(struct platform_device *op) | ||
105 | { | ||
106 | struct pcm030_audio_data *pdata = platform_get_drvdata(op); | ||
107 | int ret; | ||
108 | |||
109 | ret = snd_soc_unregister_card(pdata->card); | ||
110 | platform_device_unregister(pdata->codec_device); | ||
111 | |||
112 | return ret; | ||
83 | } | 113 | } |
84 | 114 | ||
85 | module_init(pcm030_fabric_init); | 115 | static struct of_device_id pcm030_audio_match[] = { |
116 | { .compatible = "phytec,pcm030-audio-fabric", }, | ||
117 | {} | ||
118 | }; | ||
119 | MODULE_DEVICE_TABLE(of, pcm030_audio_match); | ||
120 | |||
121 | static struct platform_driver pcm030_fabric_driver = { | ||
122 | .probe = pcm030_fabric_probe, | ||
123 | .remove = __devexit_p(pcm030_fabric_remove), | ||
124 | .driver = { | ||
125 | .name = DRV_NAME, | ||
126 | .owner = THIS_MODULE, | ||
127 | .of_match_table = pcm030_audio_match, | ||
128 | }, | ||
129 | }; | ||
130 | |||
131 | module_platform_driver(pcm030_fabric_driver); | ||
86 | 132 | ||
87 | 133 | ||
88 | MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>"); | 134 | MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>"); |