On Mon, 2021-08-23 at 17:27 +0300, Andy Shevchenko wrote: > 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. > I see, that makes sense to me. > 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) udelay() would be for sleeps < 10us - Nuno Sá