linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] iio: sx9310: Prefer async probe
@ 2020-09-01 15:19 Douglas Anderson
  2020-09-01 15:43 ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Douglas Anderson @ 2020-09-01 15:19 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: swboyd, Douglas Anderson, Alexandru Ardelean, Andy Shevchenko,
	Daniel Campello, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

On one board I found that:
  probe of 5-0028 returned 1 after 259547 usecs

While some of this time is attributable to the pile of i2c transfers
that we do at probe time, the lion's share (over 200 ms) is sitting
waiting in the polling loop in sx9310_init_compensation() waiting for
the hardware to indicate that it's done.

There's no reason to block probe of all other devices on our probe.
Turn on async probe.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

Changes in v2:
- Updated commit message w/ details on why probe is slow.
- Added comment next to flag about why probe is slow.

 drivers/iio/proximity/sx9310.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/iio/proximity/sx9310.c b/drivers/iio/proximity/sx9310.c
index 9d72d08ab9e7..6d3f4ab8c6b2 100644
--- a/drivers/iio/proximity/sx9310.c
+++ b/drivers/iio/proximity/sx9310.c
@@ -1056,6 +1056,13 @@ static struct i2c_driver sx9310_driver = {
 		.acpi_match_table = sx9310_acpi_match,
 		.of_match_table = sx9310_of_match,
 		.pm = &sx9310_pm_ops,
+
+		/*
+		 * Lots of i2c transfers in probe + over 200 ms waiting in
+		 * sx9310_init_compensation() mean a slow probe; prefer async
+		 * so we don't delay boot if we're builtin to the kernel.
+		 */
+		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
 	},
 	.probe_new	= sx9310_probe,
 	.id_table	= sx9310_id,
-- 
2.28.0.402.g5ffc5be6b7-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] iio: sx9310: Prefer async probe
  2020-09-01 15:19 [PATCH v2] iio: sx9310: Prefer async probe Douglas Anderson
@ 2020-09-01 15:43 ` Stephen Boyd
  2020-09-01 17:01   ` Daniel Campello
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2020-09-01 15:43 UTC (permalink / raw)
  To: Douglas Anderson, Jonathan Cameron
  Cc: Douglas Anderson, Alexandru Ardelean, Andy Shevchenko,
	Daniel Campello, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

Quoting Douglas Anderson (2020-09-01 08:19:43)
> On one board I found that:
>   probe of 5-0028 returned 1 after 259547 usecs
> 
> While some of this time is attributable to the pile of i2c transfers
> that we do at probe time, the lion's share (over 200 ms) is sitting
> waiting in the polling loop in sx9310_init_compensation() waiting for
> the hardware to indicate that it's done.
> 
> There's no reason to block probe of all other devices on our probe.
> Turn on async probe.
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] iio: sx9310: Prefer async probe
  2020-09-01 15:43 ` Stephen Boyd
@ 2020-09-01 17:01   ` Daniel Campello
  2020-09-06 15:22     ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Campello @ 2020-09-01 17:01 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Douglas Anderson, Jonathan Cameron, Alexandru Ardelean,
	Andy Shevchenko, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, LKML

On Tue, Sep 1, 2020 at 9:43 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Douglas Anderson (2020-09-01 08:19:43)
> > On one board I found that:
> >   probe of 5-0028 returned 1 after 259547 usecs
> >
> > While some of this time is attributable to the pile of i2c transfers
> > that we do at probe time, the lion's share (over 200 ms) is sitting
> > waiting in the polling loop in sx9310_init_compensation() waiting for
> > the hardware to indicate that it's done.
> >
> > There's no reason to block probe of all other devices on our probe.
> > Turn on async probe.
> >
> > Signed-off-by: Douglas Anderson <dianders@chromium.org>
> > ---
>
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>

Reviewed-by: Daniel Campello <campello@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] iio: sx9310: Prefer async probe
  2020-09-01 17:01   ` Daniel Campello
@ 2020-09-06 15:22     ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2020-09-06 15:22 UTC (permalink / raw)
  To: Daniel Campello
  Cc: Stephen Boyd, Douglas Anderson, Alexandru Ardelean,
	Andy Shevchenko, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, LKML

On Tue, 1 Sep 2020 11:01:29 -0600
Daniel Campello <campello@chromium.org> wrote:

> On Tue, Sep 1, 2020 at 9:43 AM Stephen Boyd <swboyd@chromium.org> wrote:
> >
> > Quoting Douglas Anderson (2020-09-01 08:19:43)  
> > > On one board I found that:
> > >   probe of 5-0028 returned 1 after 259547 usecs
> > >
> > > While some of this time is attributable to the pile of i2c transfers
> > > that we do at probe time, the lion's share (over 200 ms) is sitting
> > > waiting in the polling loop in sx9310_init_compensation() waiting for
> > > the hardware to indicate that it's done.
> > >
> > > There's no reason to block probe of all other devices on our probe.
> > > Turn on async probe.
> > >
> > > Signed-off-by: Douglas Anderson <dianders@chromium.org>
> > > ---  
> >
> > Reviewed-by: Stephen Boyd <swboyd@chromium.org>  
> 
> Reviewed-by: Daniel Campello <campello@chromium.org>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to poke at it.

thanks,

Jonathan



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-06 15:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 15:19 [PATCH v2] iio: sx9310: Prefer async probe Douglas Anderson
2020-09-01 15:43 ` Stephen Boyd
2020-09-01 17:01   ` Daniel Campello
2020-09-06 15:22     ` Jonathan Cameron

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).