Commit 620f7c08 authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: simple-card/audio-graph: adjust to multi CPU/Codec" from...

Merge series "ASoC: simple-card/audio-graph: adjust to multi CPU/Codec" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

These patches adjusts to multi CPU/Codec on simple-card / audio-graph.
This is part of prepare for new audio-graph-card2.

Kuninori Morimoto (5):
  ASoC: simple-card: remove unused variable from simple_parse_of()
  ASoC: simple-card: use asoc_link_to_xxx() macro
  ASoC: simple-card: use simple_props_to_xxx() macro
  ASoC: audio-graph: use asoc_link_to_xxx() macro
  ASoC: audio-graph: use simple_props_to_xxx() macro

 sound/soc/generic/audio-graph-card.c | 43 +++++++++++++-----------
 sound/soc/generic/simple-card.c      | 50 +++++++++++++---------------
 2 files changed, 47 insertions(+), 46 deletions(-)

--
2.25.1
parents 22ff9c42 ae0727ab
...@@ -224,9 +224,9 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -224,9 +224,9 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
struct device_node *ports; struct device_node *ports;
struct device_node *node; struct device_node *node;
struct asoc_simple_dai *dai; struct asoc_simple_dai *dai;
struct snd_soc_dai_link_component *cpus = dai_link->cpus; struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0);
struct snd_soc_dai_link_component *codecs = dai_link->codecs; struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0);
struct snd_soc_dai_link_component *platforms = dai_link->platforms; struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0);
int ret; int ret;
port = of_get_parent(ep); port = of_get_parent(ep);
...@@ -246,13 +246,13 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -246,13 +246,13 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
dai_link->dynamic = 1; dai_link->dynamic = 1;
dai_link->dpcm_merged_format = 1; dai_link->dpcm_merged_format = 1;
dai = dai_props->cpu_dai; dai = simple_props_to_dai_cpu(dai_props, 0);
ret = asoc_simple_parse_dai(ep, dai_link->cpus, &is_single_links); ret = asoc_simple_parse_dai(ep, cpus, &is_single_links);
if (ret) if (ret)
goto out_put_node; goto out_put_node;
ret = asoc_simple_parse_clk(dev, ep, dai, dai_link->cpus); ret = asoc_simple_parse_clk(dev, ep, dai, cpus);
if (ret < 0) if (ret < 0)
goto out_put_node; goto out_put_node;
...@@ -288,14 +288,14 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -288,14 +288,14 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
dai_link->no_pcm = 1; dai_link->no_pcm = 1;
dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup; dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup;
dai = dai_props->codec_dai; dai = simple_props_to_dai_codec(dai_props, 0);
cconf = dai_props->codec_conf; cconf = simple_props_to_codec_conf(dai_props, 0);
ret = asoc_simple_parse_dai(ep, dai_link->codecs, NULL); ret = asoc_simple_parse_dai(ep, codecs, NULL);
if (ret < 0) if (ret < 0)
goto out_put_node; goto out_put_node;
ret = asoc_simple_parse_clk(dev, ep, dai, dai_link->codecs); ret = asoc_simple_parse_clk(dev, ep, dai, codecs);
if (ret < 0) if (ret < 0)
goto out_put_node; goto out_put_node;
...@@ -355,8 +355,11 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv, ...@@ -355,8 +355,11 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv,
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link);
struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link);
struct device_node *top = dev->of_node; struct device_node *top = dev->of_node;
struct asoc_simple_dai *cpu_dai = dai_props->cpu_dai; struct asoc_simple_dai *cpu_dai = simple_props_to_dai_cpu(dai_props, 0);
struct asoc_simple_dai *codec_dai = dai_props->codec_dai; struct asoc_simple_dai *codec_dai = simple_props_to_dai_codec(dai_props, 0);
struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0);
struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0);
struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0);
int ret, single_cpu = 0; int ret, single_cpu = 0;
dev_dbg(dev, "link_of (%pOF)\n", cpu_ep); dev_dbg(dev, "link_of (%pOF)\n", cpu_ep);
...@@ -372,11 +375,11 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv, ...@@ -372,11 +375,11 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv,
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = asoc_simple_parse_dai(cpu_ep, dai_link->cpus, &single_cpu); ret = asoc_simple_parse_dai(cpu_ep, cpus, &single_cpu);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = asoc_simple_parse_dai(codec_ep, dai_link->codecs, NULL); ret = asoc_simple_parse_dai(codec_ep, codecs, NULL);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -388,26 +391,26 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv, ...@@ -388,26 +391,26 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv,
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = asoc_simple_parse_clk(dev, cpu_ep, cpu_dai, dai_link->cpus); ret = asoc_simple_parse_clk(dev, cpu_ep, cpu_dai, cpus);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = asoc_simple_parse_clk(dev, codec_ep, codec_dai, dai_link->codecs); ret = asoc_simple_parse_clk(dev, codec_ep, codec_dai, codecs);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = asoc_simple_set_dailink_name(dev, dai_link, ret = asoc_simple_set_dailink_name(dev, dai_link,
"%s-%s", "%s-%s",
dai_link->cpus->dai_name, cpus->dai_name,
dai_link->codecs->dai_name); codecs->dai_name);
if (ret < 0) if (ret < 0)
return ret; return ret;
dai_link->ops = &graph_ops; dai_link->ops = &graph_ops;
dai_link->init = asoc_simple_dai_init; dai_link->init = asoc_simple_dai_init;
asoc_simple_canonicalize_cpu(dai_link->cpus, single_cpu); asoc_simple_canonicalize_cpu(cpus, single_cpu);
asoc_simple_canonicalize_platform(dai_link->platforms, dai_link->cpus); asoc_simple_canonicalize_platform(platforms, cpus);
return 0; return 0;
} }
......
...@@ -122,9 +122,9 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -122,9 +122,9 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv,
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link);
struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link);
struct asoc_simple_dai *dai; struct asoc_simple_dai *dai;
struct snd_soc_dai_link_component *cpus = dai_link->cpus; struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0);
struct snd_soc_dai_link_component *codecs = dai_link->codecs; struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0);
struct snd_soc_dai_link_component *platforms = dai_link->platforms; struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0);
struct device_node *top = dev->of_node; struct device_node *top = dev->of_node;
struct device_node *node = of_get_parent(np); struct device_node *node = of_get_parent(np);
char *prefix = ""; char *prefix = "";
...@@ -147,13 +147,13 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -147,13 +147,13 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv,
dai_link->dynamic = 1; dai_link->dynamic = 1;
dai_link->dpcm_merged_format = 1; dai_link->dpcm_merged_format = 1;
dai = dai_props->cpu_dai; dai = simple_props_to_dai_cpu(dai_props, 0);
ret = asoc_simple_parse_dai(np, dai_link->cpus, &is_single_links); ret = asoc_simple_parse_dai(np, cpus, &is_single_links);
if (ret) if (ret)
goto out_put_node; goto out_put_node;
ret = asoc_simple_parse_clk(dev, np, dai, dai_link->cpus); ret = asoc_simple_parse_clk(dev, np, dai, cpus);
if (ret < 0) if (ret < 0)
goto out_put_node; goto out_put_node;
...@@ -174,14 +174,14 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -174,14 +174,14 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv,
dai_link->no_pcm = 1; dai_link->no_pcm = 1;
dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup; dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup;
dai = dai_props->codec_dai; dai = simple_props_to_dai_codec(dai_props, 0);
cconf = dai_props->codec_conf; cconf = simple_props_to_codec_conf(dai_props, 0);
ret = asoc_simple_parse_dai(np, dai_link->codecs, NULL); ret = asoc_simple_parse_dai(np, codecs, NULL);
if (ret < 0) if (ret < 0)
goto out_put_node; goto out_put_node;
ret = asoc_simple_parse_clk(dev, np, dai, dai_link->codecs); ret = asoc_simple_parse_clk(dev, np, dai, codecs);
if (ret < 0) if (ret < 0)
goto out_put_node; goto out_put_node;
...@@ -231,8 +231,11 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, ...@@ -231,8 +231,11 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
struct device *dev = simple_priv_to_dev(priv); struct device *dev = simple_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link);
struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link); struct simple_dai_props *dai_props = simple_priv_to_props(priv, li->link);
struct asoc_simple_dai *cpu_dai = dai_props->cpu_dai; struct asoc_simple_dai *cpu_dai = simple_props_to_dai_cpu(dai_props, 0);
struct asoc_simple_dai *codec_dai = dai_props->codec_dai; struct asoc_simple_dai *codec_dai = simple_props_to_dai_codec(dai_props, 0);
struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0);
struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0);
struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0);
struct device_node *top = dev->of_node; struct device_node *top = dev->of_node;
struct device_node *cpu = NULL; struct device_node *cpu = NULL;
struct device_node *node = NULL; struct device_node *node = NULL;
...@@ -261,15 +264,15 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, ...@@ -261,15 +264,15 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
simple_parse_mclk_fs(top, cpu, codec, dai_props, prefix); simple_parse_mclk_fs(top, cpu, codec, dai_props, prefix);
ret = asoc_simple_parse_dai(cpu, dai_link->cpus, &single_cpu); ret = asoc_simple_parse_dai(cpu, cpus, &single_cpu);
if (ret < 0) if (ret < 0)
goto dai_link_of_err; goto dai_link_of_err;
ret = asoc_simple_parse_dai(codec, dai_link->codecs, NULL); ret = asoc_simple_parse_dai(codec, codecs, NULL);
if (ret < 0) if (ret < 0)
goto dai_link_of_err; goto dai_link_of_err;
ret = asoc_simple_parse_dai(plat, dai_link->platforms, NULL); ret = asoc_simple_parse_dai(plat, platforms, NULL);
if (ret < 0) if (ret < 0)
goto dai_link_of_err; goto dai_link_of_err;
...@@ -281,26 +284,26 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, ...@@ -281,26 +284,26 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv,
if (ret < 0) if (ret < 0)
goto dai_link_of_err; goto dai_link_of_err;
ret = asoc_simple_parse_clk(dev, cpu, cpu_dai, dai_link->cpus); ret = asoc_simple_parse_clk(dev, cpu, cpu_dai, cpus);
if (ret < 0) if (ret < 0)
goto dai_link_of_err; goto dai_link_of_err;
ret = asoc_simple_parse_clk(dev, codec, codec_dai, dai_link->codecs); ret = asoc_simple_parse_clk(dev, codec, codec_dai, codecs);
if (ret < 0) if (ret < 0)
goto dai_link_of_err; goto dai_link_of_err;
ret = asoc_simple_set_dailink_name(dev, dai_link, ret = asoc_simple_set_dailink_name(dev, dai_link,
"%s-%s", "%s-%s",
dai_link->cpus->dai_name, cpus->dai_name,
dai_link->codecs->dai_name); codecs->dai_name);
if (ret < 0) if (ret < 0)
goto dai_link_of_err; goto dai_link_of_err;
dai_link->ops = &simple_ops; dai_link->ops = &simple_ops;
dai_link->init = asoc_simple_dai_init; dai_link->init = asoc_simple_dai_init;
asoc_simple_canonicalize_cpu(dai_link->cpus, single_cpu); asoc_simple_canonicalize_cpu(cpus, single_cpu);
asoc_simple_canonicalize_platform(dai_link->platforms, dai_link->cpus); asoc_simple_canonicalize_platform(platforms, cpus);
dai_link_of_err: dai_link_of_err:
of_node_put(plat); of_node_put(plat);
...@@ -441,15 +444,10 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, ...@@ -441,15 +444,10 @@ static int simple_for_each_link(struct asoc_simple_priv *priv,
static int simple_parse_of(struct asoc_simple_priv *priv) static int simple_parse_of(struct asoc_simple_priv *priv)
{ {
struct device *dev = simple_priv_to_dev(priv);
struct device_node *top = dev->of_node;
struct snd_soc_card *card = simple_priv_to_card(priv); struct snd_soc_card *card = simple_priv_to_card(priv);
struct link_info li; struct link_info li;
int ret; int ret;
if (!top)
return -EINVAL;
ret = asoc_simple_parse_widgets(card, PREFIX); ret = asoc_simple_parse_widgets(card, PREFIX);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
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