dai_link->platform is no longer needed if CPU and Platform are same Component. This patch removes unnecessary dai_link->platform. Simple-Card (Normal) is supporting platform, but Simple-Cadd (DPCM), Audio-Graph-Card/Card2 (Normal/DPCM) are not for now. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx> --- include/sound/simple_card_utils.h | 2 -- sound/soc/generic/audio-graph-card.c | 6 ---- sound/soc/generic/audio-graph-card2.c | 9 ++---- sound/soc/generic/simple-card-utils.c | 9 ------ sound/soc/generic/simple-card.c | 40 +++++++++++++++------------ 5 files changed, 25 insertions(+), 41 deletions(-) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index a3f3f3aa9e6e..aeb5ceba4019 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -167,8 +167,6 @@ int asoc_simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, &(dai)->slots, \ &(dai)->slot_width); -void asoc_simple_canonicalize_platform(struct snd_soc_dai_link_component *platforms, - struct snd_soc_dai_link_component *cpus); void asoc_simple_canonicalize_cpu(struct snd_soc_dai_link_component *cpus, int is_single_links); diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 5daa824a4ffc..c709fc4a39ed 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -287,7 +287,6 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, if (li->cpu) { struct snd_soc_card *card = simple_priv_to_card(priv); struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0); - struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0); int is_single_links = 0; /* Codec is dummy */ @@ -318,7 +317,6 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, } asoc_simple_canonicalize_cpu(cpus, is_single_links); - asoc_simple_canonicalize_platform(platforms, cpus); } else { struct snd_soc_codec_conf *cconf = simple_props_to_codec_conf(dai_props, 0); struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0); @@ -372,7 +370,6 @@ 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_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); char dai_name[64]; int ret, is_single_links = 0; @@ -390,7 +387,6 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv, "%s-%s", cpus->dai_name, codecs->dai_name); asoc_simple_canonicalize_cpu(cpus, is_single_links); - asoc_simple_canonicalize_platform(platforms, cpus); ret = graph_link_init(priv, cpu_ep, codec_ep, li, dai_name); if (ret < 0) @@ -615,7 +611,6 @@ static int graph_count_noml(struct asoc_simple_priv *priv, li->num[li->link].cpus = 1; li->num[li->link].codecs = 1; - li->num[li->link].platforms = 1; li->link += 1; /* 1xCPU-Codec */ @@ -638,7 +633,6 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv, if (li->cpu) { li->num[li->link].cpus = 1; - li->num[li->link].platforms = 1; li->link++; /* 1xCPU-dummy */ } else { diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 06609a526b78..9f154fc1bbb4 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -590,10 +590,8 @@ static int __graph_parse_node(struct asoc_simple_priv *priv, if (is_cpu) { struct snd_soc_dai_link_component *cpus = dlc; - struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, idx); asoc_simple_canonicalize_cpu(cpus, is_single_links); - asoc_simple_canonicalize_platform(platforms, cpus); } return 0; @@ -1046,8 +1044,7 @@ static int graph_count_normal(struct asoc_simple_priv *priv, * => lnk: port { endpoint { .. }; }; * }; */ - li->num[li->link].cpus = - li->num[li->link].platforms = graph_counter(cpu_port); + li->num[li->link].cpus = graph_counter(cpu_port); li->num[li->link].codecs = graph_counter(codec_port); of_node_put(cpu_ep); @@ -1080,7 +1077,6 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv, if (asoc_graph_is_ports0(lnk)) { li->num[li->link].cpus = graph_counter(rport); /* FE */ - li->num[li->link].platforms = graph_counter(rport); } else { li->num[li->link].codecs = graph_counter(rport); /* BE */ } @@ -1113,8 +1109,7 @@ static int graph_count_c2c(struct asoc_simple_priv *priv, * }; * }; */ - li->num[li->link].cpus = - li->num[li->link].platforms = graph_counter(codec0); + li->num[li->link].cpus = graph_counter(codec0); li->num[li->link].codecs = graph_counter(codec1); of_node_put(ports); diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 56552a616f21..f1c228743d98 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -635,15 +635,6 @@ int asoc_simple_dai_init(struct snd_soc_pcm_runtime *rtd) } EXPORT_SYMBOL_GPL(asoc_simple_dai_init); -void asoc_simple_canonicalize_platform(struct snd_soc_dai_link_component *platforms, - struct snd_soc_dai_link_component *cpus) -{ - /* Assumes platform == cpu */ - if (!platforms->of_node) - platforms->of_node = cpus->of_node; -} -EXPORT_SYMBOL_GPL(asoc_simple_canonicalize_platform); - void asoc_simple_canonicalize_cpu(struct snd_soc_dai_link_component *cpus, int is_single_links) { diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index e98932c16754..b78d9db6ca5a 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -197,6 +197,7 @@ static int simple_link_init(struct asoc_simple_priv *priv, static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top) { @@ -217,7 +218,6 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv, if (li->cpu) { struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0); - struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0); int is_single_links = 0; /* Codec is dummy */ @@ -233,7 +233,6 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv, snprintf(dai_name, sizeof(dai_name), "fe.%s", cpus->dai_name); asoc_simple_canonicalize_cpu(cpus, is_single_links); - asoc_simple_canonicalize_platform(platforms, cpus); } else { struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0); struct snd_soc_codec_conf *cconf; @@ -277,6 +276,7 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv, static int simple_dai_link_of(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top) { @@ -284,12 +284,9 @@ static int simple_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_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 *cpu = NULL; struct device_node *node = NULL; - struct device_node *plat = NULL; char dai_name[64]; - char prop[128]; char *prefix = ""; int ret, single_cpu = 0; @@ -302,9 +299,6 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, if (is_top) prefix = PREFIX; - snprintf(prop, sizeof(prop), "%splat", prefix); - plat = of_get_child_by_name(node, prop); - ret = simple_parse_node(priv, cpu, li, prefix, &single_cpu); if (ret < 0) goto dai_link_of_err; @@ -313,20 +307,22 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, if (ret < 0) goto dai_link_of_err; - ret = asoc_simple_parse_platform(plat, platforms); - if (ret < 0) - goto dai_link_of_err; + if (platform) { + struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0); + + ret = asoc_simple_parse_platform(platform, platforms); + if (ret < 0) + goto dai_link_of_err; + } snprintf(dai_name, sizeof(dai_name), "%s-%s", cpus->dai_name, codecs->dai_name); asoc_simple_canonicalize_cpu(cpus, single_cpu); - asoc_simple_canonicalize_platform(platforms, cpus); ret = simple_link_init(priv, node, codec, li, prefix, dai_name); dai_link_of_err: - of_node_put(plat); of_node_put(node); li->link++; @@ -339,10 +335,12 @@ static int __simple_for_each_link(struct asoc_simple_priv *priv, int (*func_noml)(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top), int (*func_dpcm)(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top)) { struct device *dev = simple_priv_to_dev(priv); @@ -401,7 +399,7 @@ static int __simple_for_each_link(struct asoc_simple_priv *priv, * Codec |return|Pass */ if (li->cpu != (np == codec)) - ret = func_dpcm(priv, np, codec, li, is_top); + ret = func_dpcm(priv, np, codec, plat, li, is_top); /* else normal sound */ } else { /* @@ -411,7 +409,7 @@ static int __simple_for_each_link(struct asoc_simple_priv *priv, * Codec |return|return */ if (li->cpu && (np != codec)) - ret = func_noml(priv, np, codec, li, is_top); + ret = func_noml(priv, np, codec, plat, li, is_top); } if (ret < 0) { @@ -435,10 +433,12 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, int (*func_noml)(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top), int (*func_dpcm)(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top)) { int ret; @@ -500,6 +500,7 @@ static int simple_parse_of(struct asoc_simple_priv *priv, struct link_info *li) static int simple_count_noml(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top) { if (li->link >= SNDRV_MAX_LINKS) { @@ -511,7 +512,9 @@ static int simple_count_noml(struct asoc_simple_priv *priv, li->num[li->link].cpus = 1; li->num[li->link].codecs = 1; - li->num[li->link].platforms = 1; + + if (platform) + li->num[li->link].platforms = 1; li->link += 1; @@ -521,6 +524,7 @@ static int simple_count_noml(struct asoc_simple_priv *priv, static int simple_count_dpcm(struct asoc_simple_priv *priv, struct device_node *np, struct device_node *codec, + struct device_node *platform, struct link_info *li, bool is_top) { if (li->link >= SNDRV_MAX_LINKS) { @@ -531,8 +535,10 @@ static int simple_count_dpcm(struct asoc_simple_priv *priv, } if (li->cpu) { + if (platform) + li->num[li->link].platforms = 1; + li->num[li->link].cpus = 1; - li->num[li->link].platforms = 1; li->link++; /* CPU-dummy */ } else { -- 2.25.1