Re: [PATCH v3 4/6] mfd: Add RTL8231 core device

From: Andy Shevchenko
Date: Mon May 24 2021 - 06:19:16 EST


On Mon, May 24, 2021 at 11:23 AM Sander Vanheule <sander@xxxxxxxxxxxxx> wrote:
> On Mon, 2021-05-24 at 11:02 +0300, Andy Shevchenko wrote:
> > On Mon, May 24, 2021 at 1:34 AM Sander Vanheule <sander@xxxxxxxxxxxxx> wrote:

...

> > > + usleep_range(1000, 10000);
> >
> > It's strange to see this big range of minimum and maximum sleep.
> > Usually the ratio should not be bigger than ~3-4 between the values.
>
> I could also change this from a usleep to a polling loop that checks (with a
> loop limit) if the reset bit has self-cleared already.
>
> The datasheet that I have doesn't mention how fast it should self-clear. So I
> checked, and it appears to be done after one loop iteration already. So,
> certainly faster than the current usleep.
>
> Would a polling loop (with maybe like max. 10 iterations) be a good alternative
> for you?

I guess it's the right way to go. Just check the iopoll.h for helpers.
Also regmap has regmap_read_poll_timeout().

--
With Best Regards,
Andy Shevchenko