aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/mxs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-23 16:05:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-23 16:05:43 -0400
commit2e341ca686042aa464efa755447e7bcee91d1eb6 (patch)
treec6b16b6b6a6e871fa04396cb2c7eb759bcad5be3 /sound/soc/mxs
parent927ad551031798d4cba49766549600bbb33872d7 (diff)
parent85e184e4c3cd3e2285ceab91ff8f0cac094e8a85 (diff)
Merge tag 'sound-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai: "This is the first big chunk for 3.5 merges of sound stuff. There are a few big changes in different areas. First off, the streaming logic of USB-audio endpoints has been largely rewritten for the better support of "implicit feedback". If anything about USB got broken, this change has to be checked. For HD-audio, the resume procedure was changed; instead of delaying the resume of the hardware until the first use, now waking up immediately at resume. This is for buggy BIOS. For ASoC, dynamic PCM support and the improved support for digital links between off-SoC devices are major framework changes. Some highlights are below: * HD-audio - Avoid accesses of invalid pin-control bits that may stall the codec - V-ref setup cleanups - Fix the races in power-saving code - Fix the races in codec cache hashes and connection lists - Split some common codes for BIOS auto-parser to hda_auto_parser.c - Changed the PM resume code to wake up immediately for buggy BIOS - Creative SoundCore3D support - Add Conexant CX20751/2/3/4 codec support * ASoC - Dynamic PCM support, allowing support for SoCs with internal routing through components with tight sequencing and formatting constraints within their internal paths or where there are multiple components connected with CPU managed DMA controllers inside the SoC. - Greatly improved support for direct digital links between off-SoC devices, providing a much simpler way of connecting things like digital basebands to CODECs. - Much more fine grained and robust locking, cleaning up some of the confusion that crept in with multi-component. - CPU support for nVidia Tegra 30 I2S and audio hub controllers and ST-Ericsson MSP I2S controolers - New CODEC drivers for Cirrus CS42L52, LAPIS Semiconductor ML26124, Texas Instruments LM49453. - Some regmap changes needed by the Tegra I2S driver. - mc13783 audio support. * Misc - Rewrite with module_pci_driver() - Xonar DGX support for snd-oxygen - Improvement of packet handling in snd-firewire driver - New USB-endpoint streaming logic - Enhanced M-audio FTU quirks and relevant cleanups - Increment the support of OSS devices to 256 - snd-aloop accuracy improvement There are a few more pending changes for 3.5, but they will be sent slightly later as partly depending on the changes of DRM." Fix up conflicts in regmap (due to duplicate patches, with some further updates then having already come in from the regmap tree). Also some fairly trivial context conflicts in the imx and mcx soc drivers. * tag 'sound-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (280 commits) ALSA: snd-usb: fix stream info output in /proc ALSA: pcm - Add proper state checks to snd_pcm_drain() ALSA: sh: Fix up namespace collision in sh_dac_audio. ALSA: hda/realtek - Fix unused variable compile warning ASoC: sh: fsi: enable chip specific data transfer mode ASoC: sh: fsi: call fsi_hw_startup/shutdown from fsi_dai_trigger() ASoC: sh: fsi: use same format for IN/OUT ASoC: sh: fsi: add fsi_version() and removed meaningless version check ASoC: sh: fsi: use register field macro name on IN/OUT_DMAC ASoC: tegra: Add machine driver for WM8753 codec ALSA: hda - Fix possible races of accesses to connection list array ASoC: OMAP: HDMI: Introduce codec ARM: mx31_3ds: Add sound support ASoC: imx-mc13783 cleanup mx31moboard: Add sound support ASoC: mc13783 codec cleanups ASoC: add imx-mc13783 sound support ASoC: Add mc13783 codec mfd: mc13xxx: add codec platform data ASoC: don't flip master of DT-instantiated DAI links ...
Diffstat (limited to 'sound/soc/mxs')
-rw-r--r--sound/soc/mxs/mxs-pcm.c24
-rw-r--r--sound/soc/mxs/mxs-pcm.h3
-rw-r--r--sound/soc/mxs/mxs-saif.c92
-rw-r--r--sound/soc/mxs/mxs-saif.h1
-rw-r--r--sound/soc/mxs/mxs-sgtl5000.c50
5 files changed, 116 insertions, 54 deletions
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c
index e373fbbc97a0..373dec90579f 100644
--- a/sound/soc/mxs/mxs-pcm.c
+++ b/sound/soc/mxs/mxs-pcm.c
@@ -220,28 +220,16 @@ static struct snd_soc_platform_driver mxs_soc_platform = {
220 .pcm_free = mxs_pcm_free, 220 .pcm_free = mxs_pcm_free,
221}; 221};
222 222
223static int __devinit mxs_soc_platform_probe(struct platform_device *pdev) 223int __devinit mxs_pcm_platform_register(struct device *dev)
224{ 224{
225 return snd_soc_register_platform(&pdev->dev, &mxs_soc_platform); 225 return snd_soc_register_platform(dev, &mxs_soc_platform);
226} 226}
227EXPORT_SYMBOL_GPL(mxs_pcm_platform_register);
227 228
228static int __devexit mxs_soc_platform_remove(struct platform_device *pdev) 229void __devexit mxs_pcm_platform_unregister(struct device *dev)
229{ 230{
230 snd_soc_unregister_platform(&pdev->dev); 231 snd_soc_unregister_platform(dev);
231
232 return 0;
233} 232}
234 233EXPORT_SYMBOL_GPL(mxs_pcm_platform_unregister);
235static struct platform_driver mxs_pcm_driver = {
236 .driver = {
237 .name = "mxs-pcm-audio",
238 .owner = THIS_MODULE,
239 },
240 .probe = mxs_soc_platform_probe,
241 .remove = __devexit_p(mxs_soc_platform_remove),
242};
243
244module_platform_driver(mxs_pcm_driver);
245 234
246MODULE_LICENSE("GPL"); 235MODULE_LICENSE("GPL");
247MODULE_ALIAS("platform:mxs-pcm-audio");
diff --git a/sound/soc/mxs/mxs-pcm.h b/sound/soc/mxs/mxs-pcm.h
index 5f01a9124b3d..35ba2ca42384 100644
--- a/sound/soc/mxs/mxs-pcm.h
+++ b/sound/soc/mxs/mxs-pcm.h
@@ -24,4 +24,7 @@ struct mxs_pcm_dma_params {
24 int chan_num; 24 int chan_num;
25}; 25};
26 26
27int mxs_pcm_platform_register(struct device *dev);
28void mxs_pcm_platform_unregister(struct device *dev);
29
27#endif 30#endif
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 7fd224bb7324..aba71bfa33b1 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -18,6 +18,8 @@
18 18
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/of.h>
22#include <linux/of_device.h>
21#include <linux/platform_device.h> 23#include <linux/platform_device.h>
22#include <linux/slab.h> 24#include <linux/slab.h>
23#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
@@ -621,37 +623,57 @@ static irqreturn_t mxs_saif_irq(int irq, void *dev_id)
621 return IRQ_HANDLED; 623 return IRQ_HANDLED;
622} 624}
623 625
624static int mxs_saif_probe(struct platform_device *pdev) 626static int __devinit mxs_saif_probe(struct platform_device *pdev)
625{ 627{
628 struct device_node *np = pdev->dev.of_node;
626 struct resource *iores, *dmares; 629 struct resource *iores, *dmares;
627 struct mxs_saif *saif; 630 struct mxs_saif *saif;
628 struct mxs_saif_platform_data *pdata; 631 struct mxs_saif_platform_data *pdata;
629 struct pinctrl *pinctrl; 632 struct pinctrl *pinctrl;
630 int ret = 0; 633 int ret = 0;
631 634
632 if (pdev->id >= ARRAY_SIZE(mxs_saif)) 635
636 if (!np && pdev->id >= ARRAY_SIZE(mxs_saif))
633 return -EINVAL; 637 return -EINVAL;
634 638
635 saif = devm_kzalloc(&pdev->dev, sizeof(*saif), GFP_KERNEL); 639 saif = devm_kzalloc(&pdev->dev, sizeof(*saif), GFP_KERNEL);
636 if (!saif) 640 if (!saif)
637 return -ENOMEM; 641 return -ENOMEM;
638 642
639 mxs_saif[pdev->id] = saif; 643 if (np) {
640 saif->id = pdev->id; 644 struct device_node *master;
641 645 saif->id = of_alias_get_id(np, "saif");
642 pdata = pdev->dev.platform_data; 646 if (saif->id < 0)
643 if (pdata && !pdata->master_mode) { 647 return saif->id;
644 saif->master_id = pdata->master_id; 648 /*
645 if (saif->master_id < 0 || 649 * If there is no "fsl,saif-master" phandle, it's a saif
646 saif->master_id >= ARRAY_SIZE(mxs_saif) || 650 * master. Otherwise, it's a slave and its phandle points
647 saif->master_id == saif->id) { 651 * to the master.
648 dev_err(&pdev->dev, "get wrong master id\n"); 652 */
649 return -EINVAL; 653 master = of_parse_phandle(np, "fsl,saif-master", 0);
654 if (!master) {
655 saif->master_id = saif->id;
656 } else {
657 saif->master_id = of_alias_get_id(master, "saif");
658 if (saif->master_id < 0)
659 return saif->master_id;
650 } 660 }
651 } else { 661 } else {
652 saif->master_id = saif->id; 662 saif->id = pdev->id;
663 pdata = pdev->dev.platform_data;
664 if (pdata && !pdata->master_mode)
665 saif->master_id = pdata->master_id;
666 else
667 saif->master_id = saif->id;
668 }
669
670 if (saif->master_id < 0 || saif->master_id >= ARRAY_SIZE(mxs_saif)) {
671 dev_err(&pdev->dev, "get wrong master id\n");
672 return -EINVAL;
653 } 673 }
654 674
675 mxs_saif[saif->id] = saif;
676
655 pinctrl = devm_pinctrl_get_select_default(&pdev->dev); 677 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
656 if (IS_ERR(pinctrl)) { 678 if (IS_ERR(pinctrl)) {
657 ret = PTR_ERR(pinctrl); 679 ret = PTR_ERR(pinctrl);
@@ -677,12 +699,19 @@ static int mxs_saif_probe(struct platform_device *pdev)
677 699
678 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); 700 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
679 if (!dmares) { 701 if (!dmares) {
680 ret = -ENODEV; 702 /*
681 dev_err(&pdev->dev, "failed to get dma resource: %d\n", 703 * TODO: This is a temporary solution and should be changed
682 ret); 704 * to use generic DMA binding later when the helplers get in.
683 goto failed_get_resource; 705 */
706 ret = of_property_read_u32(np, "fsl,saif-dma-channel",
707 &saif->dma_param.chan_num);
708 if (ret) {
709 dev_err(&pdev->dev, "failed to get dma channel\n");
710 goto failed_get_resource;
711 }
712 } else {
713 saif->dma_param.chan_num = dmares->start;
684 } 714 }
685 saif->dma_param.chan_num = dmares->start;
686 715
687 saif->irq = platform_get_irq(pdev, 0); 716 saif->irq = platform_get_irq(pdev, 0);
688 if (saif->irq < 0) { 717 if (saif->irq < 0) {
@@ -716,24 +745,14 @@ static int mxs_saif_probe(struct platform_device *pdev)
716 goto failed_get_resource; 745 goto failed_get_resource;
717 } 746 }
718 747
719 saif->soc_platform_pdev = platform_device_alloc( 748 ret = mxs_pcm_platform_register(&pdev->dev);
720 "mxs-pcm-audio", pdev->id);
721 if (!saif->soc_platform_pdev) {
722 ret = -ENOMEM;
723 goto failed_pdev_alloc;
724 }
725
726 platform_set_drvdata(saif->soc_platform_pdev, saif);
727 ret = platform_device_add(saif->soc_platform_pdev);
728 if (ret) { 749 if (ret) {
729 dev_err(&pdev->dev, "failed to add soc platform device\n"); 750 dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
730 goto failed_pdev_add; 751 goto failed_pdev_alloc;
731 } 752 }
732 753
733 return 0; 754 return 0;
734 755
735failed_pdev_add:
736 platform_device_put(saif->soc_platform_pdev);
737failed_pdev_alloc: 756failed_pdev_alloc:
738 snd_soc_unregister_dai(&pdev->dev); 757 snd_soc_unregister_dai(&pdev->dev);
739failed_get_resource: 758failed_get_resource:
@@ -746,13 +765,19 @@ static int __devexit mxs_saif_remove(struct platform_device *pdev)
746{ 765{
747 struct mxs_saif *saif = platform_get_drvdata(pdev); 766 struct mxs_saif *saif = platform_get_drvdata(pdev);
748 767
749 platform_device_unregister(saif->soc_platform_pdev); 768 mxs_pcm_platform_unregister(&pdev->dev);
750 snd_soc_unregister_dai(&pdev->dev); 769 snd_soc_unregister_dai(&pdev->dev);
751 clk_put(saif->clk); 770 clk_put(saif->clk);
752 771
753 return 0; 772 return 0;
754} 773}
755 774
775static const struct of_device_id mxs_saif_dt_ids[] = {
776 { .compatible = "fsl,imx28-saif", },
777 { /* sentinel */ }
778};
779MODULE_DEVICE_TABLE(of, mxs_saif_dt_ids);
780
756static struct platform_driver mxs_saif_driver = { 781static struct platform_driver mxs_saif_driver = {
757 .probe = mxs_saif_probe, 782 .probe = mxs_saif_probe,
758 .remove = __devexit_p(mxs_saif_remove), 783 .remove = __devexit_p(mxs_saif_remove),
@@ -760,6 +785,7 @@ static struct platform_driver mxs_saif_driver = {
760 .driver = { 785 .driver = {
761 .name = "mxs-saif", 786 .name = "mxs-saif",
762 .owner = THIS_MODULE, 787 .owner = THIS_MODULE,
788 .of_match_table = mxs_saif_dt_ids,
763 }, 789 },
764}; 790};
765 791
diff --git a/sound/soc/mxs/mxs-saif.h b/sound/soc/mxs/mxs-saif.h
index 12c91e4eb941..3cb342e5bc90 100644
--- a/sound/soc/mxs/mxs-saif.h
+++ b/sound/soc/mxs/mxs-saif.h
@@ -123,7 +123,6 @@ struct mxs_saif {
123 unsigned int cur_rate; 123 unsigned int cur_rate;
124 unsigned int ongoing; 124 unsigned int ongoing;
125 125
126 struct platform_device *soc_platform_pdev;
127 u32 fifo_underrun; 126 u32 fifo_underrun;
128 u32 fifo_overrun; 127 u32 fifo_overrun;
129}; 128};
diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c
index 60f052b7cf22..3e6e8764b2e6 100644
--- a/sound/soc/mxs/mxs-sgtl5000.c
+++ b/sound/soc/mxs/mxs-sgtl5000.c
@@ -18,6 +18,8 @@
18 18
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/of.h>
22#include <linux/of_device.h>
21#include <sound/core.h> 23#include <sound/core.h>
22#include <sound/pcm.h> 24#include <sound/pcm.h>
23#include <sound/soc.h> 25#include <sound/soc.h>
@@ -90,7 +92,7 @@ static struct snd_soc_dai_link mxs_sgtl5000_dai[] = {
90 .codec_dai_name = "sgtl5000", 92 .codec_dai_name = "sgtl5000",
91 .codec_name = "sgtl5000.0-000a", 93 .codec_name = "sgtl5000.0-000a",
92 .cpu_dai_name = "mxs-saif.0", 94 .cpu_dai_name = "mxs-saif.0",
93 .platform_name = "mxs-pcm-audio.0", 95 .platform_name = "mxs-saif.0",
94 .ops = &mxs_sgtl5000_hifi_ops, 96 .ops = &mxs_sgtl5000_hifi_ops,
95 }, { 97 }, {
96 .name = "HiFi Rx", 98 .name = "HiFi Rx",
@@ -98,7 +100,7 @@ static struct snd_soc_dai_link mxs_sgtl5000_dai[] = {
98 .codec_dai_name = "sgtl5000", 100 .codec_dai_name = "sgtl5000",
99 .codec_name = "sgtl5000.0-000a", 101 .codec_name = "sgtl5000.0-000a",
100 .cpu_dai_name = "mxs-saif.1", 102 .cpu_dai_name = "mxs-saif.1",
101 .platform_name = "mxs-pcm-audio.1", 103 .platform_name = "mxs-saif.1",
102 .ops = &mxs_sgtl5000_hifi_ops, 104 .ops = &mxs_sgtl5000_hifi_ops,
103 }, 105 },
104}; 106};
@@ -110,11 +112,48 @@ static struct snd_soc_card mxs_sgtl5000 = {
110 .num_links = ARRAY_SIZE(mxs_sgtl5000_dai), 112 .num_links = ARRAY_SIZE(mxs_sgtl5000_dai),
111}; 113};
112 114
115static int __devinit mxs_sgtl5000_probe_dt(struct platform_device *pdev)
116{
117 struct device_node *np = pdev->dev.of_node;
118 struct device_node *saif_np[2], *codec_np;
119 int i, ret = 0;
120
121 if (!np)
122 return 1; /* no device tree */
123
124 saif_np[0] = of_parse_phandle(np, "saif-controllers", 0);
125 saif_np[1] = of_parse_phandle(np, "saif-controllers", 1);
126 codec_np = of_parse_phandle(np, "audio-codec", 0);
127 if (!saif_np[0] || !saif_np[1] || !codec_np) {
128 dev_err(&pdev->dev, "phandle missing or invalid\n");
129 return -EINVAL;
130 }
131
132 for (i = 0; i < 2; i++) {
133 mxs_sgtl5000_dai[i].codec_name = NULL;
134 mxs_sgtl5000_dai[i].codec_of_node = codec_np;
135 mxs_sgtl5000_dai[i].cpu_dai_name = NULL;
136 mxs_sgtl5000_dai[i].cpu_dai_of_node = saif_np[i];
137 mxs_sgtl5000_dai[i].platform_name = NULL;
138 mxs_sgtl5000_dai[i].platform_of_node = saif_np[i];
139 }
140
141 of_node_put(codec_np);
142 of_node_put(saif_np[0]);
143 of_node_put(saif_np[1]);
144
145 return ret;
146}
147
113static int __devinit mxs_sgtl5000_probe(struct platform_device *pdev) 148static int __devinit mxs_sgtl5000_probe(struct platform_device *pdev)
114{ 149{
115 struct snd_soc_card *card = &mxs_sgtl5000; 150 struct snd_soc_card *card = &mxs_sgtl5000;
116 int ret; 151 int ret;
117 152
153 ret = mxs_sgtl5000_probe_dt(pdev);
154 if (ret < 0)
155 return ret;
156
118 /* 157 /*
119 * Set an init clock(11.28Mhz) for sgtl5000 initialization(i2c r/w). 158 * Set an init clock(11.28Mhz) for sgtl5000 initialization(i2c r/w).
120 * The Sgtl5000 sysclk is derived from saif0 mclk and it's range 159 * The Sgtl5000 sysclk is derived from saif0 mclk and it's range
@@ -148,10 +187,17 @@ static int __devexit mxs_sgtl5000_remove(struct platform_device *pdev)
148 return 0; 187 return 0;
149} 188}
150 189
190static const struct of_device_id mxs_sgtl5000_dt_ids[] = {
191 { .compatible = "fsl,mxs-audio-sgtl5000", },
192 { /* sentinel */ }
193};
194MODULE_DEVICE_TABLE(of, mxs_sgtl5000_dt_ids);
195
151static struct platform_driver mxs_sgtl5000_audio_driver = { 196static struct platform_driver mxs_sgtl5000_audio_driver = {
152 .driver = { 197 .driver = {
153 .name = "mxs-sgtl5000", 198 .name = "mxs-sgtl5000",
154 .owner = THIS_MODULE, 199 .owner = THIS_MODULE,
200 .of_match_table = mxs_sgtl5000_dt_ids,
155 }, 201 },
156 .probe = mxs_sgtl5000_probe, 202 .probe = mxs_sgtl5000_probe,
157 .remove = __devexit_p(mxs_sgtl5000_remove), 203 .remove = __devexit_p(mxs_sgtl5000_remove),