[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210329171559.rfelpt42shlebct5@pengutronix.de>
Date: Mon, 29 Mar 2021 19:15:59 +0200
From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
To: Clemens Gruber <clemens.gruber@...ruber.com>
Cc: linux-pwm@...r.kernel.org,
Thierry Reding <thierry.reding@...il.com>,
Sven Van Asbroeck <TheSven73@...il.com>,
linux-kernel@...r.kernel.org, kernel@...gutronix.de
Subject: Re: [PATCH v6 6/7] pwm: pca9685: Restrict period change for
prescaler users
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/ |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists