Skip to content

Commit

Permalink
pwm: rcar: Improve accuracy of frequency division setting
Browse files Browse the repository at this point in the history
From: Ryo Kodama <ryo.kodama.vz@renesas.com>

When period_ns is set to the same value of RCAR_PWM_MAX_CYCLE in
rcar_pwm_get_clock_division(), this function should allow such value
for improving accuracy of frequency division setting.

Signed-off-by: Ryo Kodama <ryo.kodama.vz@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
  • Loading branch information
Ryo Kodama authored and Thierry Reding committed Dec 16, 2015
1 parent d6dbdf0 commit 72c16a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pwm/pwm-rcar.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static int rcar_pwm_get_clock_division(struct rcar_pwm_chip *rp, int period_ns)
max = (unsigned long long)NSEC_PER_SEC * RCAR_PWM_MAX_CYCLE *
(1 << div);
do_div(max, clk_rate);
if (period_ns < max)
if (period_ns <= max)
break;
}

Expand Down

0 comments on commit 72c16a9

Please sign in to comment.