Skip to content

Implement the shared dmdrvi audio stream contract - #8

Merged
JohnAmadis merged 1 commit into
mainfrom
ccr-0ed2b297-4zti6v
Oct 11, 2026
Merged

JohnAmadis merged 1 commit into
mainfrom
ccr-0ed2b297-4zti6v

Conversation

@JohnAmadis

Copy link
Copy Markdown
Contributor

Summary

Replaces the private DMSAI_IOCTL_* commands with the DMDRVI_IOCTL_AUDIO_* stream commands from dmdrvi 2.7 (choco-technologies/dmdrvi#28, released). A codec node such as dmwm8994 implements the same contract, so an application plays the same way on the codec and on the bare SAI, and a codec drives its SAI friend without any dmsai header.

This is the follow-up to #7. That PR was merged after only its first commit (the fix for the DMA wake-up) and before the contract change landed on the branch.

Changes

  • GET_STREAM returns dmdrvi_audio_stream_t: the buffer layout (rate, format, channels = active slots) and the serial link (framing, clock role, slots).
  • CONFIGURE returns 0 only when rate, channels and width match the ini format; otherwise -ENOTSUP.
  • START succeeds when the stream is already running (it used to return -EBUSY).
  • STOP, GET_STATUS, SET_TIMEOUT / GET_TIMEOUT and DRAIN behave as before, under the new command numbers.
  • GET_INFO, SET_VOLUME and SET_MUTE return -ENOTSUP, since the SAI has no analog stage. This also keeps dmdevfs from reporting the SAI as an audio device.
  • include/dmsai_ioctl.h and DMSAI_IOCTL_* are removed. The port API keeps dmsai_config_t / dmsai_status_t, and static asserts check that the format and clock role values match dmdrvi.
  • The README, docs/api-reference.md and the driver board test are updated. The board test also checks CONFIGURE matching and mismatching, the -ENOTSUP volume control and the idempotent START.

Breaking: clients of DMSAI_IOCTL_* must move to the dmdrvi commands. In this ecosystem that is dmwm8994 only, in choco-technologies/dmwm8994 (see the sibling PR). Merge the two together; until then a dmwm8994 build from main talks to this node with commands it no longer answers.

Verification

  • Builds for cortex-m7 against the released dmdrvi 2.7 package, after clearing the dmf-get manifest cache.
  • The same tree ran in Renode (SAI, DMA and WM8994 models from Renode models for SAI audio through the WM8994 dmod-boot#122). A generic player that uses only the shared commands played an 8 s melody correctly through the codec (/dev/wm8994, all 32 notes at the expected frequencies) and ran on /dev/dmsai1 directly without underruns, apart from the drain tail. That path is silent, because nothing configures the codec on it.
  • Not tested on the physical board.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Nr1HhezRY951yBxxTm1b65


Generated by Claude Code

Replace the private DMSAI_IOCTL_* commands with the DMDRVI_IOCTL_AUDIO_*
stream commands from dmdrvi 2.7 - GET_STREAM, START, STOP, GET_STATUS,
SET/GET_TIMEOUT and DRAIN. A codec node such as dmwm8994 implements the
same contract, so an application plays the same way on both and a codec
drives its SAI friend without any dmsai header.

- GET_STREAM reports the buffer layout (channels = active slots) and the
  serial link (dmdrvi_audio_stream_t).
- CONFIGURE succeeds only for the ini format (rate, channels, width),
  -ENOTSUP otherwise.
- START succeeds when already running (was -EBUSY).
- GET_INFO, SET_VOLUME and SET_MUTE return -ENOTSUP: no analog stage,
  which also keeps dmdevfs from reporting the SAI as an "audio" device.

dmsai_ioctl.h is removed. The port API keeps dmsai_config_t and
dmsai_status_t; static asserts check that the format and clock role
values match dmdrvi's. Requires dmdrvi 2.7.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nr1HhezRY951yBxxTm1b65
@JohnAmadis
JohnAmadis merged commit 2942c62 into main Oct 11, 2026
3 checks passed
@JohnAmadis JohnAmadis self-assigned this Oct 11, 2026
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