aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/mxs/mxs-saif.c
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/mxs-saif.c
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/mxs-saif.c')
-rw-r--r--sound/soc/mxs/mxs-saif.c92
1 files changed, 59 insertions, 33 deletions
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