pwm: pca9685: Support hardware readout
authorClemens Gruber <clemens.gruber@pqgruber.com>
Thu, 15 Apr 2021 12:14:49 +0000 (14:14 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Fri, 23 Apr 2021 16:45:14 +0000 (18:45 +0200)
commit8f4768a56b673cbff3f24cf7b1784852c0f572d1
tree0fd1a6b6a495231cde55423c86bd7301e7da727b
parent9af1fba33b5751d71c0e6727a875b9fd7d8a99de
pwm: pca9685: Support hardware readout

Implement .get_state to read-out the current hardware state.

The hardware readout may return slightly different values than those
that were set in apply due to the limited range of possible prescale and
counter register values.

Also note that although the datasheet mentions 200 Hz as default
frequency when using the internal 25 MHz oscillator, the calculated
period from the default prescaler register setting of 30 is 5079040ns.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-pca9685.c