summaryrefslogtreecommitdiff
path: root/sound/soc/sof/ipc3-topology.c
diff options
context:
space:
mode:
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>2022-03-14 23:05:11 +0300
committerMark Brown <broonie@kernel.org>2022-03-16 19:39:03 +0300
commit683b54ef603825328859d867aabf9a6d973238a2 (patch)
tree8b071cca9cb70ba8f1e8c95583e29ea82dc7922d /sound/soc/sof/ipc3-topology.c
parent30f4168024e91e85aff9edcef561715ed271b34c (diff)
downloadlinux-683b54ef603825328859d867aabf9a6d973238a2.tar.xz
ASoC: SOF: topology: Make mux/demux widget parsing IPC agnostic
Define the list of tokens pertaining to the mux/demux 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 mux/demux 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-11-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/ipc3-topology.c')
-rw-r--r--sound/soc/sof/ipc3-topology.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c
index d8a91f461bf9..5501a18babaf 100644
--- a/sound/soc/sof/ipc3-topology.c
+++ b/sound/soc/sof/ipc3-topology.c
@@ -325,6 +325,41 @@ static int sof_ipc3_widget_setup_comp_buffer(struct snd_sof_widget *swidget)
}
/*
+ * Mux topology
+ */
+static int sof_ipc3_widget_setup_comp_mux(struct snd_sof_widget *swidget)
+{
+ struct snd_soc_component *scomp = swidget->scomp;
+ struct sof_ipc_comp_mux *mux;
+ size_t ipc_size = sizeof(*mux);
+ int ret;
+
+ mux = sof_comp_alloc(swidget, &ipc_size, swidget->pipeline_id);
+ if (!mux)
+ return -ENOMEM;
+
+ swidget->private = mux;
+
+ /* configure mux IPC message */
+ mux->comp.type = SOF_COMP_MUX;
+ mux->config.hdr.size = sizeof(mux->config);
+
+ /* parse one set of comp tokens */
+ ret = sof_update_ipc_object(scomp, &mux->config, SOF_COMP_TOKENS,
+ swidget->tuples, swidget->num_tuples, sizeof(mux->config), 1);
+ if (ret < 0) {
+ kfree(swidget->private);
+ swidget->private = NULL;
+ return ret;
+ }
+
+ dev_dbg(scomp->dev, "loaded mux %s\n", swidget->widget->name);
+ sof_dbg_comp_config(scomp, &mux->config);
+
+ return 0;
+}
+
+/*
* PGA Topology
*/
@@ -430,6 +465,11 @@ static const struct sof_ipc_tplg_widget_ops tplg_ipc3_widget_ops[SND_SOC_DAPM_TY
pipeline_token_list, ARRAY_SIZE(pipeline_token_list), NULL},
[snd_soc_dapm_pga] = {sof_ipc3_widget_setup_comp_pga, sof_ipc3_widget_free_comp,
pga_token_list, ARRAY_SIZE(pga_token_list), NULL},
+ [snd_soc_dapm_mux] = {sof_ipc3_widget_setup_comp_mux, sof_ipc3_widget_free_comp,
+ comp_generic_token_list, ARRAY_SIZE(comp_generic_token_list), NULL},
+ [snd_soc_dapm_demux] = {sof_ipc3_widget_setup_comp_mux, sof_ipc3_widget_free_comp,
+ comp_generic_token_list, ARRAY_SIZE(comp_generic_token_list),
+ NULL},
};
static const struct sof_ipc_tplg_ops ipc3_tplg_ops = {