Patch "pwm: omap-dmtimer: Round load and match values rather than truncate" has been added to the 4.5-stable tree
Subsystems (2)
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 <[email protected]> know about it.
Quoted 1 line
From
7b0883f33809ff0aeca9848193c31629a752bb77Mon Sep 17 00:00:00 2001
From: David Rivshin <[email protected]>
Date: Fri, 29 Jan 2016 23:26:53 -0500
Subject: pwm: omap-dmtimer: Round load and match values rather than truncate
From: David Rivshin <[email protected]>
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.
--- drivers/pwm/pwm-omap-dmtimer.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/pwm/pwm-omap-dmtimer.c +1 -5
@@ -49,11 +49,7 @@ to_pwm_omap_dmtimer_chip(struct pwm_chipstatic 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 [email protected] 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