linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "pwm: jz4740: Enhance precision in calculation of duty cycle"
@ 2020-07-10  7:24 H. Nikolaus Schaller
  2020-07-10 10:18 ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: H. Nikolaus Schaller @ 2020-07-10  7:24 UTC (permalink / raw)
  To: Paul Cercueil, Thierry Reding
  Cc: Uwe Kleine-König, linux-pwm, linux-kernel, letux-kernel,
	linux-mips, tsbogend, H. Nikolaus Schaller, stable

This reverts commit a6030d71e62d3e0e270bf3b7fb48d32a636732db.

which was applied to v5.4.49. This ends in a compile issue:

  CC      drivers/pwm/pwm-jz4740.o - due to target missing
drivers/pwm/pwm-jz4740.c: In function 'jz4740_pwm_apply':
drivers/pwm/pwm-jz4740.c:111:28: error: 'rate' undeclared (first use in this function)
  tmp = (unsigned long long)rate * state->duty_cycle;
                            ^
drivers/pwm/pwm-jz4740.c:111:28: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [drivers/pwm/pwm-jz4740.o] Error 1

v5.5 and later include the required additional patches to define
the rate variable.

Fixes: a6030d71e62d ("pwm: jz4740: Enhance precision in calculation of duty cycle")
Cc: stable@vger.kernel.org # v5.4.49
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/pwm/pwm-jz4740.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index d0f5c69930d0d9..9d78cc21cb1279 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -108,8 +108,8 @@ static int jz4740_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 	if (prescaler == 6)
 		return -EINVAL;
 
-	tmp = (unsigned long long)rate * state->duty_cycle;
-	do_div(tmp, NSEC_PER_SEC);
+	tmp = (unsigned long long)period * state->duty_cycle;
+	do_div(tmp, state->period);
 	duty = period - tmp;
 
 	if (duty >= period)
-- 
2.26.2


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

* Re: [PATCH] Revert "pwm: jz4740: Enhance precision in calculation of duty cycle"
  2020-07-10  7:24 [PATCH] Revert "pwm: jz4740: Enhance precision in calculation of duty cycle" H. Nikolaus Schaller
@ 2020-07-10 10:18 ` Uwe Kleine-König
  2020-07-10 10:46   ` H. Nikolaus Schaller
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2020-07-10 10:18 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Paul Cercueil, Thierry Reding, linux-pwm, linux-kernel,
	letux-kernel, linux-mips, tsbogend, stable

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

On Fri, Jul 10, 2020 at 09:24:45AM +0200, H. Nikolaus Schaller wrote:
> This reverts commit a6030d71e62d3e0e270bf3b7fb48d32a636732db.
> 
> which was applied to v5.4.49. This ends in a compile issue:
> 
>   CC      drivers/pwm/pwm-jz4740.o - due to target missing
> drivers/pwm/pwm-jz4740.c: In function 'jz4740_pwm_apply':
> drivers/pwm/pwm-jz4740.c:111:28: error: 'rate' undeclared (first use in this function)
>   tmp = (unsigned long long)rate * state->duty_cycle;
>                             ^
> drivers/pwm/pwm-jz4740.c:111:28: note: each undeclared identifier is reported only once for each function it appears in
> make[4]: *** [drivers/pwm/pwm-jz4740.o] Error 1
> 
> v5.5 and later include the required additional patches to define
> the rate variable.

So 9017dc4fbd59 ("pwm: jz4740: Enhance precision in calculation of duty
cycle") which is in v5.8-rc1 was backported to stable:

	v5.4.49 (as commit a6030d71e62d3e0e270bf3b7fb48d32a636732db)
	v5.7.5 (as commit e0e71bb7852142a18fb829da419013bb6da9ed3f)

However 9017dc4fbd59 depends on

	ce1f9cece057 ("pwm: jz4740: Use clocks from TCU driver")

(which in mainline comes before 9017dc4fbd59 as it's included in
v5.7-rc1).

As ce1f9cece057 was not backported to v5.4.x, this must either be done, or
we need to patch that. Will reply with a suggested change.

In v5.7.x there is no problem.

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] 3+ messages in thread

* Re: [PATCH] Revert "pwm: jz4740: Enhance precision in calculation of duty cycle"
  2020-07-10 10:18 ` Uwe Kleine-König
@ 2020-07-10 10:46   ` H. Nikolaus Schaller
  0 siblings, 0 replies; 3+ messages in thread
From: H. Nikolaus Schaller @ 2020-07-10 10:46 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Paul Cercueil, Thierry Reding, linux-pwm, linux-kernel,
	letux-kernel, linux-mips, tsbogend, stable


> Am 10.07.2020 um 12:18 schrieb Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> 
> On Fri, Jul 10, 2020 at 09:24:45AM +0200, H. Nikolaus Schaller wrote:
>> This reverts commit a6030d71e62d3e0e270bf3b7fb48d32a636732db.
>> 
>> which was applied to v5.4.49. This ends in a compile issue:
>> 
>>  CC      drivers/pwm/pwm-jz4740.o - due to target missing
>> drivers/pwm/pwm-jz4740.c: In function 'jz4740_pwm_apply':
>> drivers/pwm/pwm-jz4740.c:111:28: error: 'rate' undeclared (first use in this function)
>>  tmp = (unsigned long long)rate * state->duty_cycle;
>>                            ^
>> drivers/pwm/pwm-jz4740.c:111:28: note: each undeclared identifier is reported only once for each function it appears in
>> make[4]: *** [drivers/pwm/pwm-jz4740.o] Error 1
>> 
>> v5.5 and later include the required additional patches to define
>> the rate variable.
> 
> So 9017dc4fbd59 ("pwm: jz4740: Enhance precision in calculation of duty
> cycle") which is in v5.8-rc1 was backported to stable:
> 
> 	v5.4.49 (as commit a6030d71e62d3e0e270bf3b7fb48d32a636732db)
> 	v5.7.5 (as commit e0e71bb7852142a18fb829da419013bb6da9ed3f)
> 
> However 9017dc4fbd59 depends on
> 
> 	ce1f9cece057 ("pwm: jz4740: Use clocks from TCU driver")
> 
> (which in mainline comes before 9017dc4fbd59 as it's included in
> v5.7-rc1).
> 
> As ce1f9cece057 was not backported to v5.4.x, this must either be done, or
> we need to patch that. Will reply with a suggested change.

That is what I did suspect that some other patch this one depends on
was not backported.

What the better strategy (backport missing parts or revert) depends
on how easy it is to backport to v5.4.y.

I am happy with either solution. It is just simpler for me to post
my workaround for the compile issue.

> 
> In v5.7.x there is no problem.

In v5.5 and v5.6 there is also no problem. Just v5.4 starting with v5.4.49.

BR and thanks,
Nikolaus


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

end of thread, other threads:[~2020-07-10 10:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10  7:24 [PATCH] Revert "pwm: jz4740: Enhance precision in calculation of duty cycle" H. Nikolaus Schaller
2020-07-10 10:18 ` Uwe Kleine-König
2020-07-10 10:46   ` H. Nikolaus Schaller

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