pwm: jz4740: Enhance precision in calculation of duty cycle
authorPaul Cercueil <paul@crapouillou.net>
Wed, 27 May 2020 11:52:23 +0000 (13:52 +0200)
committerThierry Reding <thierry.reding@gmail.com>
Tue, 2 Jun 2020 12:24:00 +0000 (14:24 +0200)
commit9017dc4fbd59c09463019ce494cfe36d654495a8
tree284a1b3f595e017977c4c0e9fd3836947e42b521
parentb48d49e0d53a15a82545ae68db54e8abe99a840a
pwm: jz4740: Enhance precision in calculation of duty cycle

Calculating the hardware value for the duty from the hardware value of
the period resulted in a precision loss versus calculating it from the
clock rate directly.

(Also remove a cast that doesn't really need to be here)

Fixes: f6b8a5700057 ("pwm: Add Ingenic JZ4740 support")
Cc: <stable@vger.kernel.org>
Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-jz4740.c