From: NeilBrown <neilb@suse.de>
To: Jon Hunter <jon-hunter@ti.com>
Cc: Thierry Reding <thierry.reding@avionic-design.de>,
Grant Erickson <marathon96@gmail.com>,
<linux-omap@vger.kernel.org>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] OMAP: add pwm driver using dmtimers.
Date: Thu, 13 Dec 2012 13:45:34 +1100 [thread overview]
Message-ID: <20121213134534.0cd32544@notabene.brown> (raw)
In-Reply-To: <50C8AED2.4040204@ti.com>
[-- Attachment #1: Type: text/plain, Size: 2251 bytes --]
On Wed, 12 Dec 2012 10:20:34 -0600 Jon Hunter <jon-hunter@ti.com> wrote:
>
> On 12/12/2012 05:31 AM, Thierry Reding wrote:
> > On Wed, Dec 12, 2012 at 07:24:30PM +1100, NeilBrown wrote:
>
> [snip]
>
> >> +static int omap_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
> >> +{
> >> + struct omap_chip *omap = to_omap_chip(chip);
> >> + int status = 0;
> >> +
> >> + /* Enable the counter--always--before attempting to write its
> >> + * registers and then set the timer to its minimum load value to
> >> + * ensure we get an overflow event right away once we start it.
> >> + */
> >
> > Block comments should be in the following format:
> >
> > /*
> > * foo...
> > * bar...
> > */
> >
> >> +
> >> + omap_dm_timer_enable(omap->dm_timer);
> >> + omap_dm_timer_write_counter(omap->dm_timer, DM_TIMER_LOAD_MIN);
> >> + omap_dm_timer_start(omap->dm_timer);
> >> + omap_dm_timer_disable(omap->dm_timer);
> >
> > So omap_dm_timer_disable() doesn't actually stop the timer? It just
> > disables the access to the registers?
>
> I thought this looked odd too ;-)
>
> So what is going on here is that omap_dm_timer_start() calls
> omap_dm_timer_enable() but does not call omap_dm_timer_disable(). So the
> last disable really just complements the first enable (ie. decrements
> the use count), but the timer will not actually be disabled, because the
> start has called an extra enable.
>
> These four function calls can be replaced by one call to
> omap_dm_timer_set_load_start() and I think that will be much clearer and
> concise.
So it now reads:
/*
* Set the timer to its minimum load value to ensure we get an
* overflow event right away once we start it.
*/
omap_dm_timer_set_load_start(omap->dm_timer, true, DM_TIMER_LOAD_MIN);
Certainly more concise - thanks.
>
> In general, it should not be necessary to call these
> omap_dm_timer_enable/disable APIs directly. I am not sure what the
> history is or if there is a use-case that really requires this. So in
> the future may be I should make them static so they cannot be used
> directly :-)
I've removed the other instance of these calls - in omap_pwm_config.
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2012-12-13 2:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-12 8:24 [PATCH] OMAP: add pwm driver using dmtimers NeilBrown
2012-12-12 11:31 ` Thierry Reding
2012-12-12 16:20 ` Jon Hunter
2012-12-13 2:45 ` NeilBrown [this message]
2012-12-13 2:38 ` NeilBrown
2012-12-13 7:34 ` Thierry Reding
2012-12-12 16:08 ` Jon Hunter
2012-12-13 3:06 ` NeilBrown
2012-12-13 4:33 ` NeilBrown
2012-12-13 17:42 ` Jon Hunter
2012-12-15 0:16 ` NeilBrown
2012-12-13 7:11 ` Thierry Reding
2012-12-13 17:07 ` Jon Hunter
2012-12-13 17:34 ` Tony Lindgren
2013-01-06 21:12 ` NeilBrown
2013-01-07 22:24 ` Jon Hunter
2012-12-13 17:41 ` Tony Lindgren
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=20121213134534.0cd32544@notabene.brown \
--to=neilb@suse.de \
--cc=jon-hunter@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=marathon96@gmail.com \
--cc=thierry.reding@avionic-design.de \
/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).