From: Ryo Kodama Date: Mon, 9 Nov 2015 00:42:25 +0000 (+0900) Subject: pwm: rcar: Improve accuracy of frequency division setting X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=72c16a9f98afad073b4a9c947c1c89bfb886ffcb;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git pwm: rcar: Improve accuracy of frequency division setting From: Ryo Kodama 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 Signed-off-by: Yoshihiro Shimoda Signed-off-by: Thierry Reding --- 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; }