diff mbox series

[v2] iio: sx9310: Prefer async probe

Message ID 20200901081920.v2.1.Id02b2f451b3eed71ddd580f4b8b44b3e33e84970@changeid (mailing list archive)
State New, archived
Headers show
Series [v2] iio: sx9310: Prefer async probe | expand

Commit Message

Doug Anderson Sept. 1, 2020, 3:19 p.m. UTC
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(+)

Comments

Jonathan Cameron Sept. 6, 2020, 3:22 p.m. UTC | #1
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
diff mbox series

Patch

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,