Commit 7a976552 authored by Ranjani Sridharan's avatar Ranjani Sridharan Committed by Mark Brown

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: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220308164344.577647-12-ranjani.sridharan@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 73d9cf7c
...@@ -87,9 +87,6 @@ struct sof_ipc_comp { ...@@ -87,9 +87,6 @@ struct sof_ipc_comp {
*/ */
#define SOF_BUF_UNDERRUN_PERMITTED BIT(1) #define SOF_BUF_UNDERRUN_PERMITTED BIT(1)
/* the UUID size in bytes, shared between FW and host */
#define SOF_UUID_SIZE 16
/* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */ /* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */
struct sof_ipc_buffer { struct sof_ipc_buffer {
struct sof_ipc_comp comp; struct sof_ipc_comp comp;
...@@ -303,9 +300,4 @@ enum sof_event_types { ...@@ -303,9 +300,4 @@ enum sof_event_types {
SOF_KEYWORD_DETECT_DAPM_EVENT, SOF_KEYWORD_DETECT_DAPM_EVENT,
}; };
/* extended data struct for UUID components */
struct sof_ipc_comp_ext {
uint8_t uuid[SOF_UUID_SIZE];
} __packed;
#endif #endif
...@@ -110,8 +110,7 @@ struct snd_sof_widget { ...@@ -110,8 +110,7 @@ struct snd_sof_widget {
struct list_head list; /* list in sdev widget list */ struct list_head list; /* list in sdev widget list */
struct snd_sof_widget *pipe_widget; struct snd_sof_widget *pipe_widget;
/* extended data for UUID components */ const guid_t uuid;
struct sof_ipc_comp_ext comp_ext;
void *private; /* core does not touch this */ void *private; /* core does not touch this */
}; };
......
...@@ -743,7 +743,7 @@ static const struct sof_topology_token core_tokens[] = { ...@@ -743,7 +743,7 @@ static const struct sof_topology_token core_tokens[] = {
static const struct sof_topology_token comp_ext_tokens[] = { static const struct sof_topology_token comp_ext_tokens[] = {
{SOF_TKN_COMP_UUID, {SOF_TKN_COMP_UUID,
SND_SOC_TPLG_TUPLE_TYPE_UUID, get_token_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, ...@@ -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. * Return: The pointer to the new allocated component, NULL if failed.
*/ */
static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget, static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget, size_t *ipc_size,
size_t *ipc_size, int index) int index)
{ {
u8 nil_uuid[SOF_UUID_SIZE] = {0};
struct sof_ipc_comp *comp; struct sof_ipc_comp *comp;
size_t total_size = *ipc_size; size_t total_size = *ipc_size;
size_t ext_size = sizeof(swidget->uuid);
/* only non-zero UUID is valid */ /* only non-zero UUID is valid */
if (memcmp(&swidget->comp_ext, nil_uuid, SOF_UUID_SIZE)) if (!guid_is_null(&swidget->uuid))
total_size += sizeof(swidget->comp_ext); total_size += ext_size;
comp = kzalloc(total_size, GFP_KERNEL); comp = kzalloc(total_size, GFP_KERNEL);
if (!comp) if (!comp)
...@@ -1444,8 +1444,8 @@ static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget, ...@@ -1444,8 +1444,8 @@ static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget,
/* handle the extended data if needed */ /* handle the extended data if needed */
if (total_size > *ipc_size) { if (total_size > *ipc_size) {
/* append extended data to the end of the component */ /* append extended data to the end of the component */
memcpy((u8 *)comp + *ipc_size, &swidget->comp_ext, sizeof(swidget->comp_ext)); memcpy((u8 *)comp + *ipc_size, &swidget->uuid, ext_size);
comp->ext_data_length = sizeof(swidget->comp_ext); comp->ext_data_length = ext_size;
} }
/* update ipc_size and return */ /* update ipc_size and return */
...@@ -2276,9 +2276,8 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index, ...@@ -2276,9 +2276,8 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
swidget->core = comp.core; swidget->core = comp.core;
ret = sof_parse_tokens(scomp, &swidget->comp_ext, comp_ext_tokens, ret = sof_parse_tokens(scomp, swidget, comp_ext_tokens, ARRAY_SIZE(comp_ext_tokens),
ARRAY_SIZE(comp_ext_tokens), tw->priv.array, tw->priv.array, le32_to_cpu(tw->priv.size));
le32_to_cpu(tw->priv.size));
if (ret != 0) { if (ret != 0) {
dev_err(scomp->dev, "error: parsing comp_ext_tokens failed %d\n", dev_err(scomp->dev, "error: parsing comp_ext_tokens failed %d\n",
ret); 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