On Mon, Mar 29, 2021 at 02:57:06PM +0200, Clemens Gruber wrote: > @@ -330,14 +345,22 @@ static int pca9685_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, > > if (!state->enabled || duty < 1) { > pca9685_pwm_set_duty(pca, pwm->hwpwm, 0); > + clear_bit(pwm->hwpwm, pca->prescaler_users); Hmm, so if "my" channel runs at say .duty_cycle = 2539520 ns .period = 5079040 ns and I call pwm_apply_state(mypwm, { .duty_cycle = 0, .period = 5079040, enabled = true }); it might happen that another channel modifies the period and I won't be able to return to the initial setting. So I think it's sensible to only clear the user bit if the PWM is disabled, but not if it is configured for duty_cycle = 0. Does this make sense? Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |