summaryrefslogtreecommitdiff
path: root/drivers/pwm
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2020-07-10 12:27:58 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-16 08:16:48 +0200
commitd64dc6118a0fa9ecc8947966debda5fd67982091 (patch)
tree0e6661fdb63bdd5c6706d618782f62bd8e11f149 /drivers/pwm
parentd13a78d13d2c97e2ffe733f4558ad66eddbdce86 (diff)
pwm: jz4740: Fix build failure
When commit 9017dc4fbd59 ("pwm: jz4740: Enhance precision in calculation of duty cycle") from v5.8-rc1 was backported to v5.4.x its dependency on commit ce1f9cece057 ("pwm: jz4740: Use clocks from TCU driver") was not noticed which made the pwm-jz4740 driver fail to build. As ce1f9cece057 depends on still more rework, just backport a small part of this commit to make the driver build again. (There is no dependency on the functionality introduced in ce1f9cece057, just the rate variable is needed.) Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reported-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/pwm')
-rw-r--r--drivers/pwm/pwm-jz4740.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index d0f5c69930d0..77c28313e95f 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -92,11 +92,12 @@ static int jz4740_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
{
struct jz4740_pwm_chip *jz4740 = to_jz4740(pwm->chip);
unsigned long long tmp;
- unsigned long period, duty;
+ unsigned long rate, period, duty;
unsigned int prescaler = 0;
uint16_t ctrl;
- tmp = (unsigned long long)clk_get_rate(jz4740->clk) * state->period;
+ rate = clk_get_rate(jz4740->clk);
+ tmp = rate * state->period;
do_div(tmp, 1000000000);
period = tmp;