diff --git a/drivers/pwm/pwm_nrfx.c b/drivers/pwm/pwm_nrfx.c index 420a9078c59..d31eea84788 100644 --- a/drivers/pwm/pwm_nrfx.c +++ b/drivers/pwm/pwm_nrfx.c @@ -129,11 +129,6 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, uint32_t period_cycles, uint32_t pulse_cycles, pwm_flags_t flags) { - /* We assume here that period_cycles will always be 16MHz - * peripheral clock. Since pwm_nrfx_get_cycles_per_sec() function might - * be removed, see ISSUE #6958. - * TODO: Remove this comment when issue has been resolved. - */ const struct pwm_nrfx_config *config = dev->config; struct pwm_nrfx_data *data = dev->data; uint16_t compare_value; @@ -176,6 +171,10 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, seq_values_ptr_get(dev)[channel] = PWM_NRFX_CH_VALUE(compare_value, inverted); +#ifdef CONFIG_NRFX_PWM120 + sys_cache_data_flush_range((void *)config->seq.values.p_raw, config->seq.length); +#endif + LOG_DBG("channel %u, pulse %u, period %u, prescaler: %u.", channel, pulse_cycles, period_cycles, data->prescaler); @@ -243,12 +242,11 @@ static int pwm_nrfx_set_cycles(const struct device *dev, uint32_t channel, static int pwm_nrfx_get_cycles_per_sec(const struct device *dev, uint32_t channel, uint64_t *cycles) { - /* TODO: Since this function might be removed, we will always return - * 16MHz from this function and handle the conversion with prescaler, - * etc, in the pin set function. See issue #6958. - */ +#ifdef CONFIG_NRFX_PWM120 + *cycles = 320ul * 1000ul * 1000ul; +#else *cycles = 16ul * 1000ul * 1000ul; - +#endif return 0; }