Commit dcf08424 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: simple-card: add comment to indicate don't remove platforms

Basically CPU and Platform are different Component, but if CPU is using
soc-generic-dmaengine-pcm, same dev will be shared between CPU and
Platform, and Simple Card had been supporting it.

When we focus to clean up Simple Card driver, we tend to remove platforms
if no Platform was selected, but it is wrong because of above reasons.

This patch adds comment why we shouldn't remove platforms.

In case of CPU is not using soc-generic-dmaengine-pcm, CPU and Platform
will be duplicated, but it will be ignored by snd_soc_rtd_add_component().
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875yattwqv.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3e1a334a
...@@ -613,10 +613,16 @@ static int graph_count_noml(struct asoc_simple_priv *priv, ...@@ -613,10 +613,16 @@ static int graph_count_noml(struct asoc_simple_priv *priv,
return -EINVAL; return -EINVAL;
} }
/*
* DON'T REMOVE platforms
* see
* simple-card.c :: simple_count_noml()
*/
li->num[li->link].cpus = 1; li->num[li->link].cpus = 1;
li->num[li->link].codecs = 1;
li->num[li->link].platforms = 1; li->num[li->link].platforms = 1;
li->num[li->link].codecs = 1;
li->link += 1; /* 1xCPU-Codec */ li->link += 1; /* 1xCPU-Codec */
dev_dbg(dev, "Count As Normal\n"); dev_dbg(dev, "Count As Normal\n");
...@@ -637,6 +643,11 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv, ...@@ -637,6 +643,11 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
} }
if (li->cpu) { if (li->cpu) {
/*
* DON'T REMOVE platforms
* see
* simple-card.c :: simple_count_noml()
*/
li->num[li->link].cpus = 1; li->num[li->link].cpus = 1;
li->num[li->link].platforms = 1; li->num[li->link].platforms = 1;
......
...@@ -1046,8 +1046,14 @@ static int graph_count_normal(struct asoc_simple_priv *priv, ...@@ -1046,8 +1046,14 @@ static int graph_count_normal(struct asoc_simple_priv *priv,
* => lnk: port { endpoint { .. }; }; * => lnk: port { endpoint { .. }; };
* }; * };
*/ */
/*
* DON'T REMOVE platforms
* see
* simple-card.c :: simple_count_noml()
*/
li->num[li->link].cpus = li->num[li->link].cpus =
li->num[li->link].platforms = graph_counter(cpu_port); li->num[li->link].platforms = graph_counter(cpu_port);
li->num[li->link].codecs = graph_counter(codec_port); li->num[li->link].codecs = graph_counter(codec_port);
of_node_put(cpu_ep); of_node_put(cpu_ep);
...@@ -1079,6 +1085,11 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv, ...@@ -1079,6 +1085,11 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
*/ */
if (asoc_graph_is_ports0(lnk)) { if (asoc_graph_is_ports0(lnk)) {
/*
* DON'T REMOVE platforms
* see
* simple-card.c :: simple_count_noml()
*/
li->num[li->link].cpus = graph_counter(rport); /* FE */ li->num[li->link].cpus = graph_counter(rport); /* FE */
li->num[li->link].platforms = graph_counter(rport); li->num[li->link].platforms = graph_counter(rport);
} else { } else {
...@@ -1113,8 +1124,14 @@ static int graph_count_c2c(struct asoc_simple_priv *priv, ...@@ -1113,8 +1124,14 @@ static int graph_count_c2c(struct asoc_simple_priv *priv,
* }; * };
* }; * };
*/ */
/*
* DON'T REMOVE platforms
* see
* simple-card.c :: simple_count_noml()
*/
li->num[li->link].cpus = li->num[li->link].cpus =
li->num[li->link].platforms = graph_counter(codec0); li->num[li->link].platforms = graph_counter(codec0);
li->num[li->link].codecs = graph_counter(codec1); li->num[li->link].codecs = graph_counter(codec1);
of_node_put(ports); of_node_put(ports);
......
...@@ -638,7 +638,16 @@ EXPORT_SYMBOL_GPL(asoc_simple_dai_init); ...@@ -638,7 +638,16 @@ EXPORT_SYMBOL_GPL(asoc_simple_dai_init);
void asoc_simple_canonicalize_platform(struct snd_soc_dai_link_component *platforms, void asoc_simple_canonicalize_platform(struct snd_soc_dai_link_component *platforms,
struct snd_soc_dai_link_component *cpus) struct snd_soc_dai_link_component *cpus)
{ {
/* Assumes platform == cpu */ /*
* Assumes Platform == CPU
*
* Some CPU might be using soc-generic-dmaengine-pcm. This means CPU and Platform
* are different Component, but are sharing same component->dev.
*
* Let's assume Platform is same as CPU if it doesn't identify Platform on DT.
* see
* simple-card.c :: simple_count_noml()
*/
if (!platforms->of_node) if (!platforms->of_node)
platforms->of_node = cpus->of_node; platforms->of_node = cpus->of_node;
} }
......
...@@ -509,10 +509,25 @@ static int simple_count_noml(struct asoc_simple_priv *priv, ...@@ -509,10 +509,25 @@ static int simple_count_noml(struct asoc_simple_priv *priv,
return -EINVAL; return -EINVAL;
} }
/*
* DON'T REMOVE platforms
*
* Some CPU might be using soc-generic-dmaengine-pcm. This means CPU and Platform
* are different Component, but are sharing same component->dev.
* Simple Card had been supported it without special Platform selection.
* We need platforms here.
*
* In case of no Platform, it will be Platform == CPU, but Platform will be
* ignored by snd_soc_rtd_add_component().
*
* see
* simple-card-utils.c :: asoc_simple_canonicalize_platform()
*/
li->num[li->link].cpus = 1; li->num[li->link].cpus = 1;
li->num[li->link].codecs = 1;
li->num[li->link].platforms = 1; li->num[li->link].platforms = 1;
li->num[li->link].codecs = 1;
li->link += 1; li->link += 1;
return 0; return 0;
...@@ -531,6 +546,11 @@ static int simple_count_dpcm(struct asoc_simple_priv *priv, ...@@ -531,6 +546,11 @@ static int simple_count_dpcm(struct asoc_simple_priv *priv,
} }
if (li->cpu) { if (li->cpu) {
/*
* DON'T REMOVE platforms
* see
* simple_count_noml()
*/
li->num[li->link].cpus = 1; li->num[li->link].cpus = 1;
li->num[li->link].platforms = 1; li->num[li->link].platforms = 1;
......
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