From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Tomas Melin <tomas.melin@vaisala.com>, Peter Rosin <peda@axentia.se>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
linux-iio@vger.kernel.org, jic23@kernel.org, lars@metafoo.de,
u.kleine-koenig@pengutronix.de
Subject: Re: [PATCH] iio: adc: ti-ads1015: support deferred probe
Date: Tue, 5 Sep 2023 15:38:48 +0300 [thread overview]
Message-ID: <ZPchWPSiy8J/3hX9@smile.fi.intel.com> (raw)
In-Reply-To: <848d639c-43d1-bf92-2292-059dd1a019cf@vaisala.com>
+Cc: Peter to look from the i2c mux point of view on the issue.
On Tue, Sep 05, 2023 at 02:43:19PM +0300, Tomas Melin wrote:
> On 04/09/2023 16:12, Jonathan Cameron wrote:
> > On Mon, 4 Sep 2023 14:23:29 +0300
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >> On Mon, Sep 04, 2023 at 01:15:22PM +0300, Tomas Melin wrote:
> >>> Support deferred probe for cases where communication on
> >>> i2c bus fails. These failures could happen for a variety of
> >>> reasons including bus arbitration error or power failure.
...
> >>> +out:
> >>> + if ((ret == -EAGAIN) || (ret == -ENXIO))
> >>> + return -EPROBE_DEFER;
> >>> + return ret;
> >>
> >> Oh my... This looks so-o hackish.
> >
> > Agreed. This is a non starter.
> >
> >> If anything, it has to be fixed on the level of regmap I2C APIs or so.
> >>
> >> Maybe something like regmap_i2c_try_write()/try_read() new APIs that
> >> will provide the above. Otherwise you want to fix _every single driver_
> >> in the Linux kernel
> >
> > Any probe ordering dependencies should be described by the
> > firmware and the driver should 'get' the relevant resource.
> > If there is anything not describable today then that is what we need
> > to fix, not paper over the holes
> >
> > So can we have specifics of what is happening here?
> >
> > If it's arbitration with some other entity then fix the arbitration
> > locking / hand over. If it's power, then make sure the relevant
> > regulator get gotten and turned on + has the right delays etc.
>
> Yes, right. In this use case, the ads1015 is connected to a channel of
> a i2c multiplexer. When the mux is probed, it also enumerates all the
> multiplexed buses and probes devices connected to them.
> For some reason, it behaves so that the ads1015 is not detected on the
> first attempt. Since it's a mux, connected to main i2c line, perhaps
> there really is some bus arbitration issue, or then something else.
>
> Anyways, when deferring the probe for the ads1015, and attempting later
> again it probes fine.
>
> So, it might be I've taken the wrong angle at this issue, but
> it does solve the issue at hand. Obviously, there could be some issue
> with the i2c mux driver, or then on hardware level too.
>
> Point is, that if the communication to the i2c bus has some temporary
> error like EAGAIN, why could it not be reasonable to try again at a
> later time instead of giving up completely.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-09-05 16:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-04 10:15 [PATCH] iio: adc: ti-ads1015: support deferred probe Tomas Melin
2023-09-04 11:23 ` Andy Shevchenko
2023-09-04 13:12 ` Jonathan Cameron
2023-09-05 11:43 ` Tomas Melin
2023-09-05 12:31 ` Lars-Peter Clausen
2023-09-06 5:59 ` Tomas Melin
2023-09-05 12:38 ` Andy Shevchenko [this message]
2023-09-05 6:13 ` Tomas Melin
2023-09-05 10:45 ` Andy Shevchenko
2023-09-05 11:44 ` Tomas Melin
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=ZPchWPSiy8J/3hX9@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=peda@axentia.se \
--cc=tomas.melin@vaisala.com \
--cc=u.kleine-koenig@pengutronix.de \
/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