linux/drivers/pwm
Martin Blumenstingl f173747fff pwm: meson: Use the spin-lock only to protect register modifications
Holding the spin-lock for all of the code in meson_pwm_apply() can
result in a "BUG: scheduling while atomic". This can happen because
clk_get_rate() (which is called from meson_pwm_calc()) may sleep.
Only hold the spin-lock when modifying registers to solve this.

The reason why we need a spin-lock in the driver is because the
REG_MISC_AB register is shared between the two channels provided by one
PWM controller. The only functions where REG_MISC_AB is modified are
meson_pwm_enable() and meson_pwm_disable() so the register reads/writes
in there need to be protected by the spin-lock.

The original code also used the spin-lock to protect the values in
struct meson_pwm_channel. This could be necessary if two consumers can
use the same PWM channel. However, PWM core doesn't allow this so we
don't need to protect the values in struct meson_pwm_channel with a
lock.

Fixes: 211ed63075 ("pwm: Add support for Meson PWM Controller")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2019-05-09 16:51:13 +02:00
..
core.c pwm: Fix deadlock warning when removing PWM device 2019-03-20 12:21:31 +01:00
Kconfig pwm: tiehrpwm: Enable compilation for ARCH_K3 2019-03-20 12:33:51 +01:00
Makefile pwm: imx: Split into two drivers 2019-01-16 08:45:33 +01:00
pwm-ab8500.c
pwm-atmel-hlcdc.c
pwm-atmel-tcb.c
pwm-atmel.c pwm: atmel: Remove useless symbolic definitions 2019-03-04 12:52:49 +01:00
pwm-bcm-iproc.c
pwm-bcm-kona.c pwm: bcm-kona: Update macros to remove braces around numbers 2019-03-04 12:52:49 +01:00
pwm-bcm2835.c
pwm-berlin.c
pwm-brcmstb.c
pwm-clps711x.c pwm: clps711x: Switch to SPDX identifier 2018-12-24 12:06:56 +01:00
pwm-crc.c
pwm-cros-ec.c
pwm-ep93xx.c
pwm-fsl-ftm.c
pwm-hibvt.c pwm: hibvt: Add hi3559v100 support 2019-03-04 11:38:52 +01:00
pwm-img.c pwm: img: Turn final 'else if' into 'else' in img_pwm_config 2019-03-20 12:29:22 +01:00
pwm-imx1.c pwm: imx: Split into two drivers 2019-01-16 08:45:33 +01:00
pwm-imx27.c pwm: imx27: Only enable the clocks once in .get_state() 2019-03-04 12:52:48 +01:00
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: meson: Use the spin-lock only to protect register modifications 2019-05-09 16:51:13 +02:00
pwm-mtk-disp.c pwm: Add MediaTek MT8183 display PWM driver support 2019-03-04 11:45:08 +01:00
pwm-mxs.c
pwm-omap-dmtimer.c
pwm-pca9685.c
pwm-puv3.c
pwm-pxa.c
pwm-rcar.c pwm: rcar: Improve calculation of divider 2019-03-04 12:14:21 +01:00
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: tiehrpwm: Update shadow register for disabling PWMs 2019-03-20 12:31:07 +01:00
pwm-tipwmss.c
pwm-twl-led.c
pwm-twl.c
pwm-vt8500.c
pwm-zx.c
sysfs.c pwm: sysfs: fix typo "its" -> "it's" 2019-03-20 12:34:14 +01:00