All of lore.kernel.org
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: drivshin@allworx.com, gregkh@linuxfoundation.org,
	narmstrong@baylibre.com, thierry.reding@gmail.com
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "pwm: omap-dmtimer: Round load and match values rather than truncate" has been added to the 4.5-stable tree
Date: Fri, 06 May 2016 12:30:45 -0400	[thread overview]
Message-ID: <1462552245164140@kroah.com> (raw)


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

                 reply	other threads:[~2016-05-06 17:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462552245164140@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=drivshin@allworx.com \
    --cc=narmstrong@baylibre.com \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.