summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPeter Korsgaard <jacmet@sunsite.dk>2009-07-01 17:47:08 +0200
committerBen Dooks <ben-linux@fluff.org>2009-07-31 00:54:50 +0200
commit165f5f64199f972a21f21effc125d89ed2488e58 (patch)
tree1c476656788344f6bea3c4555711b53673f62e84 /arch
parentS3C64XX: Fix ARMCLK configuration (diff)
downloadlinux-165f5f64199f972a21f21effc125d89ed2488e58.tar.xz
linux-165f5f64199f972a21f21effc125d89ed2488e58.zip
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/plat-s3c24xx/pwm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm/plat-s3c24xx/pwm.c b/arch/arm/plat-s3c24xx/pwm.c
index 0120b760315b..82a6d4de02a3 100644
--- a/arch/arm/plat-s3c24xx/pwm.c
+++ b/arch/arm/plat-s3c24xx/pwm.c
@@ -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);