lkml.org 
[lkml]   [2022]   [Aug]   [3]   [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 31, 2022 at 10:07 PM Jonathan Cameron <jic23@kernel.org> wrote:
> Matti Lehtimäki <matti.lehtimaki@gmail.com> wrote:

> > Based on the specification for the sensor I have and also driver used in
> > Android kernel for my device (it uses a 3 x 20 ms loop) I think 20 ms is
> > a good value but to be sure a slightly longer might make sense. As
> > suggested in the other review comment by changing the regmap_read to
> > regmap_read_poll_timeout the function doesn't always need to wait at
> > least 20 ms in case first read doesn't provide the correct value, if a
> > suitable shorter poll interval is used (something like 1-10 ms).
> >
> > However testing on my device has shown that I still need to have a loop
> > or at least a retry possibility because I have noticed a rare random
> > read error (-6, happens after some time not at first read) when reading
> > the id from the hardware. This could be due to for example internal
> > init failure of the sensor chip causing an internal reset. Because of
> > this read error regmap_read_poll_timeout returns with an error and
> > without retrying to read the id the sensor probe fails.
>
> Nasty. If you can get a confirmation that it's a possible failure on startup
> from the manufacturer then I'd be happier with that justification to retry
> rather than just sleep for say 30msec after power on.

If the power comes from an external regulator (such as a fixed-regulator
on a GPIO) it could be that the startup time for that regulator is incorrectly
specified or unspecified (startup-delay-us = ... for regulator-fixed)?

Else I think if the a vendor version of a driver for this HW does this quirk,
that's as good indication as you will ever get from a vendor. Do you
have the android driver source code? Or is it a userspace blob?

Yours,
Linus Walleij

\
 
 \ /
  Last update: 2022-08-03 20:20    [W:0.325 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site