drivers: pwm: mcux_ftm: only emit warning on period change from zero

Only emit a warning about changing PWM period for all channels of a
given FTM instance when changing the period from zero to
non-zero. This silences the useless warning issued at first FTM PWM
channel configuration.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2019-11-13 12:29:16 +01:00 committed by Maureen Helm
commit 7694ebb694

View file

@ -61,10 +61,13 @@ static int mcux_ftm_pin_set(struct device *dev, u32_t pwm,
u32_t pwm_freq; u32_t pwm_freq;
status_t status; status_t status;
LOG_WRN("Changing period cycles from %d to %d" if (data->period_cycles != 0) {
" affects all %d channels in %s", /* Only warn when not changing from zero */
data->period_cycles, period_cycles, LOG_WRN("Changing period cycles from %d to %d"
config->channel_count, dev->config->name); " affects all %d channels in %s",
data->period_cycles, period_cycles,
config->channel_count, dev->config->name);
}
data->period_cycles = period_cycles; data->period_cycles = period_cycles;