arch/stm32: Clear all PWM channel when during STOP

I noticed when executing pwm STOP command in
multichannel mode, the channel still outputting.

This commit fixes this issue.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
This commit is contained in:
Alan Carvalho de Assis 2024-02-15 12:44:11 -03:00 committed by Xiang Xiao
parent 9620d7a12d
commit 6d346793ee
1 changed files with 7 additions and 0 deletions

View File

@ -4463,6 +4463,13 @@ static int pwm_stop(struct pwm_lowerhalf_s *dev)
outputs = pwm_outputs_from_channels(priv);
ret = pwm_outputs_enable(dev, outputs, false);
/* Clear all channels */
pwm_putreg(priv, STM32_GTIM_CCR1_OFFSET, 0);
pwm_putreg(priv, STM32_GTIM_CCR2_OFFSET, 0);
pwm_putreg(priv, STM32_GTIM_CCR3_OFFSET, 0);
pwm_putreg(priv, STM32_GTIM_CCR4_OFFSET, 0);
leave_critical_section(flags);
pwm_dumpregs(dev, "After stop");