From 3af0f05eb1bb2e02fa67bb195d64ddf2276e61cb Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Fri, 5 Apr 2024 13:20:20 +0300 Subject: [PATCH] arch/arm64/src/imx9/imx9_flexio_pwm.c: Fix wrong input scale Signed-off-by: Jukka Laitinen --- arch/arm64/src/imx9/imx9_flexio_pwm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/src/imx9/imx9_flexio_pwm.c b/arch/arm64/src/imx9/imx9_flexio_pwm.c index f213c1e5acab8..36cfb80d2b26c 100644 --- a/arch/arm64/src/imx9/imx9_flexio_pwm.c +++ b/arch/arm64/src/imx9/imx9_flexio_pwm.c @@ -444,7 +444,7 @@ static int pwm_update_frequency(struct imx9_pwmtimer_s *priv, int freq) static int pwm_update_duty(struct imx9_pwmtimer_s *priv, int pwm_ch, ub16_t duty16) { - uint64_t duty = ub16toi(duty16); + uint32_t duty = duty16 & 0xffffffff; uint32_t edge = (duty * priv->period + 0x8000) >> 16; int timer = pwm_ch - 1; /* map pwm ch 1 to timer 0 etc.. */ uint32_t regval; @@ -477,7 +477,7 @@ static int pwm_update_duty(struct imx9_pwmtimer_s *priv, int pwm_ch, * timer fully, otherwise just update the duty cycle */ - flexio_putreg(priv, IMX9_FLEXIO_TIMCMP_OFFSET(timer), duty); + flexio_putreg(priv, IMX9_FLEXIO_TIMCMP_OFFSET(timer), edge); if (priv->frequency == 0) {