From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:51977 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755393AbcEFRoS (ORCPT ); Fri, 6 May 2016 13:44:18 -0400 Subject: Patch "pwm: omap-dmtimer: Round load and match values rather than truncate" has been added to the 4.5-stable tree To: drivshin@allworx.com, gregkh@linuxfoundation.org, narmstrong@baylibre.com, thierry.reding@gmail.com Cc: , From: Date: Fri, 06 May 2016 12:30:45 -0400 Message-ID: <1462552245164140@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: 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 know about it. >>From 7b0883f33809ff0aeca9848193c31629a752bb77 Mon Sep 17 00:00:00 2001 From: David Rivshin Date: Fri, 29 Jan 2016 23:26:53 -0500 Subject: pwm: omap-dmtimer: Round load and match values rather than truncate From: David Rivshin 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 Acked-by: Neil Armstrong Signed-off-by: Thierry Reding Signed-off-by: Greg Kroah-Hartman --- 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