summaryrefslogtreecommitdiffstats
path: root/drivers/pwm/pwm-rcar.c
diff options
context:
space:
mode:
authorRyo Kodama <ryo.kodama.vz@renesas.com>2015-11-09 01:42:25 +0100
committerThierry Reding <thierry.reding@gmail.com>2015-12-16 17:02:14 +0100
commit72c16a9f98afad073b4a9c947c1c89bfb886ffcb (patch)
treec506bf3b4970c77e0b24e3651f25f597254fdd80 /drivers/pwm/pwm-rcar.c
parentpwm: lpc32xx: return ERANGE, if requested period is not supported (diff)
downloadlinux-72c16a9f98afad073b4a9c947c1c89bfb886ffcb.tar.xz
linux-72c16a9f98afad073b4a9c947c1c89bfb886ffcb.zip
pwm: rcar: Improve accuracy of frequency division setting
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>
Diffstat (limited to 'drivers/pwm/pwm-rcar.c')
-rw-r--r--drivers/pwm/pwm-rcar.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
index 6e99a63ffa29..7b8ac0678137 100644
--- a/drivers/pwm/pwm-rcar.c
+++ b/drivers/pwm/pwm-rcar.c
@@ -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;
}