Commit 5525cf07 authored by Daniel Baluta's avatar Daniel Baluta Committed by Mark Brown

ASoC: simple-card: Don't create separate link when platform is present

In normal sound case all DAIs are detected as CPU-Codec.
simple_dai_link_of supports the presence of a platform but it counts
it as a CPU DAI resulting in the creation of an extra link.

Adding a platform property to a link description like:

simple-audio-card,dai-link {
	cpu {
		sound-dai = <&sai1>;
	};
	plat {
		sound-dai = <&dsp>;
	};
	codec {
		sound-dai = <&wm8960>;
	}

will result in the creation of two links:
	* sai1 <-> wm8960
	* dsp  <-> wm8960

which is obviously not what we want. We just want one single link
with:
	* sai1 <-> wm8960 (and platform set to dsp).
Signed-off-by: default avatarDaniel Baluta <daniel.baluta@nxp.com>
Acked-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20191209135353.17427-1-daniel.baluta@nxp.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a3039aef
...@@ -371,6 +371,7 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, ...@@ -371,6 +371,7 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
do { do {
struct asoc_simple_data adata; struct asoc_simple_data adata;
struct device_node *codec; struct device_node *codec;
struct device_node *plat;
struct device_node *np; struct device_node *np;
int num = of_get_child_count(node); int num = of_get_child_count(node);
...@@ -381,6 +382,9 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, ...@@ -381,6 +382,9 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
ret = -ENODEV; ret = -ENODEV;
goto error; goto error;
} }
/* get platform */
plat = of_get_child_by_name(node, is_top ?
PREFIX "plat" : "plat");
/* get convert-xxx property */ /* get convert-xxx property */
memset(&adata, 0, sizeof(adata)); memset(&adata, 0, sizeof(adata));
...@@ -389,6 +393,8 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, ...@@ -389,6 +393,8 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
/* loop for all CPU/Codec node */ /* loop for all CPU/Codec node */
for_each_child_of_node(node, np) { for_each_child_of_node(node, np) {
if (plat == np)
continue;
/* /*
* It is DPCM * It is DPCM
* if it has many CPUs, * if it has many CPUs,
......
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