Skip to content

Conversation

soburi
Copy link
Owner

@soburi soburi commented Oct 4, 2025

Summary

  • add a DMIC driver that uses the ES7210 codec as an I2S microphone source
  • describe the new device tree binding and enable the driver for the CoreS3 sample

Testing

  • west build -b m5stack_cores3/esp32s3/procpu -p -s samples/drivers/i2s/i2s_codec (fails: west not installed in environment)

https://chatgpt.com/codex/tasks/task_e_68e12ab37bf48322a10ef69cfb30384a

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting

Comment on lines 86 to 109
codec_cfg.dai_route = AUDIO_ROUTE_CAPTURE;
codec_cfg.dai_type = AUDIO_DAI_TYPE_I2S;
codec_cfg.dai_cfg.i2s.word_size = stream->pcm_width;
codec_cfg.dai_cfg.i2s.channels = cfg->channel.req_num_chan;
codec_cfg.dai_cfg.i2s.format = format;
codec_cfg.dai_cfg.i2s.options = conf->i2s_options;
codec_cfg.dai_cfg.i2s.frame_clk_freq = stream->pcm_rate;
codec_cfg.dai_cfg.i2s.mem_slab = stream->mem_slab;
codec_cfg.dai_cfg.i2s.block_size = stream->block_size;
codec_cfg.dai_cfg.i2s.timeout = conf->timeout_ms;

ret = audio_codec_configure(conf->codec_dev, &codec_cfg);
if (ret < 0) {
LOG_ERR("Failed to configure ES7210 codec (%d)", ret);
return ret;
}

audio_codec_stop_output(conf->codec_dev);

i2s_cfg.word_size = stream->pcm_width;
i2s_cfg.channels = cfg->channel.req_num_chan;
i2s_cfg.format = format;
i2s_cfg.options = conf->i2s_options;
i2s_cfg.frame_clk_freq = stream->pcm_rate;

Choose a reason for hiding this comment

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

P1 Badge Configure codec with inverted I²S master/slave role

The DMIC driver derives i2s_options from the devicetree properties and then applies the same flags to both the I²S controller and the ES7210 codec (codec_cfg.dai_cfg.i2s.options = conf->i2s_options; and later i2s_cfg.options = conf->i2s_options). However ES7210_DMIC_OPTIONS() produces settings from the SoC perspective: when the ES7210 is the bit/frame clock master, the macro returns _SLAVE so that the I²S peripheral behaves as a slave, and vice versa. Reusing those flags for the codec therefore programs the codec with the opposite master/slave role advertised in devicetree (e.g. the codec is set as master when the SoC should be master). On real hardware this results in both sides trying to act as the same bus role and the microphone never streams. The codec options need to mirror the devicetree properties while the I²S controller should receive the inverted options.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant