Hello, while looking at the driver I noticed another patch opportunity: In rcar_pwm_get_clock_division() there is a loop: for (div = 0; div <= RCAR_PWM_MAX_DIVISION; div++) { max = (unsigned long long)NSEC_PER_SEC * RCAR_PWM_MAX_CYCLE * (1 << div); do_div(max, clk_rate); if (period_ns <= max) break; } The value of div should be calculatable without a loop. Something like: divider = NSEC_PER_SEC * RCAR_PWM_MAX_CYCLE; tmp = (unsigned long long)period_ns * clk_rate + (divider - 1); do_div(tmp, divider); div = ilog2(tmp - 1) + 1; You might want to check if my maths are right, I didn't test. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |