pwm: renesas-tpu: Improve maths to compute register settings
The newly computed register values are intended to exactly match the previously computed values. The main improvement is that the prescaler is computed without a loop that involves two divisions in each step. This uses the fact, that prescalers[i] = 1 << (2 * i). Assuming a moderately smart compiler, the needed number of divisions for the case where the requested period is too big, is reduced from 5 to 2. Signed-off-by:Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by:
Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by:
Thierry Reding <thierry.reding@gmail.com>
Showing
Please register or sign in to comment