linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [stable v5.4.x] pwm: jz4740: Fix build failure
@ 2020-07-10 10:27 Uwe Kleine-König
  2020-07-10 10:48 ` H. Nikolaus Schaller
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2020-07-10 10:27 UTC (permalink / raw)
  To: stable
  Cc: H. Nikolaus Schaller, Paul Cercueil, Thierry Reding, linux-pwm,
	linux-kernel, letux-kernel, linux-mips, tsbogend

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>
---
Hello,

@Paul: Can you please check this is correct? I only build-tested this
change.

Best regards
Uwe

 drivers/pwm/pwm-jz4740.c | 5 +++--
 1 file 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;
 
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] [stable v5.4.x] pwm: jz4740: Fix build failure
  2020-07-10 10:27 [PATCH] [stable v5.4.x] pwm: jz4740: Fix build failure Uwe Kleine-König
@ 2020-07-10 10:48 ` H. Nikolaus Schaller
  2020-07-10 19:47   ` Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: H. Nikolaus Schaller @ 2020-07-10 10:48 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: stable, Paul Cercueil, Thierry Reding, linux-pwm, linux-kernel,
	letux-kernel, linux-mips, tsbogend


> Am 10.07.2020 um 12:27 schrieb Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> 
> 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.

Please can you add my "reported by?"

> 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.)

BR and thanks,
Nikolaus

> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
> 
> @Paul: Can you please check this is correct? I only build-tested this
> change.
> 
> Best regards
> Uwe
> 
> drivers/pwm/pwm-jz4740.c | 5 +++--
> 1 file 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;
> 
> -- 
> 2.27.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [stable v5.4.x] pwm: jz4740: Fix build failure
  2020-07-10 10:48 ` H. Nikolaus Schaller
@ 2020-07-10 19:47   ` Uwe Kleine-König
  2020-07-14 16:58     ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2020-07-10 19:47 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: stable, Paul Cercueil, Thierry Reding, linux-pwm, linux-kernel,
	letux-kernel, linux-mips, tsbogend

[-- Attachment #1: Type: text/plain, Size: 880 bytes --]

On Fri, Jul 10, 2020 at 12:48:36PM +0200, H. Nikolaus Schaller wrote:
> 
> > Am 10.07.2020 um 12:27 schrieb Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> > 
> > 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.
> 
> Please can you add my "reported by?"

Greg, can you please add this while applying? (Assuming you're ok with
this change and ideally Paul can confirm the change is fine.)

Reported-by: H. Nikolaus Schaller <hns@goldelico.com>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [stable v5.4.x] pwm: jz4740: Fix build failure
  2020-07-10 19:47   ` Uwe Kleine-König
@ 2020-07-14 16:58     ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2020-07-14 16:58 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: H. Nikolaus Schaller, stable, Paul Cercueil, Thierry Reding,
	linux-pwm, linux-kernel, letux-kernel, linux-mips, tsbogend

On Fri, Jul 10, 2020 at 09:47:02PM +0200, Uwe Kleine-König wrote:
> On Fri, Jul 10, 2020 at 12:48:36PM +0200, H. Nikolaus Schaller wrote:
> > 
> > > Am 10.07.2020 um 12:27 schrieb Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> > > 
> > > 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.
> > 
> > Please can you add my "reported by?"
> 
> Greg, can you please add this while applying? (Assuming you're ok with
> this change and ideally Paul can confirm the change is fine.)
> 
> Reported-by: H. Nikolaus Schaller <hns@goldelico.com>

Now added, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-14 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10 10:27 [PATCH] [stable v5.4.x] pwm: jz4740: Fix build failure Uwe Kleine-König
2020-07-10 10:48 ` H. Nikolaus Schaller
2020-07-10 19:47   ` Uwe Kleine-König
2020-07-14 16:58     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).