Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit f8caa792 authored by David Rivshin's avatar David Rivshin Committed by Thierry Reding
Browse files

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: 6604c655 ("pwm: Add PWM driver for OMAP using dual-mode timers")
Signed-off-by: default avatarDavid Rivshin <drivshin@allworx.com>
Acked-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Tested-by: default avatarAdam Ford <aford173@gmail.com>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent c5857e3f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment