aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Mack2013-08-12 03:42:38 -0500
committerMark Brown2013-08-15 05:29:07 -0500
commit2023c90c3a2c4c1aeb7f47649367d551c676da07 (patch)
treeb41ee4768697271583fef04d09be4f487322e9b2
parent4210606b19852dce52ed1a687db816695b6048e1 (diff)
downloadti-linux-kernel-2023c90c3a2c4c1aeb7f47649367d551c676da07.tar.gz
ti-linux-kernel-2023c90c3a2c4c1aeb7f47649367d551c676da07.tar.xz
ti-linux-kernel-2023c90c3a2c4c1aeb7f47649367d551c676da07.zip
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>
-rw-r--r--Documentation/devicetree/bindings/sound/mrvl,pxa-ssp.txt28
-rw-r--r--sound/soc/pxa/pxa-ssp.c37
2 files changed, 59 insertions, 6 deletions
diff --git a/Documentation/devicetree/bindings/sound/mrvl,pxa-ssp.txt b/Documentation/devicetree/bindings/sound/mrvl,pxa-ssp.txt
new file mode 100644
index 000000000000..74c9ba6c2823
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/mrvl,pxa-ssp.txt
@@ -0,0 +1,28 @@
1Marvell PXA SSP CPU DAI bindings
2
3Required properties:
4
5 compatible Must be "mrvl,pxa-ssp-dai"
6 port A phandle reference to a PXA ssp upstream device
7
8Example:
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
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 6f4dd7543e82..19296f22cb28 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -21,6 +21,7 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/pxa2xx_ssp.h> 23#include <linux/pxa2xx_ssp.h>
24#include <linux/of.h>
24 25
25#include <asm/irq.h> 26#include <asm/irq.h>
26 27
@@ -719,6 +720,7 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd,
719 720
720static int pxa_ssp_probe(struct snd_soc_dai *dai) 721static int pxa_ssp_probe(struct snd_soc_dai *dai)
721{ 722{
723 struct device *dev = dai->dev;
722 struct ssp_priv *priv; 724 struct ssp_priv *priv;
723 int ret; 725 int ret;
724 726
@@ -726,10 +728,26 @@ static int pxa_ssp_probe(struct snd_soc_dai *dai)
726 if (!priv) 728 if (!priv)
727 return -ENOMEM; 729 return -ENOMEM;
728 730
729 priv->ssp = pxa_ssp_request(dai->id + 1, "SoC audio"); 731 if (dev->of_node) {
730 if (priv->ssp == NULL) { 732 struct device_node *ssp_handle;
731 ret = -ENODEV; 733
732 goto err_priv; 734 ssp_handle = of_parse_phandle(dev->of_node, "port", 0);
735 if (!ssp_handle) {
736 dev_err(dev, "unable to get 'port' phandle\n");
737 return -ENODEV;
738 }
739
740 priv->ssp = pxa_ssp_request_of(ssp_handle, "SoC audio");
741 if (priv->ssp == NULL) {
742 ret = -ENODEV;
743 goto err_priv;
744 }
745 } else {
746 priv->ssp = pxa_ssp_request(dai->id + 1, "SoC audio");
747 if (priv->ssp == NULL) {
748 ret = -ENODEV;
749 goto err_priv;
750 }
733 } 751 }
734 752
735 priv->dai_fmt = (unsigned int) -1; 753 priv->dai_fmt = (unsigned int) -1;
@@ -798,6 +816,12 @@ static const struct snd_soc_component_driver pxa_ssp_component = {
798 .name = "pxa-ssp", 816 .name = "pxa-ssp",
799}; 817};
800 818
819#ifdef CONFIG_OF
820static const struct of_device_id pxa_ssp_of_ids[] = {
821 { .compatible = "mrvl,pxa-ssp-dai" },
822};
823#endif
824
801static int asoc_ssp_probe(struct platform_device *pdev) 825static int asoc_ssp_probe(struct platform_device *pdev)
802{ 826{
803 return snd_soc_register_component(&pdev->dev, &pxa_ssp_component, 827 return snd_soc_register_component(&pdev->dev, &pxa_ssp_component,
@@ -812,8 +836,9 @@ static int asoc_ssp_remove(struct platform_device *pdev)
812 836
813static struct platform_driver asoc_ssp_driver = { 837static struct platform_driver asoc_ssp_driver = {
814 .driver = { 838 .driver = {
815 .name = "pxa-ssp-dai", 839 .name = "pxa-ssp-dai",
816 .owner = THIS_MODULE, 840 .owner = THIS_MODULE,
841 .of_match_table = of_match_ptr(pxa_ssp_of_ids),
817 }, 842 },
818 843
819 .probe = asoc_ssp_probe, 844 .probe = asoc_ssp_probe,