diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2014-06-22 17:59:28 -0700 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-07-02 12:35:56 +0100 |
commit | 34cb6123f90d264d63bdcd3ee0df0d2cb4b36aab (patch) | |
tree | 201069d465c2f0c7144933e9f995b192c99d8f9c /sound/soc/sh/rcar/dvc.c | |
parent | 340371005d399b595f4044fc5e336f4a66ead101 (diff) | |
download | op-kernel-dev-34cb6123f90d264d63bdcd3ee0df0d2cb4b36aab.zip op-kernel-dev-34cb6123f90d264d63bdcd3ee0df0d2cb4b36aab.tar.gz |
ASoC: rsnd: add DT support to DVC
Now, DVC can use DT
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/sh/rcar/dvc.c')
-rw-r--r-- | sound/soc/sh/rcar/dvc.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index deef310..9096fb0 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c @@ -235,6 +235,42 @@ struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id) return &((struct rsnd_dvc *)(priv->dvc) + id)->mod; } +static void rsnd_of_parse_dvc(struct platform_device *pdev, + const struct rsnd_of_data *of_data, + struct rsnd_priv *priv) +{ + struct device_node *node; + struct rsnd_dvc_platform_info *dvc_info; + struct rcar_snd_info *info = rsnd_priv_to_info(priv); + struct device *dev = &pdev->dev; + int nr; + + if (!of_data) + return; + + node = of_get_child_by_name(dev->of_node, "rcar_sound,dvc"); + if (!node) + return; + + nr = of_get_child_count(node); + if (!nr) + goto rsnd_of_parse_dvc_end; + + dvc_info = devm_kzalloc(dev, + sizeof(struct rsnd_dvc_platform_info) * nr, + GFP_KERNEL); + if (!dvc_info) { + dev_err(dev, "dvc info allocation error\n"); + goto rsnd_of_parse_dvc_end; + } + + info->dvc_info = dvc_info; + info->dvc_info_nr = nr; + +rsnd_of_parse_dvc_end: + of_node_put(node); +} + int rsnd_dvc_probe(struct platform_device *pdev, const struct rsnd_of_data *of_data, struct rsnd_priv *priv) @@ -246,6 +282,8 @@ int rsnd_dvc_probe(struct platform_device *pdev, char name[RSND_DVC_NAME_SIZE]; int i, nr; + rsnd_of_parse_dvc(pdev, of_data, priv); + nr = info->dvc_info_nr; if (!nr) return 0; |