]> git.baikalelectronics.ru Git - kernel.git/commit
pwm: omap-dmtimer: Round load and match values rather than truncate
authorDavid Rivshin <drivshin@allworx.com>
Sat, 30 Jan 2016 04:26:53 +0000 (23:26 -0500)
committerThierry Reding <thierry.reding@gmail.com>
Wed, 23 Mar 2016 16:11:47 +0000 (17:11 +0100)
commitdffd02d7602cedc9d1b34b8157afdc4f5241ba21
tree2c3a38a5419fa19b716d5aad77a48702257dc30a
parentc6e7e827aeed63390f3bd6739bfa8e9c73f6a485
pwm: omap-dmtimer: Round load and match values rather than truncate

When converting period and duty_cycle from nanoseconds to fclk cycles,
the error introduced by the integer division can be appreciable, especially
in the case of slow fclk or short period. Use DIV_ROUND_CLOSEST_ULL() so
that the error is kept to +/- 0.5 clock cycles.

Fixes: 124bd78cf137 ("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>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-omap-dmtimer.c