Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1433246

Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous mode

From Doug Anderson <dianders@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous mode
Date 2016-06-28 21:40 +0200
Message-ID <rP71x-2K4-45@gated-at.bofh.it> (permalink)
References <rOThT-25m-15@gated-at.bofh.it> <rP6oO-2h2-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Mark,

On Tue, Jun 28, 2016 at 11:52 AM, Mark Brown <broonie@kernel.org> wrote:
> On Mon, Jun 27, 2016 at 09:53:11PM -0700, Douglas Anderson wrote:
>
>> Note also that the upper bound of usleep_range probably shouldn't be a
>> full 1 ms longer than the lower bound since I've seen plenty of hardware
>> with a ramp rate of ~5000 uS / uV and for small jumps the total delays
>> are in the tens of uS.  1000 is way too much.  We'll try to be dynamic
>> and use 10%
>
> Surely the upper bound here is just an upper bound and we're essentially
> just saying that "anything over minimum is fine" here?  Though now I
> look at the implementation it seems it's doing something entirely
> unehelpful and actually trying to delay for the longest possible time
> which doesn't seem like what we want or what the usleep_range() API
> would suggest :(

Yeah, you're thinking like someone who wants your computer to perform
fast.  That's just simply the wrong mentality to have (how dare you?).
You need to think about power savings, and a sleeping computer is a
computer that doesn't draw much power.  Thus, you want to sleep as
long as you can.  :-P

In all seriousness, I think the design for usleep_range() is to try to
batch up wakeups to allow longer periods of sleeping and to optimize
power.  This you want to sleep as long as is allowable and then if you
happen to wakeup for some other reason anyway then you process all the
things whose minimum has passed.  IIRC it was trying to get back to
the good old days of only having jiffies where everyone was
synchronized on the tick and you could sleep till the next tick after
all the work was done.  When you think of it this way then sleeping to
the max makes sense.  ...but it also means that you need to be careful
and really not set the max too high.

Of course, in practice I've found that often usleep_range() 99% of the
time sleeps for the max.  That can lead to some very subtle bugs if
your min sleep is not long enough (!).


-Doug

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] regulator: pwm: Fix regulator ramp delay for continuous mode Douglas Anderson <dianders@chromium.org> - 2016-06-28 07:00 +0200
  Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Caesar Wang <caesar.upstream@gmail.com> - 2016-06-28 12:40 +0200
  Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous mode Brian Norris <briannorris@chromium.org> - 2016-06-28 18:10 +0200
  Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Mark Brown <broonie@kernel.org> - 2016-06-28 21:00 +0200
    Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous mode Doug Anderson <dianders@chromium.org> - 2016-06-28 21:40 +0200
  Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Mark Brown <broonie@kernel.org> - 2016-06-28 21:00 +0200
    Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous mode Doug Anderson <dianders@chromium.org> - 2016-06-28 21:40 +0200
      Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Mark Brown <broonie@kernel.org> - 2016-06-28 22:00 +0200
  Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Mark Brown <broonie@kernel.org> - 2016-07-01 10:10 +0200
    Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous mode Doug Anderson <dianders@chromium.org> - 2016-07-01 22:30 +0200
      Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Mark Brown <broonie@kernel.org> - 2016-07-02 10:10 +0200
        Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous mode Doug Anderson <dianders@chromium.org> - 2016-07-06 20:40 +0200
          Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Mark Brown <broonie@kernel.org> - 2016-07-07 10:20 +0200
      Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-07-02 18:00 +0200
        Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Mark Brown <broonie@kernel.org> - 2016-07-04 11:00 +0200
          Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-07-04 11:10 +0200
            Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Mark Brown <broonie@kernel.org> - 2016-07-04 11:20 +0200
              Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Thierry Reding <thierry.reding@gmail.com> - 2016-07-08 18:50 +0200
  Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-07-06 14:30 +0200
    Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous mode Doug Anderson <dianders@chromium.org> - 2016-07-06 20:40 +0200
      Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Mark Brown <broonie@kernel.org> - 2016-07-07 10:20 +0200
    Re: [PATCH] regulator: pwm: Fix regulator ramp delay for continuous  mode Mark Brown <broonie@kernel.org> - 2016-07-07 10:20 +0200

csiph-web