Commit 165f5f64 authored by Peter Korsgaard's avatar Peter Korsgaard Committed by Ben Dooks

ARM: S3C: PWM fix for low duty cycle

The pwm hardware only checks the compare register after a decrement,
so the pin never toggles if tcmp = tcnt.

This happens when a very low duty cycle is requested. Fix it by always
ensuring that tcmp < tcnt.
Signed-off-by: default avatarPeter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent 9b71de49
...@@ -246,6 +246,10 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) ...@@ -246,6 +246,10 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
tcmp = duty_ns / tin_ns; tcmp = duty_ns / tin_ns;
tcmp = tcnt - tcmp; tcmp = tcnt - tcmp;
/* the pwm hw only checks the compare register after a decrement,
so the pin never toggles if tcmp = tcnt */
if (tcmp == tcnt)
tcmp--;
pwm_dbg(pwm, "tin_ns=%lu, tcmp=%ld/%lu\n", tin_ns, tcmp, tcnt); pwm_dbg(pwm, "tin_ns=%lu, tcmp=%ld/%lu\n", tin_ns, tcmp, tcnt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment