Patch "pwm: stm32: Always do lazy disabling" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    pwm: stm32: Always do lazy disabling

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pwm-stm32-always-do-lazy-disabling.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit abb76eab69d7a6f510e2a950bb19e5150e0c8dec
Author: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx>
Date:   Wed Jul 3 13:00:06 2024 +0200

    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@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240703110010.672654-2-u.kleine-koenig@xxxxxxxxxxxx
    Signed-off-by: Uwe Kleine-König <ukleinek@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index ee7197b8e4ef7..5325e804ca24f 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -451,8 +451,9 @@ static int stm32_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 
 	enabled = pwm->state.enabled;
 
-	if (enabled && !state->enabled) {
-		stm32_pwm_disable(priv, pwm->hwpwm);
+	if (!state->enabled) {
+		if (enabled)
+			stm32_pwm_disable(priv, pwm->hwpwm);
 		return 0;
 	}
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux