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;
status_t status;
if (data->period_cycles != 0) {
/* Only warn when not changing from zero */
LOG_WRN("Changing period cycles from %d to %d"
" affects all %d channels in %s",
data->period_cycles, period_cycles,
config->channel_count, dev->config->name);
}
data->period_cycles = period_cycles;