summaryrefslogtreecommitdiff
path: root/sound/soc/generic
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2021-04-12 08:52:04 +0900
committerMark Brown <broonie@kernel.org>2021-04-13 12:32:46 +0100
commitf899006d558546a8ee39c93f816eb3847c5bc6c0 (patch)
tree880c8c3e884404dec70b77ce78df5ac136ab1fb2 /sound/soc/generic
parent59f5cd96e9b9e1025ab0a9dc4ce9dd8633190794 (diff)
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87sg3wwfa3.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/generic')
-rw-r--r--sound/soc/generic/audio-graph-card.c10
-rw-r--r--sound/soc/generic/simple-card-utils.c14
-rw-r--r--sound/soc/generic/simple-card.c11
3 files changed, 12 insertions, 23 deletions
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 5ce5b7d62ee0..3a5bef2a91d3 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -552,7 +552,7 @@ int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev)
memset(&li, 0, sizeof(li));
graph_get_dais_count(priv, &li);
- if (!li.link || !li.dais)
+ if (!li.link)
return -EINVAL;
ret = asoc_simple_init_priv(priv, &li);
@@ -622,7 +622,6 @@ static int graph_count_noml(struct asoc_simple_priv *priv,
li->num[li->link].platforms = 1;
li->link += 1; /* 1xCPU-Codec */
- li->dais += 2; /* 1xCPU + 1xCodec */
dev_dbg(dev, "Count As Normal\n");
@@ -646,13 +645,10 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
li->num[li->link].platforms = 1;
li->link++; /* 1xCPU-dummy */
- li->dais++; /* 1xCPU */
} else {
li->num[li->link].codecs = 1;
li->link++; /* 1xdummy-Codec */
- li->conf++; /* 1xdummy-Codec */
- li->dais++; /* 1xCodec */
}
dev_dbg(dev, "Count As DPCM\n");
@@ -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,
struct link_info *li)
{
- struct device *dev = simple_priv_to_dev(priv);
-
/*
* link_num : number of links.
* CPU-Codec / CPU-dummy / dummy-Codec
@@ -714,8 +708,6 @@ static void graph_get_dais_count(struct asoc_simple_priv *priv,
graph_for_each_link(priv, li,
graph_count_noml,
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)
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index ca74dfa58458..59b4fb2bd586 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -597,7 +597,7 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
struct asoc_simple_dai *dais;
struct snd_soc_dai_link_component *dlcs;
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_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,
dai_num += cc;
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);
@@ -620,12 +623,15 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
if (!dais || !dlcs)
return -ENOMEM;
- if (li->conf) {
- cconf = devm_kcalloc(dev, li->conf, sizeof(*cconf), GFP_KERNEL);
+ if (cnf_num) {
+ cconf = devm_kcalloc(dev, cnf_num, sizeof(*cconf), GFP_KERNEL);
if (!cconf)
return -ENOMEM;
}
+ dev_dbg(dev, "link %d, dais %d, ccnf %d\n",
+ li->link, dai_num, cnf_num);
+
/* dummy CPU/Codec */
priv->dummy.of_node = NULL;
priv->dummy.dai_name = "snd-soc-dummy-dai";
@@ -640,7 +646,7 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
card->dai_link = priv->dai_link;
card->num_links = li->link;
card->codec_conf = cconf;
- card->num_configs = li->conf;
+ card->num_configs = cnf_num;
for (i = 0; i < li->link; i++) {
if (li->num[i].cpus) {
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 30da8272fbc0..7665bbf2a6c0 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -495,7 +495,6 @@ static int simple_count_noml(struct asoc_simple_priv *priv,
li->num[li->link].platforms = 1;
li->link += 1;
- li->dais += 2;
return 0;
}
@@ -517,13 +516,10 @@ static int simple_count_dpcm(struct asoc_simple_priv *priv,
li->num[li->link].platforms = 1;
li->link++; /* CPU-dummy */
- li->dais++;
} else {
li->num[li->link].codecs = 1;
li->link++; /* dummy-Codec */
- li->dais++;
- li->conf++;
}
return 0;
@@ -587,17 +583,12 @@ static void simple_get_dais_count(struct asoc_simple_priv *priv,
li->num[0].platforms = 1;
li->link = 1;
- li->dais = 2;
- li->conf = 0;
return;
}
simple_for_each_link(priv, li,
simple_count_noml,
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)
@@ -637,7 +628,7 @@ static int asoc_simple_probe(struct platform_device *pdev)
memset(&li, 0, sizeof(li));
simple_get_dais_count(priv, &li);
- if (!li.link || !li.dais)
+ if (!li.link)
return -EINVAL;
ret = asoc_simple_init_priv(priv, &li);