From: "David Rivshin (Allworx)" <drivshin.allworx@gmail.com>
To: linux-pwm@vger.kernel.org,
Thierry Reding <thierry.reding@gmail.com>,
Neil Armstrong <narmstrong@baylibre.com>
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Tony Lindgren <tony@atomide.com>,
Grant Erickson <marathon96@gmail.com>, NeilBrown <neilb@suse.de>,
Joachim Eastwood <manabian@gmail.com>
Subject: [PATCH 4/4] pwm: omap-dmtimer: add dev_dbg() message for effective period and duty cycle
Date: Fri, 29 Jan 2016 23:26:54 -0500 [thread overview]
Message-ID: <1454128014-22866-5-git-send-email-drivshin.allworx@gmail.com> (raw)
In-Reply-To: <1454128014-22866-1-git-send-email-drivshin.allworx@gmail.com>
From: David Rivshin <drivshin@allworx.com>
After going through the math and constraints checking to compute load and
match values, it is helpful to know what the resultant period and duty
cycle are.
Signed-off-by: David Rivshin <drivshin@allworx.com>
---
I found this helpful while testing the other changes, so I included it in
case it may be of use to someone in the future. I would have no issues with
dropping this if it's not considered worthwhile.
drivers/pwm/pwm-omap-dmtimer.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
index 8c9953c..44e3dca 100644
--- a/drivers/pwm/pwm-omap-dmtimer.c
+++ b/drivers/pwm/pwm-omap-dmtimer.c
@@ -102,7 +102,8 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
unsigned long clk_rate;
bool timer_active;
- dev_dbg(chip->dev, "duty cycle: %d, period %d\n", duty_ns, period_ns);
+ dev_dbg(chip->dev, "requested duty cycle: %dns, period: %dns\n",
+ duty_ns, period_ns);
mutex_lock(&omap->mutex);
if (duty_ns == pwm_get_duty_cycle(pwm) &&
@@ -163,6 +164,12 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip,
duty_cycles = period_cycles - 1;
}
+ dev_dbg(chip->dev, "effective duty cycle: %lldns, period: %lldns\n",
+ DIV_ROUND_CLOSEST_ULL((u64)NSEC_PER_SEC * duty_cycles,
+ clk_rate),
+ DIV_ROUND_CLOSEST_ULL((u64)NSEC_PER_SEC * period_cycles,
+ clk_rate));
+
load_value = (DM_TIMER_MAX - period_cycles) + 1;
match_value = load_value + duty_cycles - 1;
--
2.5.0
next prev parent reply other threads:[~2016-01-30 4:26 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-30 4:26 [PATCH 0/4] pwm: omap-dmtimer: fix period/duty_cycle calculation David Rivshin (Allworx)
2016-01-30 4:26 ` [PATCH 1/4] pwm: omap-dmtimer: fix inaccurate " David Rivshin (Allworx)
2016-02-03 10:23 ` Neil Armstrong
2016-02-15 20:24 ` Adam Ford
2016-03-04 15:17 ` Thierry Reding
2016-01-30 4:26 ` [PATCH 2/4] pwm: omap-dmtimer: add sanity checking for load and match values David Rivshin (Allworx)
2016-02-01 18:35 ` David Rivshin (Allworx)
2016-02-03 10:24 ` Neil Armstrong
2016-01-30 4:26 ` [PATCH 3/4] pwm: omap-dmtimer: round load and match values rather than truncate David Rivshin (Allworx)
2016-02-03 10:24 ` Neil Armstrong
2016-03-04 15:18 ` Thierry Reding
2016-01-30 4:26 ` David Rivshin (Allworx) [this message]
2016-01-30 14:51 ` [PATCH 4/4] pwm: omap-dmtimer: add dev_dbg() message for effective period and duty cycle Neil Armstrong
2016-02-01 18:22 ` David Rivshin (Allworx)
2016-02-01 18:59 ` Tony Lindgren
2016-02-02 16:23 ` Thierry Reding
2016-02-02 23:44 ` David Rivshin (Allworx)
2016-02-03 14:14 ` Thierry Reding
2016-02-05 19:51 ` David Rivshin (Allworx)
2016-02-09 12:49 ` Neil Armstrong
2016-01-30 14:52 ` [PATCH 0/4] pwm: omap-dmtimer: fix period/duty_cycle calculation Neil Armstrong
2016-02-01 20:14 ` David Rivshin (Allworx)
2016-02-27 1:31 ` David Rivshin (Allworx)
2016-03-04 15:19 ` Thierry Reding
2016-03-04 16:27 ` David Rivshin (Allworx)
[not found] ` <CAHCN7xJYi8VCe8ue_QuYmqTEo-8GPSPiwzM2F_631mMUrwajSA@mail.gmail.com>
2016-03-04 20:01 ` David Rivshin (Allworx)
2016-03-04 20:03 ` Adam Ford
2016-03-04 21:18 ` Thierry Reding
2016-03-04 23:20 ` David Rivshin (Allworx)
2016-03-08 23:23 ` Adam Ford
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=1454128014-22866-5-git-send-email-drivshin.allworx@gmail.com \
--to=drivshin.allworx@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=manabian@gmail.com \
--cc=marathon96@gmail.com \
--cc=narmstrong@baylibre.com \
--cc=neilb@suse.de \
--cc=thierry.reding@gmail.com \
--cc=tony@atomide.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 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).