Skip to content

Commit

Permalink
arch/arm64/src/imx9/imx9_flexio_pwm.c: Fix wrong input scale
Browse files Browse the repository at this point in the history
Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Apr 5, 2024
1 parent 4cebb6a commit 3af0f05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/arm64/src/imx9/imx9_flexio_pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 3af0f05

Please sign in to comment.