mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
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: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
This commit is contained in:
parent
9b71de49b0
commit
165f5f6419
1 changed files with 4 additions and 0 deletions
|
@ -246,6 +246,10 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
|
|||
|
||||
tcmp = duty_ns / tin_ns;
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue