Skip to content

Commit 38e2f80

Browse files
committed
driver: clock: espressif: always use calibrated frequency
When clock get_rate() is called, return calibrated frequency instead of nominal one. This improves accuracy specially when internal RC SLOW clock is used. Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
1 parent c2f8f98 commit 38e2f80

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/clock_control/clock_control_esp32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,10 @@ static int clock_control_esp32_get_rate(const struct device *dev, clock_control_
567567

568568
switch ((int)sys) {
569569
case ESP32_CLOCK_CONTROL_SUBSYS_RTC_FAST:
570-
*rate = esp_clk_tree_lp_fast_get_freq_hz(ESP_CLK_TREE_SRC_FREQ_PRECISION_APPROX);
570+
*rate = esp_clk_tree_lp_fast_get_freq_hz(ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED);
571571
break;
572572
case ESP32_CLOCK_CONTROL_SUBSYS_RTC_SLOW:
573-
*rate = clk_hal_lp_slow_get_freq_hz();
573+
*rate = esp_clk_tree_lp_slow_get_freq_hz(ESP_CLK_TREE_SRC_FREQ_PRECISION_CACHED);
574574
break;
575575
default:
576576
*rate = clk_hal_cpu_get_freq_hz();

0 commit comments

Comments
 (0)