Re: [PATCH v6 6/7] pwm: pca9685: Restrict period change for prescaler users

2021-03-29 Thread Uwe Kleine-König
Hello Clemens, On Mon, Mar 29, 2021 at 07:33:56PM +0200, Clemens Gruber wrote: > On Mon, Mar 29, 2021 at 07:15:59PM +0200, Uwe Kleine-König wrote: > > 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, >

Re: [PATCH v6 6/7] pwm: pca9685: Restrict period change for prescaler users

2021-03-29 Thread Clemens Gruber
On Mon, Mar 29, 2021 at 07:15:59PM +0200, Uwe Kleine-König wrote: > 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) { > >

Re: [PATCH v6 6/7] pwm: pca9685: Restrict period change for prescaler users

2021-03-29 Thread Uwe Kleine-König
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(p

[PATCH v6 6/7] pwm: pca9685: Restrict period change for prescaler users

2021-03-29 Thread Clemens Gruber
Previously, the last used PWM channel could change the global prescale setting, even if other channels are already in use. Fix it by only allowing the first user of the prescaler to change the global chip-wide prescale setting. If there is more than one channel in use, the prescale settings result