]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
pwm: omap-dmtimer: Fix inaccurate period and duty cycle calculations
authorDavid Rivshin <drivshin@allworx.com>
Sat, 30 Jan 2016 04:26:51 +0000 (23:26 -0500)
committerThierry Reding <thierry.reding@gmail.com>
Wed, 23 Mar 2016 16:11:45 +0000 (17:11 +0100)
commitf8caa792261c0edded20eba2b8fcc899a1b91819
tree7920bbf9a010fe99d53ac154f7fc20253127f3f3
parentc5857e3f94ab2719dfac649a146cb5dd6f21fcf3
pwm: omap-dmtimer: Fix inaccurate period and duty cycle calculations

Fix the calculation of load_value and match_value. Currently they
are slightly too low, which produces a noticeably wrong PWM rate with
sufficiently short periods (i.e. when 1/period approaches clk_rate/2).

Example:
 clk_rate=32768Hz, period=122070ns, duty_cycle=61035ns (8192Hz/50% PWM)
 Correct values: load = 0xfffffffc, match = 0xfffffffd
 Current values: load = 0xfffffffa, match = 0xfffffffc
 effective PWM: period=183105ns, duty_cycle=91553ns (5461Hz/50% PWM)

Fixes: 6604c6556db9 ("pwm: Add PWM driver for OMAP using dual-mode timers")
Signed-off-by: David Rivshin <drivshin@allworx.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-omap-dmtimer.c