lkml.org 
[lkml]   [2022]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/2] iio: st_sensors: Retry ID verification on failure
On Sun, Jul 24, 2022 at 6:54 PM Matti Lehtimäki
<matti.lehtimaki@gmail.com> wrote:
>
> Some sensors do not always start fast enough to read a valid ID from
> registers at first attempt. Let's retry at most 3 times with short sleep
> in between to fix random timing issues.

...

> + for (i = 0; i < VERIFY_ID_RETRY_COUNT; i++) {
> + err = regmap_read(sdata->regmap,
> + sdata->sensor_settings->wai_addr, &wai);
> +
> + if (!err && sdata->sensor_settings->wai == wai)
> + return 0;
> +
> + msleep(20);

NIH regmap_read_poll_timeout()


> + }

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2022-07-25 23:22    [W:1.260 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site