* Patch "pwm: omap-dmtimer: Round load and match values rather than truncate" has been added to the 4.5-stable tree
@ 2016-05-06 16:30 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-05-06 16:30 UTC (permalink / raw)
To: drivshin, gregkh, narmstrong, thierry.reding; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
pwm: omap-dmtimer: Round load and match values rather than truncate
to the 4.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
pwm-omap-dmtimer-round-load-and-match-values-rather-than-truncate.patch
and it can be found in the queue-4.5 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From 7b0883f33809ff0aeca9848193c31629a752bb77 Mon Sep 17 00:00:00 2001
From: David Rivshin <drivshin@allworx.com>
Date: Fri, 29 Jan 2016 23:26:53 -0500
Subject: pwm: omap-dmtimer: Round load and match values rather than truncate
From: David Rivshin <drivshin@allworx.com>
commit 7b0883f33809ff0aeca9848193c31629a752bb77 upstream.
When converting period and duty_cycle from nanoseconds to fclk cycles,
the error introduced by the integer division can be appreciable, especially
in the case of slow fclk or short period. Use DIV_ROUND_CLOSEST_ULL() so
that the error is kept to +/- 0.5 clock cycles.
Fixes: 6604c6556db9 ("pwm: Add PWM driver for OMAP using dual-mode timers")
Signed-off-by: David Rivshin <drivshin@allworx.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/pwm/pwm-omap-dmtimer.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
--- a/drivers/pwm/pwm-omap-dmtimer.c
+++ b/drivers/pwm/pwm-omap-dmtimer.c
@@ -49,11 +49,7 @@ to_pwm_omap_dmtimer_chip(struct pwm_chip
static u32 pwm_omap_dmtimer_get_clock_cycles(unsigned long clk_rate, int ns)
{
- u64 c = (u64)clk_rate * ns;
-
- do_div(c, NSEC_PER_SEC);
-
- return c;
+ return DIV_ROUND_CLOSEST_ULL((u64)clk_rate * ns, NSEC_PER_SEC);
}
static void pwm_omap_dmtimer_start(struct pwm_omap_dmtimer_chip *omap)
Patches currently in stable-queue which might be from drivshin@allworx.com are
queue-4.5/pwm-omap-dmtimer-fix-inaccurate-period-and-duty-cycle-calculations.patch
queue-4.5/pwm-omap-dmtimer-add-sanity-checking-for-load-and-match-values.patch
queue-4.5/pwm-omap-dmtimer-round-load-and-match-values-rather-than-truncate.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-05-06 17:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-06 16:30 Patch "pwm: omap-dmtimer: Round load and match values rather than truncate" has been added to the 4.5-stable tree gregkh
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).