Repository navigation
Conversation
The Zephyr versions of these SOF time and delay helpers only forwarded to a Zephyr call: - sys_cycle_get_64_rate() returned CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC, use sys_clock_hw_cycles_per_sec() instead. It is the same constant unless the timer driver reads its rate at runtime, in which case the wallclock rate now matches the rate that the cycle conversions use. - sof_cycle_get_64_atomic() and sof_cycle_get_64_safe() were aliases of sof_cycle_get_64(). The two DMA domains were the last users of the first one, the second one had no users, and the host versions had no users either. - wait_delay(), wait_delay_us() and wait_delay_ms() wrapped k_busy_wait(). Call k_busy_wait() in the detect test, the AMD ACP 7.x clock code and poll_for_register_delay(). poll_for_register_delay() and wait_for_interrupt() stay for the i.MX and AMD IPC drivers until those move to Zephyr. The host keeps its own wait_delay*() for its k_sleep() stubs. No functional change. With one inline function less, GCC allocates registers and lays out branches differently in default_detect_test() and poll_for_register_delay(); the other objects are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review findings requiring changes.
No open issues 🎉
What changed in this PR
This PR advances #11517’s migration to native Zephyr APIs by removing redundant SOF time and delay wrappers while retaining required host support and the portable cycle-counter helper.
Changes:
- Use Zephyr’s clock-rate and busy-wait APIs directly.
- Replace DMA scheduler cycle-counter aliases with
sof_cycle_get_64(). - Remove unused timer aliases and Zephyr delay wrappers, retaining host delay helpers.
| File | Description |
|---|---|
zephyr/wrapper.c |
Use Zephyr APIs for wallclock frequency and polling delays. |
zephyr/include/rtos/wait.h |
Remove redundant Zephyr delay wrappers. |
zephyr/include/rtos/timer.h |
Remove the clock-rate wrapper and unused cycle-counter aliases. |
src/schedule/dma_single_chan_domain.c |
Call sof_cycle_get_64() directly for scheduling checks. |
src/schedule/dma_multi_chan_domain.c |
Call sof_cycle_get_64() directly for task readiness. |
src/samples/audio/detect_test.c |
Use Zephyr busy-wait calls for simulated processing load. |
src/kernel/platform/amd/acp_7_x/lib/clk.c |
Replace delay wrappers with k_busy_wait(). |
posix/include/rtos/timer.h |
Remove unused host cycle-counter helpers. |
Review effort: Balanced
lgirdwood
marked this pull request as ready for review
December 1, 2026 20:14
lgirdwood
requested review from
LaurentiuM1234,
abonislawski,
bhiregoudar,
dbaluta,
iuliana-prodan,
kv2019i,
lbetlej,
lyakh,
marcinszkudlinski,
mmaka1,
pblaszko,
plbossart and
sunilkumardommati
as code owners
December 1, 2026 20:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use the Zephyr time and delay calls directly instead of the SOF wrappers that only forwarded to them. Part of #11517 (step 2, "Kernel-only code: switch to Zephyr APIs directly").
Changes
sys_cycle_get_64_rate()→sys_clock_hw_cycles_per_sec()for the DAI wallclock rate. It is the same constant unless the timer driver reads its rate at runtime, and then the wallclock rate matches the rate the cycle conversions use.sof_cycle_get_64_atomic()→sof_cycle_get_64()in the two DMA domains, the last users.sof_cycle_get_64_safe()had no users. Both aliases are removed, and so are the unused host versions.wait_delay(),wait_delay_us()andwait_delay_ms()→k_busy_wait()in the detect test, the AMD ACP 7.x clock code andpoll_for_register_delay(). The Zephyr wrappers are removed.Not in this PR
poll_for_register_delay()andwait_for_interrupt(): only the i.MX and AMD IPC drivers use them. They go when those drivers move to Zephyr ([FEATURE] Remove the remaining XTOS-era code and move SOF to native Zephyr APIs and drivers #11517 steps 9 and 13).poll_for_register_delay()keeps its current polling, so i.MX IPC init timing is unchanged.sof_cycle_get_64(): kept, becausek_cycle_get_64()asserts on platforms without a 64-bit counter.platform_timer_stop(): kept, because the IPC handlers that call it are also built for the host, where it is a real function.wait_delay*(): kept for the hostk_sleep()stubs.Functional change
None. With one inline function less, GCC allocates registers and lays out branches differently in
default_detect_test()andpoll_for_register_delay(); no other object changes.Testing
platform_dai_wallclock()in the NVLwrapper.calso gains three bytes of alignment padding before a branch target; its instructions are the same.🤖 Generated with Claude Code