Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: pxa: pxa-ssp: add DT bindings

The pxa ssp DAI acts as a user of a pxa ssp port, and needs an
appropriate 'port' phandle in DT to reference the upstream.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>

authored by

Daniel Mack and committed by
Mark Brown
2023c90c 4210606b

+59 -6
+28
Documentation/devicetree/bindings/sound/mrvl,pxa-ssp.txt
··· 1 + Marvell PXA SSP CPU DAI bindings 2 + 3 + Required properties: 4 + 5 + compatible Must be "mrvl,pxa-ssp-dai" 6 + port A phandle reference to a PXA ssp upstream device 7 + 8 + Example: 9 + 10 + /* upstream device */ 11 + 12 + ssp0: ssp@41000000 { 13 + compatible = "mrvl,pxa3xx-ssp"; 14 + reg = <0x41000000 0x40>; 15 + interrupts = <24>; 16 + clock-names = "pxa27x-ssp.0"; 17 + dmas = <&dma 13 18 + &dma 14>; 19 + dma-names = "rx", "tx"; 20 + }; 21 + 22 + /* DAI as user */ 23 + 24 + ssp_dai0: ssp_dai@0 { 25 + compatible = "mrvl,pxa-ssp-dai"; 26 + port = <&ssp0>; 27 + }; 28 +
+31 -6
sound/soc/pxa/pxa-ssp.c
··· 21 21 #include <linux/clk.h> 22 22 #include <linux/io.h> 23 23 #include <linux/pxa2xx_ssp.h> 24 + #include <linux/of.h> 24 25 25 26 #include <asm/irq.h> 26 27 ··· 720 719 721 720 static int pxa_ssp_probe(struct snd_soc_dai *dai) 722 721 { 722 + struct device *dev = dai->dev; 723 723 struct ssp_priv *priv; 724 724 int ret; 725 725 ··· 728 726 if (!priv) 729 727 return -ENOMEM; 730 728 731 - priv->ssp = pxa_ssp_request(dai->id + 1, "SoC audio"); 732 - if (priv->ssp == NULL) { 733 - ret = -ENODEV; 734 - goto err_priv; 729 + if (dev->of_node) { 730 + struct device_node *ssp_handle; 731 + 732 + ssp_handle = of_parse_phandle(dev->of_node, "port", 0); 733 + if (!ssp_handle) { 734 + dev_err(dev, "unable to get 'port' phandle\n"); 735 + return -ENODEV; 736 + } 737 + 738 + priv->ssp = pxa_ssp_request_of(ssp_handle, "SoC audio"); 739 + if (priv->ssp == NULL) { 740 + ret = -ENODEV; 741 + goto err_priv; 742 + } 743 + } else { 744 + priv->ssp = pxa_ssp_request(dai->id + 1, "SoC audio"); 745 + if (priv->ssp == NULL) { 746 + ret = -ENODEV; 747 + goto err_priv; 748 + } 735 749 } 736 750 737 751 priv->dai_fmt = (unsigned int) -1; ··· 816 798 .name = "pxa-ssp", 817 799 }; 818 800 801 + #ifdef CONFIG_OF 802 + static const struct of_device_id pxa_ssp_of_ids[] = { 803 + { .compatible = "mrvl,pxa-ssp-dai" }, 804 + }; 805 + #endif 806 + 819 807 static int asoc_ssp_probe(struct platform_device *pdev) 820 808 { 821 809 return snd_soc_register_component(&pdev->dev, &pxa_ssp_component, ··· 836 812 837 813 static struct platform_driver asoc_ssp_driver = { 838 814 .driver = { 839 - .name = "pxa-ssp-dai", 840 - .owner = THIS_MODULE, 815 + .name = "pxa-ssp-dai", 816 + .owner = THIS_MODULE, 817 + .of_match_table = of_match_ptr(pxa_ssp_of_ids), 841 818 }, 842 819 843 820 .probe = asoc_ssp_probe,