linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Matti Lehtimäki" <matti.lehtimaki@gmail.com>,
	linux-iio@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Alexandru Ardelean" <aardelean@deviqon.com>,
	"Cai Huoqing" <cai.huoqing@linux.dev>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] iio: st_sensors: Retry ID verification on failure
Date: Wed, 3 Aug 2022 20:20:00 +0200	[thread overview]
Message-ID: <CACRpkdZF3AOurSnhEVSLrPmJOnU-+ZjtnA7G=QQ5sY-TUdKi0g@mail.gmail.com> (raw)
In-Reply-To: <20220731211743.6ab9264f@jic23-huawei>

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

      reply	other threads:[~2022-08-03 18:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-24 16:43 [PATCH 1/2] iio: st_sensors: Retry ID verification on failure Matti Lehtimäki
2022-07-24 16:43 ` [PATCH 2/2] iio: st_sensors: Fix null pointer on defer_probe error Matti Lehtimäki
2022-07-25 21:24   ` Andy Shevchenko
2022-07-25 21:20 ` [PATCH 1/2] iio: st_sensors: Retry ID verification on failure Andy Shevchenko
2022-07-31 16:00 ` Jonathan Cameron
2022-07-31 18:51   ` Matti Lehtimäki
2022-07-31 20:17     ` Jonathan Cameron
2022-08-03 18:20       ` Linus Walleij [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACRpkdZF3AOurSnhEVSLrPmJOnU-+ZjtnA7G=QQ5sY-TUdKi0g@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=aardelean@deviqon.com \
    --cc=cai.huoqing@linux.dev \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.lehtimaki@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).