Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UUID kernel implementation #2215

Merged
merged 15 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions include/sound/sof/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ struct sof_ipc_comp {
uint32_t pipeline_id;
keyonjie marked this conversation as resolved.
Show resolved Hide resolved
uint32_t core;

/* reserved for future use */
uint32_t reserved[1];
/* extended data length, 0 if no extended data */
uint32_t ext_data_length;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a big fan of running out of options if we need a new flag...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact is that it is used up, if we need a new flag, we should bump the ABI major per my understanding. @kv2019i This is an common scenario of ABI management you proposed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ext_data_length will never need 32bits/4G, will it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

64KB will require 32bits, but yes, I think using only 16bits is sufficient for us.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keyonjie @plbossart @marc-hb Given we are adding a new extension mechanism that can be used to add more fields and the more minor consideration that 32bit values are easier for the DSP to handle, this seems ok to me.
Plus firmware is already merged, so this conversation is a bit late at this point.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keyonjie @plbossart @marc-hb Given we are adding a new extension mechanism that can be used to add more fields and the more minor consideration that 32bit values are easier for the DSP to handle, this seems ok to me.
Plus firmware is already merged, so this conversation is a bit late at this point.

Yes, I think we finally aligned on using all the 32 bits.

} __packed;

/*
Expand Down Expand Up @@ -87,6 +87,9 @@ struct sof_ipc_comp {
*/
#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 */
struct sof_ipc_buffer {
struct sof_ipc_comp comp;
Expand Down Expand Up @@ -300,4 +303,9 @@ enum sof_event_types {
SOF_KEYWORD_DETECT_DAPM_EVENT,
};

/* extended data struct for UUID components */
struct sof_ipc_comp_ext {
uint8_t uuid[SOF_UUID_SIZE];
} __packed;
marc-hb marked this conversation as resolved.
Show resolved Hide resolved

#endif
1 change: 1 addition & 0 deletions include/uapi/sound/sof/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
* #define SOF_TKN_COMP_PRELOAD_COUNT 403
kv2019i marked this conversation as resolved.
Show resolved Hide resolved
*/
#define SOF_TKN_COMP_CORE_ID 404
#define SOF_TKN_COMP_UUID 405

/* SSP */
#define SOF_TKN_INTEL_SSP_CLKS_CONTROL 500
Expand Down
23 changes: 18 additions & 5 deletions sound/soc/sof/sof-audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ int sof_restore_pipelines(struct device *dev)
struct snd_sof_route *sroute;
struct sof_ipc_pipe_new *pipeline;
struct snd_sof_dai *dai;
struct sof_ipc_comp_dai *comp_dai;
struct sof_ipc_cmd_hdr *hdr;
struct sof_ipc_comp *comp;
size_t ipc_size;
int ret;

/* restore pipeline components */
Expand All @@ -189,12 +190,24 @@ int sof_restore_pipelines(struct device *dev)
switch (swidget->id) {
case snd_soc_dapm_dai_in:
case snd_soc_dapm_dai_out:
ipc_size = sizeof(struct sof_ipc_comp_dai) +
sizeof(struct sof_ipc_comp_ext);
comp = kzalloc(ipc_size, GFP_KERNEL);
if (!comp)
return -ENOMEM;

ranj063 marked this conversation as resolved.
Show resolved Hide resolved
dai = swidget->private;
comp_dai = &dai->comp_dai;
ret = sof_ipc_tx_message(sdev->ipc,
comp_dai->comp.hdr.cmd,
comp_dai, sizeof(*comp_dai),
memcpy(comp, &dai->comp_dai,
sizeof(struct sof_ipc_comp_dai));

/* append extended data to the end of the component */
memcpy((u8 *)comp + sizeof(struct sof_ipc_comp_dai),
&swidget->comp_ext, sizeof(swidget->comp_ext));
kv2019i marked this conversation as resolved.
Show resolved Hide resolved

ret = sof_ipc_tx_message(sdev->ipc, comp->hdr.cmd,
comp, ipc_size,
&r, sizeof(r));
kfree(comp);
break;
case snd_soc_dapm_scheduler:

Expand Down
3 changes: 3 additions & 0 deletions sound/soc/sof/sof-audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ struct snd_sof_widget {
struct snd_soc_dapm_widget *widget;
struct list_head list; /* list in sdev widget list */

/* extended data for UUID components */
struct sof_ipc_comp_ext comp_ext;

void *private; /* core does not touch this */
};

Expand Down
Loading