]> git.baikalelectronics.ru Git - kernel.git/commit
pwm: mxs: Fix period divider computation
authorGaetan Hug <ghug@induct.be>
Wed, 11 Mar 2015 12:08:12 +0000 (13:08 +0100)
committerThierry Reding <thierry.reding@gmail.com>
Wed, 11 Mar 2015 12:11:16 +0000 (13:11 +0100)
commit3cc137668b2484b86970e8a3cef7ed1fed0463c2
tree931a34a00fc38bc38ee9367a0b47ceaa3c7dcb0b
parent6dd95d589c00da75dc1c068b04d9e042f7715e1e
pwm: mxs: Fix period divider computation

The driver computes which clock divider it sould be using from the
requested period. This computation assumes that the link between the
register value and the actual divider value is raising 2 to the power of
the registry value.

    div = 1 << regvalue

This is true only for the first 5 values out of 8. Next values are 64,
256 and, 1024 - instead of 32, 64, 128.
This affects only the users requesting a period > 0.04369s.

Replace the computation with a look-up table.

Signed-off-by: Gaetan Hug <ghug@induct.be>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-mxs.c