Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Stepan Ionichev <sozdayvek@gmail.com>
Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
	gregkh@linuxfoundation.org, hcazarim@yahoo.com,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: gyro: bmg160: wait full startup time after mode change at probe
Date: Sat, 16 May 2026 11:49:26 +0100	[thread overview]
Message-ID: <20260516114926.3a8b7d38@jic23-huawei> (raw)
In-Reply-To: <20260511154704.76967b74@jic23-huawei>

On Mon, 11 May 2026 15:47:04 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Mon, 11 May 2026 11:40:20 +0500
> Stepan Ionichev <sozdayvek@gmail.com> wrote:
> 
> > bmg160_chip_init() calls bmg160_set_mode(BMG160_MODE_NORMAL) and
> > then waits only 500-1000 us. Per the BMG160 datasheet
> > (BST-BMG160-DS000-07 Rev. 1.0, May 2013), the start-up and wake-up
> > times (tsu, twusm) are 30 ms.
> > 
> > The same file already waits BMG160_MAX_STARTUP_TIME_MS (80 ms)
> > in bmg160_runtime_resume() after the same set_mode(NORMAL)
> > operation. The 500 us value at probe was likely a unit mix-up;
> > the old comment said "500 ms" while the code used microseconds.
> > 
> > Reuse the same constant via msleep() and add a code comment
> > explaining the datasheet basis for the wait. Without this,
> > register writes that follow the mode change can hit the chip
> > before it is ready.
> > 
> > Fixes: 22b46c45fb9b ("iio:gyro:bmg160 Gyro Sensor driver")
> > Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>  
> Some process stuff.
> 
> Never send a new version in reply to the older one.  Always
> a fresh thread - the reason is mainly that the threads become unreadable
> if you got to more than one or two versions.
> 
> Also, don't send a new version for a reasonable period of time.
> Something small like this maybe a few days, a bigger patch 1 week.
> 
> That lets multiple reviewers have time to take a look.
> If you have a lot on list already then slow down in general and
> spend some time helping to review patches coming from others.
> The biggest bottleneck in IIO is reviewer time.
> 
> Anyhow, I'm going ignore this for a little while at least...

Applied to the fixes-togreg branch of iio.git and marked for stable.

As fixes go it's pretty safe given it just extends a sleep, so
I'll grab it now rather than waiting longer.

Jonathan

> 
> Jonathan
> 
> > ---
> > v2:
> > - Use msleep() instead of msleep_interruptible() so the wait is not
> >   cut short by signals during probe (per Andy)
> > - Add a code comment with the datasheet basis for the 80 ms wait
> >   (per Andy)
> > 
> >  drivers/iio/gyro/bmg160_core.c | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c
> > index 38394b5f3..6d9019451 100644
> > --- a/drivers/iio/gyro/bmg160_core.c
> > +++ b/drivers/iio/gyro/bmg160_core.c
> > @@ -258,8 +258,14 @@ static int bmg160_chip_init(struct bmg160_data *data)
> >  	if (ret < 0)
> >  		return ret;
> >  
> > -	/* Wait upto 500 ms to be ready after changing mode */
> > -	usleep_range(500, 1000);
> > +	/*
> > +	 * Wait for the chip to be ready after switching to normal mode.
> > +	 * The BMG160 datasheet (BST-BMG160-DS000-07 Rev. 1.0, May 2013)
> > +	 * specifies a start-up / wake-up time (tsu, twusm) of 30 ms; use
> > +	 * BMG160_MAX_STARTUP_TIME_MS (80 ms) as a safety margin, matching
> > +	 * what bmg160_runtime_resume() already does.
> > +	 */
> > +	msleep(BMG160_MAX_STARTUP_TIME_MS);
> >  
> >  	/* Set Bandwidth */
> >  	ret = bmg160_set_bw(data, BMG160_DEF_BW);  
> 
> 


  reply	other threads:[~2026-05-16 10:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11  6:27 [PATCH] iio: gyro: bmg160: wait full startup time after mode change at probe Stepan Ionichev
2026-05-11  6:40 ` [PATCH v2] " Stepan Ionichev
2026-05-11 14:47   ` Jonathan Cameron
2026-05-16 10:49     ` Jonathan Cameron [this message]
2026-05-11 13:49 ` [PATCH] " Andy Shevchenko

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=20260516114926.3a8b7d38@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hcazarim@yahoo.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=sozdayvek@gmail.com \
    /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