linux-stable/drivers/pwm
Uwe Kleine-König 383729f057 pwm: stm32: Always do lazy disabling
[ Upstream commit 7346e7a058 ]

When the state changes from enabled to disabled, polarity, duty_cycle
and period are not configured in hardware and TIM_CCER_CCxE is just
cleared. However if the state changes from one disabled state to
another, all parameters are written to hardware because the early exit
from stm32_pwm_apply() is only taken if the pwm is currently enabled.

This yields surprises like: Applying

	{ .period = 1, .duty_cycle = 0, .enabled = false }

succeeds if the pwm is initially on, but fails if it's already off
because 1 is a too small period.

Update the check for lazy disable to always exit early if the target
state is disabled, no matter what is currently configured.

Fixes: 7edf736920 ("pwm: Add driver for STM32 plaftorm")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Link: https://lore.kernel.org/r/20240703110010.672654-2-u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-19 05:31:56 +02:00
..
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: brcmstb: Utilize appropriate clock APIs in suspend/resume 2023-11-20 10:29:20 +01:00
pwm-clps711x.c
pwm-crc.c
pwm-cros-ec.c pwm: cros-ec: Explicitly set .polarity in .get_state() 2023-04-20 12:04:38 +02:00
pwm-ep93xx.c
pwm-fsl-ftm.c
pwm-hibvt.c
pwm-img.c pwm: img: Don't modify HW state in .remove() callback 2021-09-26 13:39:49 +02:00
pwm-imx.c
pwm-jz4740.c
pwm-lp3943.c pwm: lp3943: Fix duty calculation in case period was clamped 2022-06-14 16:59:31 +02:00
pwm-lpc18xx-sct.c pwm: lpc18xx-sct: Initialize driver data and hardware before pwmchip_add() 2022-04-15 14:14:51 +02:00
pwm-lpc32xx.c pwm: lpc32xx: Remove handling of PWM channels 2023-09-23 10:48:13 +02:00
pwm-lpss-pci.c
pwm-lpss-platform.c
pwm-lpss.c
pwm-lpss.h
pwm-mediatek.c
pwm-meson.c pwm: meson: Fix axg ao mux parents 2023-05-17 11:13:07 +02:00
pwm-mtk-disp.c pwm: mtk-disp: Disable shadow registers before setting backlight values 2023-05-17 11:13:20 +02:00
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: rockchip: Don't modify HW state in .remove() callback 2021-09-26 13:39:49 +02:00
pwm-samsung.c
pwm-spear.c pwm: spear: Don't modify HW state in .remove callback 2021-07-20 16:16:10 +02:00
pwm-sti.c pwm: sti: Reduce number of allocations and drop usage of chip_data 2023-11-20 10:29:20 +01:00
pwm-stm32-lp.c pwm: stm32-lp: fix the check on arr and cmp registers update 2023-03-11 16:31:56 +01:00
pwm-stm32.c pwm: stm32: Always do lazy disabling 2024-08-19 05:31:56 +02:00
pwm-stmpe.c
pwm-sun4i.c
pwm-tegra.c pwm: tegra: Don't modify HW state in .remove callback 2021-07-20 16:16:12 +02:00
pwm-tiecap.c
pwm-tiehrpwm.c
pwm-tipwmss.c
pwm-twl-led.c
pwm-twl.c
pwm-vt8500.c
pwm-zx.c pwm: zx: Add missing cleanup in error path 2020-12-30 11:26:05 +01:00
sysfs.c