> On May 28, 2018, at 11:09 AM, Jason Thorpe <thor...@me.com> wrote:
>
> I’m going to be writing a driver for the NXP PCA9685, and want to glue it
> into the PWM kernel API jmcneill@ added… but I have a bunch of uses for this
> device that won’t really be covered by FDT, so I think there needs to be some
> sort of user space API as well.
Actually, while I’m at it, there are some other problems with the current API,
trying to think of how I would adjust it…
The PCA9685 is fairly simple in that it basically has 2 comparators per channel
that reference a 12-bit counter that’s either driven by the internal 25MHz
oscillator, or an external clock source that can run up to 50MHz.
There an “ON” value and an “OFF” value. When the counter is equal to the ON
value, the output is asserted. When the counter is equal to the OFF value, the
counter is de-asserted. The advantage of this is that it, if you’re
referencing multiple PCA9685s to the same external clock, you can do any
phase-shift compensation as necessary by setting the ON time for a group of
channels to non-zero. The current API doesn’t have any way to express this.
The PCA9685 also doesn’t have a variable clock UNLESS it’s driven by an
external clock source, in which case a pre-scaler value can be applied (though,
I’m not 100% certain on this — need to re-read the data sheet). So having to
configure the period as the current API requires is kind of inconvenient.
-- thorpej