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

ASoC: simple-card-utils: remove li->dais/li->conf

li->dais is same as number of CPU + Codec,
li->conf is same as number of Codec when dummy-Codec.

li->dais/li->conf are no longer needed.
This patch removes these.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sg3wwfa3.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 59f5cd96
...@@ -75,9 +75,7 @@ struct asoc_simple_priv { ...@@ -75,9 +75,7 @@ struct asoc_simple_priv {
#define simple_priv_to_link(priv, i) (simple_priv_to_card(priv)->dai_link + (i)) #define simple_priv_to_link(priv, i) (simple_priv_to_card(priv)->dai_link + (i))
struct link_info { struct link_info {
int dais; /* number of dai */
int link; /* number of link */ int link; /* number of link */
int conf; /* number of codec_conf */
int cpu; /* turn for CPU / Codec */ int cpu; /* turn for CPU / Codec */
struct prop_nums num[SNDRV_MINOR_DEVICES]; struct prop_nums num[SNDRV_MINOR_DEVICES];
}; };
......
...@@ -552,7 +552,7 @@ int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev) ...@@ -552,7 +552,7 @@ int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev)
memset(&li, 0, sizeof(li)); memset(&li, 0, sizeof(li));
graph_get_dais_count(priv, &li); graph_get_dais_count(priv, &li);
if (!li.link || !li.dais) if (!li.link)
return -EINVAL; return -EINVAL;
ret = asoc_simple_init_priv(priv, &li); ret = asoc_simple_init_priv(priv, &li);
...@@ -622,7 +622,6 @@ static int graph_count_noml(struct asoc_simple_priv *priv, ...@@ -622,7 +622,6 @@ static int graph_count_noml(struct asoc_simple_priv *priv,
li->num[li->link].platforms = 1; li->num[li->link].platforms = 1;
li->link += 1; /* 1xCPU-Codec */ li->link += 1; /* 1xCPU-Codec */
li->dais += 2; /* 1xCPU + 1xCodec */
dev_dbg(dev, "Count As Normal\n"); dev_dbg(dev, "Count As Normal\n");
...@@ -646,13 +645,10 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv, ...@@ -646,13 +645,10 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
li->num[li->link].platforms = 1; li->num[li->link].platforms = 1;
li->link++; /* 1xCPU-dummy */ li->link++; /* 1xCPU-dummy */
li->dais++; /* 1xCPU */
} else { } else {
li->num[li->link].codecs = 1; li->num[li->link].codecs = 1;
li->link++; /* 1xdummy-Codec */ li->link++; /* 1xdummy-Codec */
li->conf++; /* 1xdummy-Codec */
li->dais++; /* 1xCodec */
} }
dev_dbg(dev, "Count As DPCM\n"); dev_dbg(dev, "Count As DPCM\n");
...@@ -663,8 +659,6 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv, ...@@ -663,8 +659,6 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
static void graph_get_dais_count(struct asoc_simple_priv *priv, static void graph_get_dais_count(struct asoc_simple_priv *priv,
struct link_info *li) struct link_info *li)
{ {
struct device *dev = simple_priv_to_dev(priv);
/* /*
* link_num : number of links. * link_num : number of links.
* CPU-Codec / CPU-dummy / dummy-Codec * CPU-Codec / CPU-dummy / dummy-Codec
...@@ -714,8 +708,6 @@ static void graph_get_dais_count(struct asoc_simple_priv *priv, ...@@ -714,8 +708,6 @@ static void graph_get_dais_count(struct asoc_simple_priv *priv,
graph_for_each_link(priv, li, graph_for_each_link(priv, li,
graph_count_noml, graph_count_noml,
graph_count_dpcm); graph_count_dpcm);
dev_dbg(dev, "link %d, dais %d, ccnf %d\n",
li->link, li->dais, li->conf);
} }
int audio_graph_card_probe(struct snd_soc_card *card) int audio_graph_card_probe(struct snd_soc_card *card)
......
...@@ -597,7 +597,7 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv, ...@@ -597,7 +597,7 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
struct asoc_simple_dai *dais; struct asoc_simple_dai *dais;
struct snd_soc_dai_link_component *dlcs; struct snd_soc_dai_link_component *dlcs;
struct snd_soc_codec_conf *cconf = NULL; struct snd_soc_codec_conf *cconf = NULL;
int i, dai_num = 0, dlc_num = 0; int i, dai_num = 0, dlc_num = 0, cnf_num = 0;
dai_props = devm_kcalloc(dev, li->link, sizeof(*dai_props), GFP_KERNEL); dai_props = devm_kcalloc(dev, li->link, sizeof(*dai_props), GFP_KERNEL);
dai_link = devm_kcalloc(dev, li->link, sizeof(*dai_link), GFP_KERNEL); dai_link = devm_kcalloc(dev, li->link, sizeof(*dai_link), GFP_KERNEL);
...@@ -613,6 +613,9 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv, ...@@ -613,6 +613,9 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
dai_num += cc; dai_num += cc;
dlc_num += cc + li->num[i].platforms; dlc_num += cc + li->num[i].platforms;
if (!li->num[i].cpus)
cnf_num += li->num[i].codecs;
} }
dais = devm_kcalloc(dev, dai_num, sizeof(*dais), GFP_KERNEL); dais = devm_kcalloc(dev, dai_num, sizeof(*dais), GFP_KERNEL);
...@@ -620,12 +623,15 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv, ...@@ -620,12 +623,15 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
if (!dais || !dlcs) if (!dais || !dlcs)
return -ENOMEM; return -ENOMEM;
if (li->conf) { if (cnf_num) {
cconf = devm_kcalloc(dev, li->conf, sizeof(*cconf), GFP_KERNEL); cconf = devm_kcalloc(dev, cnf_num, sizeof(*cconf), GFP_KERNEL);
if (!cconf) if (!cconf)
return -ENOMEM; return -ENOMEM;
} }
dev_dbg(dev, "link %d, dais %d, ccnf %d\n",
li->link, dai_num, cnf_num);
/* dummy CPU/Codec */ /* dummy CPU/Codec */
priv->dummy.of_node = NULL; priv->dummy.of_node = NULL;
priv->dummy.dai_name = "snd-soc-dummy-dai"; priv->dummy.dai_name = "snd-soc-dummy-dai";
...@@ -640,7 +646,7 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv, ...@@ -640,7 +646,7 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
card->dai_link = priv->dai_link; card->dai_link = priv->dai_link;
card->num_links = li->link; card->num_links = li->link;
card->codec_conf = cconf; card->codec_conf = cconf;
card->num_configs = li->conf; card->num_configs = cnf_num;
for (i = 0; i < li->link; i++) { for (i = 0; i < li->link; i++) {
if (li->num[i].cpus) { if (li->num[i].cpus) {
......
...@@ -495,7 +495,6 @@ static int simple_count_noml(struct asoc_simple_priv *priv, ...@@ -495,7 +495,6 @@ static int simple_count_noml(struct asoc_simple_priv *priv,
li->num[li->link].platforms = 1; li->num[li->link].platforms = 1;
li->link += 1; li->link += 1;
li->dais += 2;
return 0; return 0;
} }
...@@ -517,13 +516,10 @@ static int simple_count_dpcm(struct asoc_simple_priv *priv, ...@@ -517,13 +516,10 @@ static int simple_count_dpcm(struct asoc_simple_priv *priv,
li->num[li->link].platforms = 1; li->num[li->link].platforms = 1;
li->link++; /* CPU-dummy */ li->link++; /* CPU-dummy */
li->dais++;
} else { } else {
li->num[li->link].codecs = 1; li->num[li->link].codecs = 1;
li->link++; /* dummy-Codec */ li->link++; /* dummy-Codec */
li->dais++;
li->conf++;
} }
return 0; return 0;
...@@ -587,17 +583,12 @@ static void simple_get_dais_count(struct asoc_simple_priv *priv, ...@@ -587,17 +583,12 @@ static void simple_get_dais_count(struct asoc_simple_priv *priv,
li->num[0].platforms = 1; li->num[0].platforms = 1;
li->link = 1; li->link = 1;
li->dais = 2;
li->conf = 0;
return; return;
} }
simple_for_each_link(priv, li, simple_for_each_link(priv, li,
simple_count_noml, simple_count_noml,
simple_count_dpcm); simple_count_dpcm);
dev_dbg(dev, "link %d, dais %d, ccnf %d\n",
li->link, li->dais, li->conf);
} }
static int simple_soc_probe(struct snd_soc_card *card) static int simple_soc_probe(struct snd_soc_card *card)
...@@ -637,7 +628,7 @@ static int asoc_simple_probe(struct platform_device *pdev) ...@@ -637,7 +628,7 @@ static int asoc_simple_probe(struct platform_device *pdev)
memset(&li, 0, sizeof(li)); memset(&li, 0, sizeof(li));
simple_get_dais_count(priv, &li); simple_get_dais_count(priv, &li);
if (!li.link || !li.dais) if (!li.link)
return -EINVAL; return -EINVAL;
ret = asoc_simple_init_priv(priv, &li); ret = asoc_simple_init_priv(priv, &li);
......
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