aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2014-04-26 02:57:03 -0400
committerMark Brown <broonie@linaro.org>2014-04-29 18:24:54 -0400
commit780aaeff96819ca58e0cad830bfbe6eee9aef82c (patch)
tree28e36bd081b08efae0a1508fc66ac723588dad13
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
ASoC: mc13783: Add devicetree support
This patch adds devicetree support for mc13783-codec. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--Documentation/devicetree/bindings/mfd/mc13xxx.txt3
-rw-r--r--drivers/mfd/mc13xxx-core.c10
-rw-r--r--sound/soc/codecs/mc13783.c14
3 files changed, 23 insertions, 4 deletions
diff --git a/Documentation/devicetree/bindings/mfd/mc13xxx.txt b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
index 1413f39912d3..8aba48821a85 100644
--- a/Documentation/devicetree/bindings/mfd/mc13xxx.txt
+++ b/Documentation/devicetree/bindings/mfd/mc13xxx.txt
@@ -10,6 +10,9 @@ Optional properties:
10- fsl,mc13xxx-uses-touch : Indicate the touchscreen controller is being used 10- fsl,mc13xxx-uses-touch : Indicate the touchscreen controller is being used
11 11
12Sub-nodes: 12Sub-nodes:
13- codec: Contain the Audio Codec node.
14 - adc-port: Contain PMIC SSI port number used for ADC.
15 - dac-port: Contain PMIC SSI port number used for DAC.
13- leds : Contain the led nodes and initial register values in property 16- leds : Contain the led nodes and initial register values in property
14 "led-control". Number of register depends of used IC, for MC13783 is 6, 17 "led-control". Number of register depends of used IC, for MC13783 is 6,
15 for MC13892 is 4, for MC34708 is 1. See datasheet for bits definitions of 18 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 06e64b6fcb89..0c6c21c5b1a8 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -673,9 +673,13 @@ int mc13xxx_common_init(struct device *dev)
673 if (mc13xxx->flags & MC13XXX_USE_ADC) 673 if (mc13xxx->flags & MC13XXX_USE_ADC)
674 mc13xxx_add_subdevice(mc13xxx, "%s-adc"); 674 mc13xxx_add_subdevice(mc13xxx, "%s-adc");
675 675
676 if (mc13xxx->flags & MC13XXX_USE_CODEC) 676 if (mc13xxx->flags & MC13XXX_USE_CODEC) {
677 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec", 677 if (pdata)
678 pdata->codec, sizeof(*pdata->codec)); 678 mc13xxx_add_subdevice_pdata(mc13xxx, "%s-codec",
679 pdata->codec, sizeof(*pdata->codec));
680 else
681 mc13xxx_add_subdevice(mc13xxx, "%s-codec");
682 }
679 683
680 if (mc13xxx->flags & MC13XXX_USE_RTC) 684 if (mc13xxx->flags & MC13XXX_USE_RTC)
681 mc13xxx_add_subdevice(mc13xxx, "%s-rtc"); 685 mc13xxx_add_subdevice(mc13xxx, "%s-rtc");
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index 2c59b1fb69dc..a7118052f32a 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -22,6 +22,7 @@
22 */ 22 */
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/of.h>
25#include <linux/mfd/mc13xxx.h> 26#include <linux/mfd/mc13xxx.h>
26#include <linux/slab.h> 27#include <linux/slab.h>
27#include <sound/core.h> 28#include <sound/core.h>
@@ -750,6 +751,7 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
750{ 751{
751 struct mc13783_priv *priv; 752 struct mc13783_priv *priv;
752 struct mc13xxx_codec_platform_data *pdata = pdev->dev.platform_data; 753 struct mc13xxx_codec_platform_data *pdata = pdev->dev.platform_data;
754 struct device_node *np;
753 int ret; 755 int ret;
754 756
755 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 757 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
@@ -760,7 +762,17 @@ static int __init mc13783_codec_probe(struct platform_device *pdev)
760 priv->adc_ssi_port = pdata->adc_ssi_port; 762 priv->adc_ssi_port = pdata->adc_ssi_port;
761 priv->dac_ssi_port = pdata->dac_ssi_port; 763 priv->dac_ssi_port = pdata->dac_ssi_port;
762 } else { 764 } else {
763 return -ENOSYS; 765 np = of_get_child_by_name(pdev->dev.parent->of_node, "codec");
766 if (!np)
767 return -ENOSYS;
768
769 ret = of_property_read_u32(np, "adc-port", &priv->adc_ssi_port);
770 if (ret)
771 return ret;
772
773 ret = of_property_read_u32(np, "dac-port", &priv->dac_ssi_port);
774 if (ret)
775 return ret;
764 } 776 }
765 777
766 dev_set_drvdata(&pdev->dev, priv); 778 dev_set_drvdata(&pdev->dev, priv);