summaryrefslogtreecommitdiffstats
path: root/sound/soc/sof/topology.c
diff options
context:
space:
mode:
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>2022-03-14 13:05:12 -0700
committerMark Brown <broonie@kernel.org>2022-03-16 16:39:04 +0000
commit8d8b1293473022953ed316c3e0c723ff5a1505ac (patch)
tree0956cf7fc71e840154fbd928f00ade1753882387 /sound/soc/sof/topology.c
parent683b54ef603825328859d867aabf9a6d973238a2 (diff)
downloadlinux-8d8b1293473022953ed316c3e0c723ff5a1505ac.tar.bz2
ASoC: SOF: topology: Make src widget parsing IPC agnostic
Define the list of tokens pertaining to the src widgets, parse and save them as part of the swidget tuples array. Once topology parsing is complete, these tokens will be applied to create the IPC structure for the src component based on the topology widget_setup op in ipc3_tplg_ops. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220314200520.1233427-12-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/topology.c')
-rw-r--r--sound/soc/sof/topology.c64
1 files changed, 1 insertions, 63 deletions
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 42da7b8e7180..f41bf7dfbd02 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -629,14 +629,6 @@ static const struct sof_topology_token dai_link_tokens[] = {
offsetof(struct sof_ipc_dai_config, dai_index)},
};
-/* SRC */
-static const struct sof_topology_token src_tokens[] = {
- {SOF_TKN_SRC_RATE_IN, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
- offsetof(struct sof_ipc_comp_src, source_rate)},
- {SOF_TKN_SRC_RATE_OUT, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
- offsetof(struct sof_ipc_comp_src, sink_rate)},
-};
-
/* ASRC */
static const struct sof_topology_token asrc_tokens[] = {
{SOF_TKN_ASRC_RATE_IN, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
@@ -1793,58 +1785,6 @@ err:
}
/*
- * SRC Topology
- */
-
-static int sof_widget_load_src(struct snd_soc_component *scomp, int index,
- struct snd_sof_widget *swidget,
- struct snd_soc_tplg_dapm_widget *tw)
-{
- struct snd_soc_tplg_private *private = &tw->priv;
- struct sof_ipc_comp_src *src;
- size_t ipc_size = sizeof(*src);
- int ret;
-
- src = (struct sof_ipc_comp_src *)
- sof_comp_alloc(swidget, &ipc_size, index);
- if (!src)
- return -ENOMEM;
-
- /* configure src IPC message */
- src->comp.type = SOF_COMP_SRC;
- src->config.hdr.size = sizeof(src->config);
-
- ret = sof_parse_tokens(scomp, src, src_tokens,
- ARRAY_SIZE(src_tokens), private->array,
- le32_to_cpu(private->size));
- if (ret != 0) {
- dev_err(scomp->dev, "error: parse src tokens failed %d\n",
- private->size);
- goto err;
- }
-
- ret = sof_parse_tokens(scomp, &src->config, comp_tokens,
- ARRAY_SIZE(comp_tokens), private->array,
- le32_to_cpu(private->size));
- if (ret != 0) {
- dev_err(scomp->dev, "error: parse src.cfg tokens failed %d\n",
- le32_to_cpu(private->size));
- goto err;
- }
-
- dev_dbg(scomp->dev, "src %s: source rate %d sink rate %d\n",
- swidget->widget->name, src->source_rate, src->sink_rate);
- sof_dbg_comp_config(scomp, &src->config);
-
- swidget->private = src;
-
- return 0;
-err:
- kfree(src);
- return ret;
-}
-
-/*
* ASRC Topology
*/
@@ -2278,13 +2218,11 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
case snd_soc_dapm_scheduler:
case snd_soc_dapm_aif_out:
case snd_soc_dapm_aif_in:
+ case snd_soc_dapm_src:
case snd_soc_dapm_mux:
case snd_soc_dapm_demux:
ret = sof_widget_parse_tokens(scomp, swidget, tw, token_list, token_list_size);
break;
- case snd_soc_dapm_src:
- ret = sof_widget_load_src(scomp, index, swidget, tw);
- break;
case snd_soc_dapm_asrc:
ret = sof_widget_load_asrc(scomp, index, swidget, tw);
break;