Uwe Kleine-König b1c83176c1 pwm: stm32: Always do lazy disabling
[ Upstream commit 7346e7a058a2c9aa9ff1cc699c7bf18a402d9f84 ]

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: 7edf7369205b ("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-03 08:59:14 +02:00
..
2024-05-22 10:45:12 -07:00
2024-04-23 13:16:03 +02:00
2024-05-16 08:50:32 -07:00
2024-07-12 08:32:40 -07:00
2024-06-08 10:48:11 -07:00
2024-05-23 00:29:19 +02:00
2024-06-24 14:36:11 -04:00
2024-05-17 09:05:46 -07:00
2024-07-03 10:10:45 -07:00
2024-05-14 18:25:53 -07:00
2024-07-04 12:21:39 +02:00
2024-05-23 12:04:36 -07:00
2024-05-17 13:01:24 +02:00
2024-08-03 08:59:14 +02:00
2024-05-23 12:04:36 -07:00
2024-05-07 23:40:46 +02:00
2024-07-10 14:47:35 -07:00
2024-05-08 19:21:51 +01:00
2024-07-08 16:17:09 +02:00
2024-04-23 13:16:03 +02:00
2024-05-23 12:04:36 -07:00
2024-05-22 10:45:12 -07:00
2024-05-23 12:04:36 -07:00
2024-05-24 10:24:49 -07:00
2024-04-29 16:45:53 +02:00