summaryrefslogtreecommitdiffstats
path: root/sound/soc/sof
diff options
context:
space:
mode:
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>2022-03-08 08:43:37 -0800
committerMark Brown <broonie@kernel.org>2022-03-09 13:30:02 +0000
commit7a976552a4f264f777be236c0c83263975512f1a (patch)
tree6c0a9e8eba2cc8e434cdf216f465ed68ea407d30 /sound/soc/sof
parent73d9cf7ca1210140b9fb17fd79a0e33d1d5b9af8 (diff)
downloadlinux-7a976552a4f264f777be236c0c83263975512f1a.tar.bz2
ASoC: SOF: make struct snd_sof_widget IPC agnostic
Parse the UUID token and save it in the new uuid field in struct snd_sof_widget. struct sof_ipc_comp_ext is no longer needed. So remove it too. 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/20220308164344.577647-12-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof')
-rw-r--r--sound/soc/sof/sof-audio.h3
-rw-r--r--sound/soc/sof/topology.c21
2 files changed, 11 insertions, 13 deletions
diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h
index a8eeffc12b24..10330d826d40 100644
--- a/sound/soc/sof/sof-audio.h
+++ b/sound/soc/sof/sof-audio.h
@@ -110,8 +110,7 @@ struct snd_sof_widget {
struct list_head list; /* list in sdev widget list */
struct snd_sof_widget *pipe_widget;
- /* extended data for UUID components */
- struct sof_ipc_comp_ext comp_ext;
+ const guid_t uuid;
void *private; /* core does not touch this */
};
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 41927e99ace2..111ff0f77be4 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -743,7 +743,7 @@ static const struct sof_topology_token core_tokens[] = {
static const struct sof_topology_token comp_ext_tokens[] = {
{SOF_TKN_COMP_UUID,
SND_SOC_TPLG_TUPLE_TYPE_UUID, get_token_uuid,
- offsetof(struct sof_ipc_comp_ext, uuid)},
+ offsetof(struct snd_sof_widget, uuid)},
};
/*
@@ -1419,16 +1419,16 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp,
*
* Return: The pointer to the new allocated component, NULL if failed.
*/
-static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget,
- size_t *ipc_size, int index)
+static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget, size_t *ipc_size,
+ int index)
{
- u8 nil_uuid[SOF_UUID_SIZE] = {0};
struct sof_ipc_comp *comp;
size_t total_size = *ipc_size;
+ size_t ext_size = sizeof(swidget->uuid);
/* only non-zero UUID is valid */
- if (memcmp(&swidget->comp_ext, nil_uuid, SOF_UUID_SIZE))
- total_size += sizeof(swidget->comp_ext);
+ if (!guid_is_null(&swidget->uuid))
+ total_size += ext_size;
comp = kzalloc(total_size, GFP_KERNEL);
if (!comp)
@@ -1444,8 +1444,8 @@ static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget,
/* handle the extended data if needed */
if (total_size > *ipc_size) {
/* append extended data to the end of the component */
- memcpy((u8 *)comp + *ipc_size, &swidget->comp_ext, sizeof(swidget->comp_ext));
- comp->ext_data_length = sizeof(swidget->comp_ext);
+ memcpy((u8 *)comp + *ipc_size, &swidget->uuid, ext_size);
+ comp->ext_data_length = ext_size;
}
/* update ipc_size and return */
@@ -2276,9 +2276,8 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
swidget->core = comp.core;
- ret = sof_parse_tokens(scomp, &swidget->comp_ext, comp_ext_tokens,
- ARRAY_SIZE(comp_ext_tokens), tw->priv.array,
- le32_to_cpu(tw->priv.size));
+ ret = sof_parse_tokens(scomp, swidget, comp_ext_tokens, ARRAY_SIZE(comp_ext_tokens),
+ tw->priv.array, le32_to_cpu(tw->priv.size));
if (ret != 0) {
dev_err(scomp->dev, "error: parsing comp_ext_tokens failed %d\n",
ret);