]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
pwm: stm32: Fix complementary output in round_waveform_tohw()
authorFabrice Gasnier <fabrice.gasnier@foss.st.com>
Tue, 17 Dec 2024 15:00:21 +0000 (16:00 +0100)
committerUwe Kleine-König <ukleinek@kernel.org>
Wed, 18 Dec 2024 10:08:36 +0000 (11:08 +0100)
When the timer supports complementary output, the CCxNE bit must be set
additionally to the CCxE bit. So to not overwrite the latter use |=
instead of = to set the former.

Fixes: deaba9cff809 ("pwm: stm32: Implementation of the waveform callbacks")
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20241217150021.2030213-1-fabrice.gasnier@foss.st.com
[ukleinek: Slightly improve commit log]
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
drivers/pwm/pwm-stm32.c

index b889e64522c3d7b6a6ea5649f2b3ed18faf84500..17e591f61efb6031b6c47e25c88d252377d0094a 100644 (file)
@@ -84,7 +84,7 @@ static int stm32_pwm_round_waveform_tohw(struct pwm_chip *chip,
 
        wfhw->ccer = TIM_CCER_CCxE(ch + 1);
        if (priv->have_complementary_output)
-               wfhw->ccer = TIM_CCER_CCxNE(ch + 1);
+               wfhw->ccer |= TIM_CCER_CCxNE(ch + 1);
 
        rate = clk_get_rate(priv->clk);