All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: mc13783: Add devicetree support
@ 2014-04-26  6:57 Alexander Shiyan
       [not found] ` <1398495423-2223-1-git-send-email-shc_work-JGs/UdohzUI@public.gmane.org>
  0 siblings, 1 reply; 20+ messages in thread
From: Alexander Shiyan @ 2014-04-26  6:57 UTC (permalink / raw)
  To: alsa-devel
  Cc: devicetree, Samuel Ortiz, Alexander Shiyan, Takashi Iwai,
	Liam Girdwood, Mark Brown, Lee Jones

This patch adds devicetree support for mc13783-codec.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 Documentation/devicetree/bindings/mfd/mc13xxx.txt |  3 +++
 drivers/mfd/mc13xxx-core.c                        | 10 +++++++---
 sound/soc/codecs/mc13783.c                        | 14 +++++++++++++-
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/mc13xxx.txt b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
index 1413f39..8aba488 100644
--- a/Documentation/devicetree/bindings/mfd/mc13xxx.txt
+++ b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
@@ -10,6 +10,9 @@ Optional properties:
 - fsl,mc13xxx-uses-touch : Indicate the touchscreen controller is being used
 
 Sub-nodes:
+- codec: Contain the Audio Codec node.
+  - adc-port: Contain PMIC SSI port number used for ADC.
+  - dac-port: Contain PMIC SSI port number used for DAC.
 - leds : Contain the led nodes and initial register values in property
   "led-control". Number of register depends of used IC, for MC13783 is 6,
   for MC13892 is 4, for MC34708 is 1. See datasheet for bits definitions of
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 06e64b6..0c6c21c 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -673,9 +673,13 @@ int mc13xxx_common_init(struct device *dev)
 	if (mc13xxx->flags & MC13XXX_USE_ADC)
 		mc13xxx_add_subdevice(mc13xxx, "%s-adc");
 
-	if (mc13xxx->flags & MC13XXX_USE_CODEC)
-		mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec",
-					pdata->codec, sizeof(*pdata->codec));
+	if (mc13xxx->flags & MC13XXX_USE_CODEC) {
+		if (pdata)
+			mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec",
+				pdata->codec, sizeof(*pdata->codec));
+		else
+			mc13xxx_add_subdevice(mc13xxx, "%s-codec");
+	}
 
 	if (mc13xxx->flags & MC13XXX_USE_RTC)
 		mc13xxx_add_subdevice(mc13xxx, "%s-rtc");
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index 0b0a4ca..9965277 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -22,6 +22,7 @@
  */
 #include <linux/module.h>
 #include <linux/device.h>
+#include <linux/of.h>
 #include <linux/mfd/mc13xxx.h>
 #include <linux/slab.h>
 #include <sound/core.h>
@@ -748,6 +749,7 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
 {
 	struct mc13783_priv *priv;
 	struct mc13xxx_codec_platform_data *pdata = pdev->dev.platform_data;
+	struct device_node *np;
 	int ret;
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
@@ -758,7 +760,17 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
 		priv->adc_ssi_port = pdata->adc_ssi_port;
 		priv->dac_ssi_port = pdata->dac_ssi_port;
 	} else {
-		return -ENOSYS;
+		np = of_get_child_by_name(pdev->dev.parent->of_node, "codec");
+		if (!np)
+			return -ENOSYS;
+
+		ret = of_property_read_u32(np, "adc-port", &priv->adc_ssi_port);
+		if (ret)
+			return ret;
+
+		ret = of_property_read_u32(np, "dac-port", &priv->dac_ssi_port);
+		if (ret)
+			return ret;
 	}
 
 	dev_set_drvdata(&pdev->dev, priv);
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-05-03  1:49 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-26  6:57 [PATCH] ASoC: mc13783: Add devicetree support Alexander Shiyan
     [not found] ` <1398495423-2223-1-git-send-email-shc_work-JGs/UdohzUI@public.gmane.org>
2014-04-28 11:17   ` Lee Jones
2014-04-29 22:25   ` Mark Brown
     [not found]     ` <20140429222522.GS15125-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-04-30 14:08       ` Lee Jones
2014-04-30 14:11         ` Alexander Shiyan
     [not found]           ` <1398867073.695596467-rKA3owyty39sdVUOrk1QfQ@public.gmane.org>
2014-04-30 14:17             ` Lee Jones
2014-04-30 14:20               ` Alexander Shiyan
     [not found]                 ` <1398867618.574635813-rKA3owyty39sdVUOrk1QfQ@public.gmane.org>
2014-04-30 14:24                   ` Lee Jones
2014-04-30 14:28                     ` Alexander Shiyan
     [not found]                       ` <1398868130.411182088-rKA3owyty39sdVUOrk1QfQ@public.gmane.org>
2014-04-30 14:33                         ` Lee Jones
2014-04-30 14:40                           ` Alexander Shiyan
     [not found]                             ` <1398868829.456957971-NHsxxyuixOdsdVUOrk1QfQ@public.gmane.org>
2014-04-30 14:46                               ` Lee Jones
2014-04-30 14:58                                 ` Alexander Shiyan
2014-04-30 18:06               ` Mark Brown
     [not found]                 ` <20140430180653.GB3245-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-04-30 18:12                   ` Alexander Shiyan
     [not found]                     ` <1398881556.141711961-JZ33oUlt0U9sdVUOrk1QfQ@public.gmane.org>
2014-04-30 18:23                       ` Mark Brown
2014-05-01  7:42                   ` Lee Jones
2014-05-01 15:06                     ` Mark Brown
     [not found]                       ` <20140501150653.GZ3245-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-05-02  8:09                         ` Lee Jones
2014-05-03  1:49                           ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.