mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 08:31:55 +00:00
4de445cb43
The Berlin PWM driver is currently broken on at least BG2CD. The symptoms manifest as a very non-linear and erratic mapping from the duty cycle configured in software to the duty cycle produced by hardware. The cause of the bug is software's configuration of the prescaler, and in particular its usage of the six prescaler values between the minimum value of 1 and the maximum value of 4096. As it turns out, these six values do not actually slow down the PWM clock; rather, they emulate slowing down the clock by internally multiplying the value of TCNT. This would be a fine trick, if not for the fact that the internal, scaled TCNT value has no extra bits beyond the 16 already exposed to software in the register. What this means is that, for a prescaler of 4, the software must ensure that the top two bits of TCNT are not set, because hardware will chop them off; for a prescaler of 8, the top three bits must not be set, and so forth. Software does not currently ensure this, resulting in a TCNT several orders of magnitude lower than intended any time one of those six prescalers are selected. Because hardware chops off the high bits in its internal shift, the middle six prescalers don't actually allow *anything* that the first doesn't. In fact, they are strictly worse than the first, since the internal shift of TCNT prevents software from setting the low bits, decreasing the resolution, without providing any extra high bits. By skipping the useless prescalers entirely, this patch both fixes the driver's behavior and increases its performance (since, when the 4096 prescaler is selected, it now does only a single shift rather than the seven successive divisions it did before). Tested on BG2CD. Signed-off-by: Thomas Hebb <tommyhebb@gmail.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com> |
||
---|---|---|
.. | ||
core.c | ||
Kconfig | ||
Makefile | ||
pwm-ab8500.c | ||
pwm-atmel-hlcdc.c | ||
pwm-atmel-tcb.c | ||
pwm-atmel.c | ||
pwm-bcm2835.c | ||
pwm-bcm-iproc.c | ||
pwm-bcm-kona.c | ||
pwm-berlin.c | ||
pwm-brcmstb.c | ||
pwm-clps711x.c | ||
pwm-crc.c | ||
pwm-cros-ec.c | ||
pwm-ep93xx.c | ||
pwm-fsl-ftm.c | ||
pwm-hibvt.c | ||
pwm-img.c | ||
pwm-imx.c | ||
pwm-jz4740.c | ||
pwm-lp3943.c | ||
pwm-lpc18xx-sct.c | ||
pwm-lpc32xx.c | ||
pwm-lpss-pci.c | ||
pwm-lpss-platform.c | ||
pwm-lpss.c | ||
pwm-lpss.h | ||
pwm-mediatek.c | ||
pwm-meson.c | ||
pwm-mtk-disp.c | ||
pwm-mxs.c | ||
pwm-omap-dmtimer.c | ||
pwm-pca9685.c | ||
pwm-puv3.c | ||
pwm-pxa.c | ||
pwm-rcar.c | ||
pwm-renesas-tpu.c | ||
pwm-rockchip.c | ||
pwm-samsung.c | ||
pwm-spear.c | ||
pwm-sti.c | ||
pwm-stm32-lp.c | ||
pwm-stm32.c | ||
pwm-stmpe.c | ||
pwm-sun4i.c | ||
pwm-tegra.c | ||
pwm-tiecap.c | ||
pwm-tiehrpwm.c | ||
pwm-tipwmss.c | ||
pwm-twl-led.c | ||
pwm-twl.c | ||
pwm-vt8500.c | ||
pwm-zx.c | ||
sysfs.c |