arch/arm64/src/imx9/imx9_flexio_pwm.c: Fix wrong input scale and pulse width
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
parent
bbec17daff
commit
5e5640992d
@ -444,8 +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,
|
static int pwm_update_duty(struct imx9_pwmtimer_s *priv, int pwm_ch,
|
||||||
ub16_t duty16)
|
ub16_t duty16)
|
||||||
{
|
{
|
||||||
uint64_t duty = ub16toi(duty16);
|
uint32_t edge = ub16toi(duty16 * priv->period + b16HALF);
|
||||||
uint32_t edge = (duty * priv->period + 0x8000) >> 16;
|
|
||||||
int timer = pwm_ch - 1; /* map pwm ch 1 to timer 0 etc.. */
|
int timer = pwm_ch - 1; /* map pwm ch 1 to timer 0 etc.. */
|
||||||
uint32_t regval;
|
uint32_t regval;
|
||||||
|
|
||||||
@ -477,7 +476,7 @@ static int pwm_update_duty(struct imx9_pwmtimer_s *priv, int pwm_ch,
|
|||||||
* timer fully, otherwise just update the duty cycle
|
* 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)
|
if (priv->frequency == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user