lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150720093011.GQ29614@ulmo>
Date:	Mon, 20 Jul 2015 11:30:22 +0200
From:	Thierry Reding <thierry.reding@...il.com>
To:	Clemens Gruber <clemens.gruber@...ruber.com>
Cc:	linux-pwm@...r.kernel.org, linux-kernel@...r.kernel.org,
	Steffen Trumtrar <s.trumtrar@...gutronix.de>
Subject: Re: [PATCH v3 2/2] pwm-pca9685: Support changing the output frequency

On Mon, Jul 20, 2015 at 10:36:09AM +0200, Clemens Gruber wrote:
> Previously, period_ns and duty_ns were only used to determine the
> ratio of ON and OFF time, the default frequency of 200 Hz was never
> changed.
> The PCA9685 however is capable of changing the PWM output frequency,
> which is expected when changing the period.
> 
> This patch configures the prescaler accordingly, using the formula
> and notes provided in the PCA9685 datasheet.
> Bounds checking for the minimum and maximum frequencies, last updated
> in revision v.4 of said datasheet, is also added.
> 
> The prescaler is only touched if the period changed, because we have to
> put the chip into sleep mode to unlock the prescale register.
> If it is changed, the PWM output frequency changes for all outputs,
> because there is one prescaler per chip. This is documented in the
> PCA9685 datasheet and in the comments.

I think the reason why the driver doesn't support changing the frequency
is precisely because it has a per-chip prescaler. So you'd be changing
the frequency from other all other users if one of the channels requests
to do so. If I remember correctly there had been some discussion back at
the time that this wasn't safe to do.

If you have to do this, I'd think you'd need to at least update the duty
cycle of all other users according to the new period.

Thierry

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ