Skip to content

Conversation

@bugadani
Copy link
Contributor

@bugadani bugadani commented Dec 9, 2025

  • This PR adds the PLL_F160M clock source to ESP32, which is a clock source of the MCPWM and I2S peripherals.
  • This PR removes the unnecessary i2c_clock field from the cached global clock speed struct.

I wanted to remove more of the fields, but at least RNG needs a low-overhead way to read CPU and APB frequencies for throttling purposes, so the struct itself needs to stick around until a general strategy can replace it.

cc #4502

Copilot AI review requested due to automatic review settings December 9, 2025 10:30
@bugadani bugadani added the skip-changelog No changelog modification needed label Dec 9, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the ESP32 clock tree implementation by adding the PLL_F160M_CLK clock source and removing the redundant i2c_clock field from the cached clock configuration. The PLL_F160M_CLK is a 160 MHz clock derived from the PLL and serves as the clock source for MCPWM and I2S peripherals.

  • Adds PLL_F160M_CLK definition to ESP32 clock tree metadata
  • Updates pwm_clock to use the new PLL_F160M_CLK source instead of hardcoded 160 MHz
  • Removes i2c_clock field and updates I2C drivers to query ClockTree directly
  • Refactors MCPWM clock source retrieval into a helper method

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
esp-metadata/devices/esp32.toml Adds PLL_F160M_CLK clock node definition derived from PLL_CLK
esp-metadata-generated/src/_generated_esp32.rs Generates request/release/frequency functions and reference counting for PLL_F160M_CLK
esp-metadata-generated/src/_build_script_utils.rs Adds build configuration flags for the new clock node
esp-hal/src/soc/esp32/clocks.rs Implements enable_pll_f160m_clk_impl as no-op since clock is always available when PLL is enabled
esp-hal/src/mcpwm/mod.rs Refactors clock source retrieval into source_clock() helper method
esp-hal/src/i2c/master/mod.rs Removes Clocks import and updates set_frequency implementations to query ClockTree directly
esp-hal/src/clock/mod.rs Removes i2c_clock field and updates pwm_clock to use pll_f160m_clk_frequency()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bugadani bugadani marked this pull request as draft December 9, 2025 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog No changelog modification needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant