[PATCH v2 04/12] ASoC: simple-card-utils: remove asoc_simple_parse_xxx()
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Mon Apr 12 01:52:13 CEST 2021
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
ASoC is now supporting multi DAI, but, current
simple-card / audio-graph are assuming fixed single DAI.
Now, asoc_simple_parse_xxx() macro is assuming single DAI.
To support multi-CPU/Codec, this patch unpack asoc_simple_parse_xxx()
macro, and uses "&dai_link->cpus[i]" instead of "dai_link->cpus".
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
include/sound/simple_card_utils.h | 11 -----------
sound/soc/generic/audio-graph-card.c | 16 ++++++++--------
sound/soc/generic/simple-card.c | 18 +++++++++---------
3 files changed, 17 insertions(+), 28 deletions(-)
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index de40f09d226f..23f17ccc7908 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -120,10 +120,6 @@ int asoc_simple_set_dailink_name(struct device *dev,
int asoc_simple_parse_card_name(struct snd_soc_card *card,
char *prefix);
-#define asoc_simple_parse_clk_cpu(dev, node, dai_link, simple_dai) \
- asoc_simple_parse_clk(dev, node, simple_dai, dai_link->cpus)
-#define asoc_simple_parse_clk_codec(dev, node, dai_link, simple_dai) \
- asoc_simple_parse_clk(dev, node, simple_dai, dai_link->codecs)
int asoc_simple_parse_clk(struct device *dev,
struct device_node *node,
struct asoc_simple_dai *simple_dai,
@@ -136,13 +132,6 @@ int asoc_simple_dai_init(struct snd_soc_pcm_runtime *rtd);
int asoc_simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params);
-#define asoc_simple_parse_cpu(node, dai_link, is_single_link) \
- asoc_simple_parse_dai(node, dai_link->cpus, is_single_link)
-#define asoc_simple_parse_codec(node, dai_link) \
- asoc_simple_parse_dai(node, dai_link->codecs, NULL)
-#define asoc_simple_parse_platform(node, dai_link) \
- asoc_simple_parse_dai(node, dai_link->platforms, NULL)
-
#define asoc_simple_parse_tdm(np, dai) \
snd_soc_of_parse_tdm_slot(np, &(dai)->tx_slot_mask, \
&(dai)->rx_slot_mask, \
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 3a5bef2a91d3..145f8a19c9e8 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -247,11 +247,11 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
dai = dai_props->cpu_dai;
- ret = asoc_simple_parse_cpu(ep, dai_link, &is_single_links);
+ ret = asoc_simple_parse_dai(ep, dai_link->cpus, &is_single_links);
if (ret)
goto out_put_node;
- ret = asoc_simple_parse_clk_cpu(dev, ep, dai_link, dai);
+ ret = asoc_simple_parse_clk(dev, ep, dai, dai_link->cpus);
if (ret < 0)
goto out_put_node;
@@ -290,11 +290,11 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
dai = dai_props->codec_dai;
cconf = dai_props->codec_conf;
- ret = asoc_simple_parse_codec(ep, dai_link);
+ ret = asoc_simple_parse_dai(ep, dai_link->codecs, NULL);
if (ret < 0)
goto out_put_node;
- ret = asoc_simple_parse_clk_codec(dev, ep, dai_link, dai);
+ ret = asoc_simple_parse_clk(dev, ep, dai, dai_link->codecs);
if (ret < 0)
goto out_put_node;
@@ -371,11 +371,11 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv,
if (ret < 0)
return ret;
- ret = asoc_simple_parse_cpu(cpu_ep, dai_link, &single_cpu);
+ ret = asoc_simple_parse_dai(cpu_ep, dai_link->cpus, &single_cpu);
if (ret < 0)
return ret;
- ret = asoc_simple_parse_codec(codec_ep, dai_link);
+ ret = asoc_simple_parse_dai(codec_ep, dai_link->codecs, NULL);
if (ret < 0)
return ret;
@@ -387,11 +387,11 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv,
if (ret < 0)
return ret;
- ret = asoc_simple_parse_clk_cpu(dev, cpu_ep, dai_link, cpu_dai);
+ ret = asoc_simple_parse_clk(dev, cpu_ep, cpu_dai, dai_link->cpus);
if (ret < 0)
return ret;
- ret = asoc_simple_parse_clk_codec(dev, codec_ep, dai_link, codec_dai);
+ ret = asoc_simple_parse_clk(dev, codec_ep, codec_dai, dai_link->codecs);
if (ret < 0)
return ret;
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 7665bbf2a6c0..6a55b8672166 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -148,11 +148,11 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv,
dai = dai_props->cpu_dai;
- ret = asoc_simple_parse_cpu(np, dai_link, &is_single_links);
+ ret = asoc_simple_parse_dai(np, dai_link->cpus, &is_single_links);
if (ret)
goto out_put_node;
- ret = asoc_simple_parse_clk_cpu(dev, np, dai_link, dai);
+ ret = asoc_simple_parse_clk(dev, np, dai, dai_link->cpus);
if (ret < 0)
goto out_put_node;
@@ -176,11 +176,11 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv,
dai = dai_props->codec_dai;
cconf = dai_props->codec_conf;
- ret = asoc_simple_parse_codec(np, dai_link);
+ ret = asoc_simple_parse_dai(np, dai_link->codecs, NULL);
if (ret < 0)
goto out_put_node;
- ret = asoc_simple_parse_clk_codec(dev, np, dai_link, dai);
+ ret = asoc_simple_parse_clk(dev, np, dai, dai_link->codecs);
if (ret < 0)
goto out_put_node;
@@ -260,15 +260,15 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
simple_parse_mclk_fs(top, cpu, codec, dai_props, prefix);
- ret = asoc_simple_parse_cpu(cpu, dai_link, &single_cpu);
+ ret = asoc_simple_parse_dai(cpu, dai_link->cpus, &single_cpu);
if (ret < 0)
goto dai_link_of_err;
- ret = asoc_simple_parse_codec(codec, dai_link);
+ ret = asoc_simple_parse_dai(codec, dai_link->codecs, NULL);
if (ret < 0)
goto dai_link_of_err;
- ret = asoc_simple_parse_platform(plat, dai_link);
+ ret = asoc_simple_parse_dai(plat, dai_link->platforms, NULL);
if (ret < 0)
goto dai_link_of_err;
@@ -280,11 +280,11 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
if (ret < 0)
goto dai_link_of_err;
- ret = asoc_simple_parse_clk_cpu(dev, cpu, dai_link, cpu_dai);
+ ret = asoc_simple_parse_clk(dev, cpu, cpu_dai, dai_link->cpus);
if (ret < 0)
goto dai_link_of_err;
- ret = asoc_simple_parse_clk_codec(dev, codec, dai_link, codec_dai);
+ ret = asoc_simple_parse_clk(dev, codec, codec_dai, dai_link->codecs);
if (ret < 0)
goto dai_link_of_err;
--
2.25.1
More information about the Alsa-devel
mailing list