Commit 970dc991 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: simple-card.c: enable multi Component support

If CPU/Codec driver keeps its DAI node, we can directly identify actual
DAI by using snd_soc_get_dai_via_args().
This means we can use multi Component.

This patch enables multi Component support for Simple Card
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878rboo943.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 90de551c
...@@ -52,11 +52,13 @@ static int asoc_simple_parse_platform(struct device_node *node, ...@@ -52,11 +52,13 @@ static int asoc_simple_parse_platform(struct device_node *node,
return 0; return 0;
} }
static int asoc_simple_parse_dai(struct device_node *node, static int asoc_simple_parse_dai(struct device *dev,
struct device_node *node,
struct snd_soc_dai_link_component *dlc, struct snd_soc_dai_link_component *dlc,
int *is_single_link) int *is_single_link)
{ {
struct of_phandle_args args; struct of_phandle_args args;
struct snd_soc_dai *dai;
int ret; int ret;
if (!node) if (!node)
...@@ -70,6 +72,19 @@ static int asoc_simple_parse_dai(struct device_node *node, ...@@ -70,6 +72,19 @@ static int asoc_simple_parse_dai(struct device_node *node,
if (ret) if (ret)
return ret; return ret;
/*
* Try to find from DAI args
*/
dai = snd_soc_get_dai_via_args(&args);
if (dai) {
dlc->dai_name = snd_soc_dai_name_get(dai);
dlc->dai_args = snd_soc_copy_dai_args(dev, &args);
if (!dlc->dai_args)
return -ENOMEM;
goto parse_dai_end;
}
/* /*
* FIXME * FIXME
* *
...@@ -93,6 +108,7 @@ static int asoc_simple_parse_dai(struct device_node *node, ...@@ -93,6 +108,7 @@ static int asoc_simple_parse_dai(struct device_node *node,
if (ret < 0) if (ret < 0)
return ret; return ret;
parse_dai_end:
if (is_single_link) if (is_single_link)
*is_single_link = !args.args_count; *is_single_link = !args.args_count;
...@@ -156,7 +172,7 @@ static int simple_parse_node(struct asoc_simple_priv *priv, ...@@ -156,7 +172,7 @@ static int simple_parse_node(struct asoc_simple_priv *priv,
simple_parse_mclk_fs(top, np, dai_props, prefix); simple_parse_mclk_fs(top, np, dai_props, prefix);
ret = asoc_simple_parse_dai(np, dlc, cpu); ret = asoc_simple_parse_dai(dev, np, dlc, cpu);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment