From: Guenter Roeck <linux@roeck-us.net>
To: "Sören Brinkmann" <soren.brinkmann@xilinx.com>
Cc: Joe Perches <joe@perches.com>,
Rob Herring <rob.herring@calxeda.com>,
Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Stephen Warren <swarren@wwwdotorg.org>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Rob Landley <rob@landley.net>,
Mike Turquette <mturquette@linaro.org>,
Grant Likely <grant.likely@linaro.org>,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Hyun Kwon <hyunk@xilinx.com>
Subject: Re: [PATCH v2] clk: si570: Add a driver for SI570 oscillators
Date: Wed, 18 Sep 2013 17:23:08 -0700 [thread overview]
Message-ID: <20130919002308.GA11266@roeck-us.net> (raw)
In-Reply-To: <1119f60e-99dd-45f8-8d91-2b0fa8b7f03b@DB8EHSMHS027.ehs.local>
On Wed, Sep 18, 2013 at 04:32:59PM -0700, Sören Brinkmann wrote:
> On Wed, Sep 18, 2013 at 04:18:56PM -0700, Joe Perches wrote:
> > On Wed, 2013-09-18 at 16:09 -0700, Sören Brinkmann wrote:
> > > On Wed, Sep 18, 2013 at 04:02:41PM -0700, Joe Perches wrote:
> > > > On Wed, 2013-09-18 at 15:43 -0700, Soren Brinkmann wrote:
> > > > > Add a driver for SILabs 570, 571, 598, 599 programmable oscillators.
> > > > > The devices generate low-jitter clock signals and are reprogrammable via
> > > > > an I2C interface.
> > > > []
> > > > > v2:
> > > > []
> > > > > - use 10000 as MIN and MAX value in usleep_range
> > > > []
> > > > > diff --git a/drivers/clk/clk-si570.c b/drivers/clk/clk-si570.c
> > > > []
> > > > > +static int si570_set_frequency(struct clk_si570 *data, unsigned long frequency)
> > > > > +{
> > > > []
> > > > > + /* Applying a new frequency can take up to 10ms */
> > > > > + usleep_range(10000, 10000);
> > > >
> > > > Generally it's nicer to have an actual range for usleep_range.
> > > Well, as I said in the discussion with Guenther. I'm flexible and nobody
> > > objected when I said to make both equal. A real range doesn't make sense
> > > here though, but I don't know what's common practice for cases like
> > > this.
> >
> > udelay is normal, but I guess you don't need atomic context.
> After checkpatch correcting me a few times I went with what
> Documentation/timers/timers-howto.txt suggests. But yes, then we have
> this situation, that I want to sleep 10ms, but not longer using a
> *_range function. I guess it is very application specific whether a
> longer delay here is acceptable or not.
>
You really want to sleep and not call udelay for 10ms. The idea behind usleep_range
is that you give the kernel some slack. In this case, you could for example make it
10-12 ms. That doesn't make much difference for the driver, but it might save a
timer interrupt in the kernel because it might be able to coalesce more than one
event. After all, it doesn't have to be _exactly_ 10 ms, which is what you are
claiming with the fixed number. Prior to usleep_range, you would have happily
called msleep(10) without realizing that it might sleep up to 20 ms on you.
Keep that in mind ...
> You're right. I'll add a delay there as well. The 'rang' question
> applies here as well.
>
Same thing, really. You could make it 100-200uS. That doesn't make much
difference for this driver, but it might make a difference for overall
performance, especially if everyone is playing nicely.
Guenter
next prev parent reply other threads:[~2013-09-19 0:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-18 22:43 [PATCH v2] clk: si570: Add a driver for SI570 oscillators Soren Brinkmann
[not found] ` <1379544219-23579-1-git-send-email-soren.brinkmann-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2013-09-18 22:43 ` Soren Brinkmann
2013-09-18 22:47 ` Sören Brinkmann
2013-09-18 23:02 ` Joe Perches
2013-09-18 23:09 ` Sören Brinkmann
[not found] ` <0da25c5c-660c-4836-8179-6e7c51fd0d9f-QhSrsHip19tEus+KprP3J7jjLBE8jN/0@public.gmane.org>
2013-09-18 23:18 ` Joe Perches
2013-09-18 23:32 ` Sören Brinkmann
2013-09-19 0:23 ` Guenter Roeck [this message]
2013-09-19 14:48 ` Sören Brinkmann
2013-09-19 13:17 ` Guenter Roeck
2013-09-19 16:01 ` Sören Brinkmann
2013-09-19 16:44 ` Guenter Roeck
2013-09-19 20:59 ` Sören Brinkmann
2013-09-19 21:11 ` Guenter Roeck
2013-09-19 18:05 ` Mike Turquette
2013-09-19 18:40 ` Sören Brinkmann
2013-09-19 21:15 ` Guenter Roeck
2013-09-19 21:57 ` Sören Brinkmann
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=20130919002308.GA11266@roeck-us.net \
--to=linux@roeck-us.net \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=hyunk@xilinx.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=joe@perches.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mturquette@linaro.org \
--cc=pawel.moll@arm.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--cc=sebastian.hesselbarth@gmail.com \
--cc=soren.brinkmann@xilinx.com \
--cc=swarren@wwwdotorg.org \
/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).