Skip to content

Commit

Permalink
drivers: pwm: ledc: esp32c2: esp32c6: Fix clock frequency
Browse files Browse the repository at this point in the history
Fix clock frequency for both devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
  • Loading branch information
Raffael Rostagno authored and mmahadevan108 committed Nov 5, 2024
1 parent ba52c8c commit b9fc4cc
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions drivers/pwm/pwm_led_esp32.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(pwm_ledc_esp32, CONFIG_PWM_LOG_LEVEL);

#if SOC_LEDC_SUPPORT_APB_CLOCK
#define CLOCK_SOURCE LEDC_APB_CLK
#elif SOC_LEDC_SUPPORT_PLL_DIV_CLOCK
#define CLOCK_SOURCE LEDC_SCLK
#if defined(CONFIG_SOC_SERIES_ESP32C2)
#define SCLK_CLK_FREQ MHZ(60)
#elif defined(CONFIG_SOC_SERIES_ESP32C6)
#define SCLK_CLK_FREQ MHZ(80)
#endif
#endif

struct pwm_ledc_esp32_data {
ledc_hal_context_t hal;
struct k_sem cmd_sem;
Expand Down Expand Up @@ -350,12 +361,6 @@ static const struct pwm_driver_api pwm_led_esp32_api = {

PINCTRL_DT_INST_DEFINE(0);

#if SOC_LEDC_SUPPORT_APB_CLOCK
#define CLOCK_SOURCE LEDC_APB_CLK
#elif SOC_LEDC_SUPPORT_PLL_DIV_CLOCK
#define CLOCK_SOURCE LEDC_SCLK
#endif

#define CHANNEL_CONFIG(node_id) \
{ \
.idx = DT_REG_ADDR(node_id), \
Expand Down

0 comments on commit b9fc4cc

Please sign in to comment.