[PATCH] pwm: stm32: Always do lazy disabling

Uwe Kleine-König u.kleine-koenig at baylibre.com
Fri Jul 5 15:42:02 PDT 2024


Hello,

[Updated Benjamin's email address]

On Wed, Jul 03, 2024 at 01:00:06PM +0200, Uwe Kleine-König wrote:
> 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 at baylibre.com>

I applied this to my pwm/for-next branch. I applied it directly on top
of my last PR to Linus and rebased pwm/for-next on top of it, as it's a
fix that should come early. I won't send it for inclusion before 6.10,
but if another PR will become necessary before 6.10, I'll include this
patch.

Best regards
Uwe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20240706/fc675e9b/attachment.sig>


More information about the linux-arm-kernel mailing list