-
Notifications
You must be signed in to change notification settings - Fork 144
ASoC: SOF: ipc4-topology: Refresh copier IPC payload before widget setup #5762
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
base: topic/sof-dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3186,6 +3186,15 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget | |
| ipc_size = ipc4_copier->ipc_config_size; | ||
| ipc_data = ipc4_copier->ipc_config_data; | ||
|
|
||
| /* | ||
| * Refresh copier_data in ipc_config_data for host copiers. | ||
| * The node_id may have been updated by host_config after | ||
| * ipc_prepare, e.g. when host stream tags change after a | ||
| * suspend/resume cycle. | ||
| */ | ||
| if (swidget->id != snd_soc_dapm_buffer) | ||
| memcpy(ipc_data, &ipc4_copier->data, sizeof(ipc4_copier->data)); | ||
|
|
||
| msg = &ipc4_copier->msg; | ||
| break; | ||
| } | ||
|
|
@@ -3194,6 +3203,9 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget | |
| { | ||
| struct snd_sof_dai *dai = swidget->private; | ||
| struct sof_ipc4_copier *ipc4_copier = dai->private; | ||
| struct sof_ipc4_copier_data *copier_data; | ||
| u32 gtw_cfg_config_length; | ||
| u32 tlv_size; | ||
|
|
||
| pipeline = pipe_widget->private; | ||
| if (pipeline->use_chain_dma) | ||
|
|
@@ -3202,6 +3214,27 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget | |
| ipc_size = ipc4_copier->ipc_config_size; | ||
| ipc_data = ipc4_copier->ipc_config_data; | ||
|
|
||
| /* | ||
| * Refresh copier_data and dma_config_tlv in ipc_config_data. | ||
| * These may have been updated after ipc_prepare, e.g. when | ||
| * link DMA stream tags change after a suspend/resume cycle. | ||
| * | ||
| * copier_data->gtw_cfg.config_length does not include the | ||
| * TLV size (it was restored after _sof_ipc4_prepare_copier_module), | ||
| * so temporarily inflate it to match the ipc_config_data layout. | ||
| */ | ||
| copier_data = &ipc4_copier->data; | ||
| gtw_cfg_config_length = copier_data->gtw_cfg.config_length * 4; | ||
| tlv_size = ipc_size - sizeof(*copier_data) - gtw_cfg_config_length; | ||
|
|
||
| copier_data->gtw_cfg.config_length += tlv_size / 4; | ||
| memcpy(ipc_data, copier_data, sizeof(*copier_data)); | ||
| copier_data->gtw_cfg.config_length = gtw_cfg_config_length / 4; | ||
|
|
||
|
Comment on lines
+3226
to
+3233
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is needed to be done like this, see how this is done in sof_ipc4_prepare_copier_module |
||
| if (tlv_size) | ||
| memcpy(ipc_data + sizeof(*copier_data) + gtw_cfg_config_length, | ||
| &ipc4_copier->dma_config_tlv, tlv_size); | ||
|
Comment on lines
+3227
to
+3236
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ipc_size is ipc4_copier->ipc_config_size, which has been correctly set during prepare and it is guarantied to never underflow. |
||
|
|
||
| msg = &ipc4_copier->msg; | ||
| break; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The section is small, people expected to be able to have wider attention spam than few lines.