Skip to content

ASoC: SOF: Intel: hda-dai: Prepare the link DMA on START if needed - #6070

Open
ujfalusi wants to merge 1 commit into
thesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/restart-while-the-other-prepared
Open

ujfalusi wants to merge 1 commit into
thesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/restart-while-the-other-prepared

Conversation

@ujfalusi

@ujfalusi ujfalusi commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

The link DMA is reset on STOP trigger and it is expected to be configured again in the BE prepare before the next START.

When a BE is shared by two FEs (FE1 and FE2) this is not guaranteed:

FE1: hw_params, prepare, start
FE2: hw_params, prepare (stays in PREPARED state)
FE1: stop (BE is stopped, link DMA reset)

At this point the BE is in STOP state while FE2 is still PREPARED, which leads to a BE START without prepare in these sequences:

a) FE1: prepare, start
The BE prepare is skipped by DPCM since FE2 is in PREPARED state.

b) FE2: start
No prepare is done at all.

c) FE1: hw_params, prepare
FE2: start
FE1: start
The BE prepare is skipped for FE1 since FE2 is in PREPARED state and
the BE is started by FE2.

The BE is started with an unconfigured link DMA and the streams stall after the host DMA has filled up the buffers.

Run the prepare of the DAI on START if the link DMA is not prepared.

Fixes: ab55937 ("ASoC: SOF: Intel: hda: Always clean up link DMA during stop")
Closes: thesofproject/sof#11566

The link DMA is reset on STOP trigger and it is expected to be configured
again in the BE prepare before the next START.

When a BE is shared by two FEs (FE1 and FE2) this is not guaranteed:

  FE1: hw_params, prepare, start
  FE2: hw_params, prepare		(stays in PREPARED state)
  FE1: stop				(BE is stopped, link DMA reset)

At this point the BE is in STOP state while FE2 is still PREPARED, which
leads to a BE START without prepare in these sequences:

a) FE1: prepare, start
   The BE prepare is skipped by DPCM since FE2 is in PREPARED state.

b) FE2: start
   No prepare is done at all.

c) FE1: hw_params, prepare
   FE2: start
   FE1: start
   The BE prepare is skipped for FE1 since FE2 is in PREPARED state and
   the BE is started by FE2.

The BE is started with an unconfigured link DMA and the streams stall
after the host DMA has filled up the buffers.

Run the prepare of the DAI on START if the link DMA is not prepared.

Fixes: ab55937 ("ASoC: SOF: Intel: hda: Always clean up link DMA during stop")
Closes: thesofproject/sof#11566
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the shared-backend DMA restart change.

No open issues 🎉

What changed in this PR

This PR prevents audio streams from stalling when a shared backend restarts without DPCM preparing its link DMA after STOP.

Changes:

  • Calls the DAI prepare callback on START when the link DMA is unprepared and the callback is available.
  • Returns preparation errors before proceeding with the trigger.
  • Documents why shared frontends can cause backend preparation to be skipped.
File Description
sound/​soc/​sof/​intel/​hda-dai.c Adds conditional link DMA preparation on START to handle shared-backend restarts.

Review effort: Balanced

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.

[BUG] [PTL] Speaker PCM hangs (RUNNING, hw_ptr frozen) when restarted while Deepbuffer Speaker PCM is held PREPARED

4 participants