Skip to content

Conversation

@michal-chvatal
Copy link

This PR introduces get_caps() API to DMIC, I2S, and Codec subsystems, enabling
drivers to report their audio capabilities such as supported sample rates, bit widths,
channel counts, buffer requirements, and frame timing.

It implements the API for MCUX I2S Flexcomm, DMIC, and WM8904 audio drivers.

It also introduces common audio definitions in audio_caps.h to unify capability
flags across subsystems.

Changes are related to new MediaPipe library.

Also fix pin mapping and Flexcomm signal sharing on the mimxrt685_evk/mimxrt685s/cm33 (included also in the #95164).

Add SCK and WS signals to a shared signal set between Flexcomm #1 and
Flexcomm #3 for the mimxrt685_evk/mimxrt685s/cm33.

This enables the board to both transmit and receive audio, as the BCK
and WS signals produced by the WM8904 codec are only connected to the
Flexcomm #1 peripheral.

Signed-off-by: Vit Stanicek <[email protected]>
Map all pins of RT685's Flexcomm #1 peripheral. Needed for operation of Flexcomm #1 in I2S mode or Flexcomm #3 in I2S mode with shared signals.

Signed-off-by: Vit Stanicek <[email protected]>
@github-actions
Copy link

Hello @michal-chvatal, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

Copy link
Member

@decsny decsny left a comment

Choose a reason for hiding this comment

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

you need to add testing of this feature

struct _dmic_ops *api = (struct _dmic_ops *)dev->api;

if (api->get_caps == NULL) {
return -ENOSYS;
Copy link
Member

Choose a reason for hiding this comment

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

this particular error code should be documented what it means

struct i2s_driver_api *api = (struct i2s_driver_api *)dev->api;

if (api->get_caps == NULL) {
return -ENOSYS;
Copy link
Member

Choose a reason for hiding this comment

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

this particular error code should be documented what it means

@michal-chvatal
Copy link
Author

I've created a pull request for the libMP-related changes only: #99087 .I'll also take the above comments into account in the next update.

Introduce `get_caps()` API to DMIC, I2S, and Codec subsystems to expose
driver-specific audio capabilities such as supported sample rates,
bit widths, channel counts, buffer requirements, and frame timing.

Introduce common audio definitions in `audio_caps.h` to unify capability
flags across subsystems.

Signed-off-by: Michal Chvatal <[email protected]>
Implement the `get_caps()` API for MCUX I2S Flexcomm, DMIC, and
WM8904 audio drivers to expose driver-specific capabilities
including supported sample rates, bit widths, channel counts, and
buffer requirements.

All drivers set temporary 10ms minimum frame interval as workaround
for MediaPipe library compatibility.

Signed-off-by: Michal Chvatal <[email protected]>
Changes affect:
- drivers: i2s_mcux_flexcomm, dmic_mcux and wm8904
- audio subsystem headers: i2s.h, codec.h, dmic.h

No functional changes, formatting improvements only.

Signed-off-by: Michal Chvatal <[email protected]>
Add test for the `get_caps()` API in both I2S and DMIC
driver test suites. Tests validate successful operation,
capability value ranges, and error handling with NULL parameters.

Tests handle drivers that don't implement get_caps by gracefully
skipping when -ENOSYS is returned, ensuring compatibility
across different driver implementations.

Signed-off-by: Michal Chvatal <[email protected]>
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants