mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-06 02:24:14 +08:00
ASoC: simple-card: count DAI / link numbers as in order
simple-card checks DT links 2 times. 1st is for counting DAIs / links to allocating memory, 2nd is for detecting DAIs. To detecting DAIs as CPU-dummy -> dummy-Codec order when DPCM case, it uses loops 2 times at 2nd DT link check. But it doesn't do it at 1st DT link check. for (li.cpu = 1; li.cpu >= 0; li.cpu--) { /* * Detect all CPU first, and Detect all Codec 2n * * In Normal sound case, all DAIs are detected * as "CPU-Codec". * * In DPCM sound case, * all CPUs are detected as "CPU-dummy", and * all Codecs are detected as "dummy-Codec". * To avoid random sub-device numbering, * detect "dummy-Codec" in last; */ ret = simple_for_each_link(...); ... } To prepare supporting multi-CPU/Codec, and code cleanup, this patch use same loop for 1st DT link check, too. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/877dlu1tp2.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
e9cbcf23a2
commit
a6e8798061
@ -483,9 +483,17 @@ static int simple_count_noml(struct asoc_simple_priv *priv,
|
|||||||
struct device_node *codec,
|
struct device_node *codec,
|
||||||
struct link_info *li, bool is_top)
|
struct link_info *li, bool is_top)
|
||||||
{
|
{
|
||||||
li->dais++; /* CPU or Codec */
|
/*
|
||||||
if (np != codec)
|
* |CPU |Codec : turn
|
||||||
li->link++; /* CPU-Codec */
|
* CPU |Pass |return
|
||||||
|
* Codec |return|return
|
||||||
|
* np
|
||||||
|
*/
|
||||||
|
if (!li->cpu || np == codec)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
li->link += 1;
|
||||||
|
li->dais += 2;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -495,10 +503,23 @@ static int simple_count_dpcm(struct asoc_simple_priv *priv,
|
|||||||
struct device_node *codec,
|
struct device_node *codec,
|
||||||
struct link_info *li, bool is_top)
|
struct link_info *li, bool is_top)
|
||||||
{
|
{
|
||||||
li->dais++; /* CPU or Codec */
|
/*
|
||||||
li->link++; /* CPU-dummy or dummy-Codec */
|
* |CPU |Codec : turn
|
||||||
if (np == codec)
|
* CPU |Pass |return
|
||||||
|
* Codec |return|Pass
|
||||||
|
* np
|
||||||
|
*/
|
||||||
|
if (li->cpu == (np == codec))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (li->cpu) {
|
||||||
|
li->link++; /* CPU-dummy */
|
||||||
|
li->dais++;
|
||||||
|
} else {
|
||||||
|
li->link++; /* dummy-Codec */
|
||||||
|
li->dais++;
|
||||||
li->conf++;
|
li->conf++;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -562,6 +583,7 @@ static void simple_get_dais_count(struct asoc_simple_priv *priv,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (li->cpu = 1; li->cpu >= 0; li->cpu--)
|
||||||
simple_for_each_link(priv, li,
|
simple_for_each_link(priv, li,
|
||||||
simple_count_noml,
|
simple_count_noml,
|
||||||
simple_count_dpcm);
|
simple_count_dpcm);
|
||||||
|
Loading…
Reference in New Issue
Block a user