]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - sitara-epos/sitara-epos-kernel.git/commitdiff
pwm:ehrpwm - Fix duty cycle inversion eHRPWM wave.
authorShankarmurthy, Akshay <akshay.s@ti.com>
Mon, 26 Dec 2011 05:44:48 +0000 (11:14 +0530)
committerPhilip, Avinash <avinashphilip@ti.com>
Thu, 9 Feb 2012 15:20:49 +0000 (20:50 +0530)
Patch fixes the ON and OFF period inversion in PWM wave.
Action qualifier register settings causes switching PWM wave to OFF
period when counter reaches zero and to ON period on counter reaches
compare value. Because of this inversion in duty cycle was observed.

Signed-off-by: Shankarmurthy, Akshay <akshay.s@ti.com>
Signed-off-by: Philip, Avinash <avinashphilip@ti.com>
drivers/pwm/ehrpwm.c

index 9b48d75a7e28bd1f2459256361cbef55d6382784..c0d34566c489712d0c2a12575e2a97495f137ef6 100644 (file)
@@ -978,9 +978,10 @@ static int ehrpwm_pwm_set_pol(struct pwm_device *p)
                ctreqcmp = 8;
        }
 
-       val = ((p->active_high ? ACTCTL_CTREQCMP_LOW : ACTCTL_CTREQCMP_HIGH)
-                << ctreqcmp) | (p->active_high ? ACTCTL_CTREQZRO_HIGH :
-                       ACTCTL_CTREQZRO_LOW);
+
+       val = ((p->active_high ? ACTCTL_CTREQCMP_HIGH : ACTCTL_CTREQCMP_LOW)
+                << ctreqcmp) | (p->active_high ? ACTCTL_CTREQZRO_LOW :
+                       ACTCTL_CTREQZRO_HIGH);
        ehrpwm_write(ehrpwm, act_ctrl_reg, val);
 
        return 0;