diff options
author | Jason Chen <jason.chen@linaro.org> | 2011-12-19 03:23:28 (GMT) |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-12-19 11:25:35 (GMT) |
commit | 5776ac2eb33164c77cdb4d2b48feee15616eaba3 (patch) | |
tree | ff2dee4d0f3aa296190dc1a7a7812587c199f14c /arch | |
parent | 384703b8e6cd4c8ef08512e596024e028c91c339 (diff) | |
download | linux-fsl-qoriq-5776ac2eb33164c77cdb4d2b48feee15616eaba3.tar.xz |
ARM:imx:fix pwm period value
According to imx pwm RM, the real period value should be
PERIOD value in PWMPR plus 2.
PWMO (Hz) = PCLK(Hz) / (period +2)
Signed-off-by: Jason Chen <jason.chen@linaro.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: stable@kernel.org
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/plat-mxc/pwm.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c index 845de59..e032717 100644 --- a/arch/arm/plat-mxc/pwm.c +++ b/arch/arm/plat-mxc/pwm.c @@ -77,6 +77,15 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) do_div(c, period_ns); duty_cycles = c; + /* + * according to imx pwm RM, the real period value should be + * PERIOD value in PWMPR plus 2. + */ + if (period_cycles > 2) + period_cycles -= 2; + else + period_cycles = 0; + writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR); writel(period_cycles, pwm->mmio_base + MX3_PWMPR); |