summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/mc13783.c
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2014-04-26 10:57:03 +0400
committerMark Brown <broonie@linaro.org>2014-04-30 02:24:54 +0400
commit780aaeff96819ca58e0cad830bfbe6eee9aef82c (patch)
tree28e36bd081b08efae0a1508fc66ac723588dad13 /sound/soc/codecs/mc13783.c
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
downloadlinux-780aaeff96819ca58e0cad830bfbe6eee9aef82c.tar.xz
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>
Diffstat (limited to 'sound/soc/codecs/mc13783.c')
-rw-r--r--sound/soc/codecs/mc13783.c14
1 files changed, 13 insertions, 1 deletions
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 @@
*/
#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>
@@ -750,6 +751,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);
@@ -760,7 +762,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);