Skip to content

ASoC: SOF: ipc4: Fix pipeline state transitions for aggregate DAIs#5765

Open
ujfalusi wants to merge 1 commit intothesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/aggregated-sdw-trigger
Open

ASoC: SOF: ipc4: Fix pipeline state transitions for aggregate DAIs#5765
ujfalusi wants to merge 1 commit intothesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/aggregated-sdw-trigger

Conversation

@ujfalusi
Copy link
Copy Markdown
Collaborator

@ujfalusi ujfalusi commented May 7, 2026

For aggregate DAIs (num_cpus > 1) the pre_trigger/post_trigger callbacks send pipeline state IPCs per-DAI without considering that multiple DAIs may share the same pipeline. This causes premature state transitions where the pipeline goes RUNNING before all link DMAs have started, or individual DAIs send redundant IPCs for shared pipelines.

Add a per-pipeline trigger_count to gate state transitions:

  • START/PAUSE_RELEASE: defer RUNNING IPC until all DAIs sharing the same pipeline have completed their link DMA operations
  • STOP/SUSPEND/PAUSE_PUSH: use pipeline state dedup so the PAUSED IPC is sent once regardless of how many DAIs share the pipeline

The per-spipe DAI count is computed dynamically to handle all aggregate topologies: shared pipelines, independent pipelines, and mixed cases.

For aggregate DAIs (num_cpus > 1) the pre_trigger/post_trigger callbacks
send pipeline state IPCs per-DAI without considering that multiple DAIs
may share the same pipeline. This causes premature state transitions
where the pipeline goes RUNNING before all link DMAs have started, or
individual DAIs send redundant IPCs for shared pipelines.

Add a per-pipeline trigger_count to gate state transitions:
- START/PAUSE_RELEASE: defer RUNNING IPC until all DAIs sharing the
  same pipeline have completed their link DMA operations
- STOP/SUSPEND/PAUSE_PUSH: use pipeline state dedup so the PAUSED IPC
  is sent once regardless of how many DAIs share the pipeline

The per-spipe DAI count is computed dynamically to handle all aggregate
topologies: shared pipelines, independent pipelines, and mixed cases.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes IPC4 pipeline state transitions for aggregate back-end links (num_cpus > 1) where multiple CPU DAIs may share the same SOF pipeline, which can currently cause premature RUNNING transitions and redundant PAUSED IPCs.

Changes:

  • Add a per-pipeline trigger_count to gate START/PAUSE_RELEASE so RUNNING is sent only after all DAIs sharing a pipeline have completed link DMA triggering.
  • Deduplicate STOP/SUSPEND/PAUSE_PUSH PAUSED IPCs for shared pipelines by checking the current pipeline state.
  • Compute the “DAIs-per-pipeline” threshold dynamically per BE link to support shared/independent/mixed aggregate topologies.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
sound/soc/sof/sof-audio.h Adds trigger_count to struct snd_sof_pipeline to track aggregate trigger completion per pipeline.
sound/soc/sof/intel/hda-dai-ops.c Adds per-pipeline DAI counting and uses trigger_count to gate RUNNING/PAUSED IPC transitions for aggregate DAIs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (!w)
continue;

sw = w->dobj.private;
Comment on lines +443 to +449
int spipe_dais = hda_ipc4_count_spipe_dais(substream,
swidget->spipe);

swidget->spipe->trigger_count++;
swidget->spipe->started_count++;
if (swidget->spipe->trigger_count < spipe_dais)
break;
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