Re: [PATCH 1/2] iio: ltc2983: add support for optional reset gpio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 23, 2021 at 3:51 PM Nuno Sá <noname.nuno@xxxxxxxxx> wrote:
> On Mon, 2021-08-23 at 14:14 +0300, Andy Shevchenko wrote:
> > On Fri, Aug 20, 2021 at 9:53 AM Nuno Sá <nuno.sa@xxxxxxxxxx> wrote:
> > > Check if an optional reset gpio is present and if so, make sure to
> > > reset
> > > the device.
> >
> > ...
> >
> > > +               usleep_range(1000, 1005);
> >
> > The delta should be at least 20%, otherwise I'm not sure why such a
> > strict range?
> >
>
> No special reason... I just had no hard requirement for delta so I just
> gave something small. Is 20% documented anywhere?

Quick search shows nothing, but I remember I saw it somewhere.
So, the explanation is empirical, because the idea behind is to allow
less HRT interrupts. When you do a tough margin, you may generate too
many interrupts from the timer. So, 20% seems like a good balance for
most of the values.

The parameters to take into account are:
 - minimum (or maybe rather median?) CPU frequency the code will be run on
 - minimal sleep (for small sleeps even better to have udelay() as I
believe documented in timers.rst, for bigger sleeps, like 10ms the
margin can be 10% or so)
 - NO_HZ kernel configuration
 - etc (if anything I forgot)

> I did a quick look on
> the API's and I could not find nothing related. Anyways, if that is a
> best practise for being more power friendly I'm happy to change it...
> (well, we might end up just having 100ms here which means 'msleep()').


-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux