diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2021-04-20 11:51:18 +0200 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2021-04-23 19:05:31 +0200 |
commit | 8035e6c66a5e98f098edf7441667de74affb4e78 (patch) | |
tree | 5385bbac7b69e71a227b8c40fa8ceee42683e9e9 /arch/x86 | |
parent | 453e8b3d8e36ddcb283b3d1698864a03ea45599a (diff) |
pwm: atmel: Improve duty cycle calculation in .apply()
In the calculation of the register value determining the duty cycle the
requested period is used instead of the actually implemented period which
results in suboptimal settings.
The following example assumes an input clock of 133333333 Hz on one of
the SoCs with 16 bit period.
When the following state is to be applied:
.period = 414727681
.duty_cycle = 652806
the following register values used to be calculated:
PRES = 10
CPRD = 54000
CDTY = 53916
which yields an actual duty cycle of a bit more than 645120 ns.
The setting
PRES = 10
CPRD = 54000
CDTY = 53915
however yields a duty of 652800 ns which is between the current result
and the requested value and so is a better approximation.
The reason for this error is that for the calculation of CDTY the
requested period was used instead of the actually implemented one.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'arch/x86')
0 files changed, 0 insertions, 0 deletions