Skip to content

ASoC: SOF: pcm: Always stop DMA in the case of stop trigger - #4818

Closed
ranj063 wants to merge 5 commits into
thesofproject:topic/sof-devfrom
ranj063:sof-dev-081023
Closed

ranj063 wants to merge 5 commits into
thesofproject:topic/sof-devfrom
ranj063:sof-dev-081023

Conversation

@ranj063

@ranj063 ranj063 commented Feb 14, 2024

Copy link
Copy Markdown
Collaborator

Instead of pausing the DMA during stop trigger for IPC4 and leaving the pipelines in the paused state, always stop the DMA and reset the pipelines so that they can be restarted cleanly during a prepare/start in case of xruns.

@ranj063
ranj063 force-pushed the sof-dev-081023 branch 2 times, most recently from 7b67a91 to c805c20 Compare February 14, 2024 23:12
@ranj063
ranj063 force-pushed the sof-dev-081023 branch 4 times, most recently from 79beba5 to c2be407 Compare February 15, 2024 14:04
@ranj063

ranj063 commented Feb 15, 2024

Copy link
Copy Markdown
Collaborator Author

SOFCI TEST

@ranj063
ranj063 force-pushed the sof-dev-081023 branch 13 times, most recently from e874c07 to eb60f8a Compare February 16, 2024 01:53
Comment thread sound/soc/sof/ipc4-topology.c Outdated
int i;

for (i = 0; i < SOF_IPC4_DMA_DEVICE_MAX_COUNT; i++) {
if (!blob->alh_cfg.mapping[i].device) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

where is this reset @ranj063 ? Looks like never?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yeah I need to think about where to reset it but in my defense, the original code never reset it either just overwrote it

Comment thread sound/soc/sof/ipc4-topology.c Outdated
blob->alh_cfg.mapping[i].device =
copier_data->gtw_cfg.node_id;
blob->alh_cfg.mapping[i].device |=
SOF_IPC4_NODE_INDEX(data->dai_node_id);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ranj063 this won't work for LNL+ , see line 1725. 54818ce#diff-694481cfb73dd1682c248c54855215595dc96ca4ee65b1d3ef9cdc4a478158e0R1725

maybe it's just simpler to save the dai_node_id somewhere and reset the node_id in the unprepare?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@plbossart I changed the logic to save the ALH dai index during hw_params instead. Hopefully this is a better solution

@ranj063
ranj063 force-pushed the sof-dev-081023 branch 3 times, most recently from c2b3718 to a0043a3 Compare February 16, 2024 06:02
ranj063 and others added 3 commits February 16, 2024 08:13
Make sure to stop the DMA and stop/reset the pipelines during the stop
trigger for IPC4. In the case of IPC4, pipelines must be paused before
they are reset. So, add a post_trigger op in struct sof_pcm_ops that can
be called after stopping the DMA to reset the pipelines.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Add a state variable to keep track of whether a stream is previously
stopped. It is meant to be set only if the post-trigger op is also set.

This patch should be iso-functionality, possibly removing no-op
cases. The main purpose of this new state variable is to prepare a
follow-up patch to reset all PCM and DMAs in case of stop/prepare xrun
sequences.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Just stopping the DMA and resetting the pipelines during stop isn't
enough in the case of xruns. So, reset the DMA and free all widgets to
start over from a clean state.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
When an xrun happens, the BE DAI hw_params doesn't get invoked before
the stream restarts with a prepare. In this case, clearing the node ID
when the DAI widget is freed and unprepared will result in an error when
it is re-initialized. In order to avoid this, bring back the free_stream
ops for ACE1x platforms and move the code to clear the node ID to this op
to keep it balanced with the BE DAI hw_params.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
The node_id for multi-gateway ALH DAI's get overwritten with the
group_id during the DAI copier's ipc_prepare op. So, save the ALH
dai_index during the BE DAI hw_params in the dai_index field of struct
ipc4_copier and use that to set the device ID in the configuration blob.
This will avoid errors during copier init after an xrun.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@ranj063

ranj063 commented Feb 16, 2024

Copy link
Copy Markdown
Collaborator Author

closing this in favor of #4816

@ranj063 ranj063 closed this Feb 16, 2024
@ranj063
ranj063 deleted the sof-dev-081023 branch February 16, 2024 21:42
@ranj063
ranj063 restored the sof-dev-081023 branch February 16, 2024 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants