Skip to content

[SKIP SOFCI-TEST] set of PCM delay handling fixes#5511

Closed
kv2019i wants to merge 3 commits intothesofproject:topic/sof-devfrom
kv2019i:202508-delay-handling-test
Closed

[SKIP SOFCI-TEST] set of PCM delay handling fixes#5511
kv2019i wants to merge 3 commits intothesofproject:topic/sof-devfrom
kv2019i:202508-delay-handling-test

Conversation

@kv2019i
Copy link
Collaborator

@kv2019i kv2019i commented Aug 13, 2025

No description provided.

When the sampling rates going in (host) and out (dai) from the DSP
are different, the IPC4 delay reporting does not work correctly.
Add support for this case by scaling the all raw position values to
a common timebase before calculating real-time delay for the PCM.

Fixes: 0ea0668 ("ASoC: SOF: ipc4-pcm: Correct the delay calculation")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
If the stream hits an xrun condition, the delay calculation results
in invalid, very large values. The application has no way to interpret
these values as it doesn't know the internal boundary limits used
in delay calculation. Add a sanity to check the delay value before
it is reported back. If it's clearly invalid, return a zero delay and
emit a rate limited warning to kernel log.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i kv2019i force-pushed the 202508-delay-handling-test branch 3 times, most recently from 6d6dcb5 to 2cb723b Compare August 13, 2025 17:34
Assumption that chain DMA module starts the link DMA when 1ms of
data is available from host is not correct. Instead the firmware
chain DMA module fills the link DMA with initial buffer of zeroes
and the host and link DMAs are started at the same time.

This results in a small error in delay calculation. This can become a
more severe problem if host DMA has delays that exceed 1ms. This results
in negative delay to be calculated and bogus values reported to
applications. This can confuse some applications like
alsa_conformance_test.

Fix the issue by correctly calculating the firmware chain DMA
preamble size and initializing the start offset to this value.

Fixes: a1d203d ("ASoC: SOF: ipc4-pcm: Enable delay reporting for ChainDMA streams")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
(cherry picked from commit e31e448)
@kv2019i kv2019i force-pushed the 202508-delay-handling-test branch from 2cb723b to 8a916a5 Compare August 13, 2025 18:10
@kv2019i
Copy link
Collaborator Author

kv2019i commented Aug 18, 2025

No longer needed.

@kv2019i kv2019i closed this Aug 18, 2025
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.

1 participant