The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Stepan Ionichev <sozdayvek@gmail.com>
Cc: jic23@kernel.org, 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] iio: gyro: bmg160: wait full startup time after mode change at probe
Date: Mon, 11 May 2026 16:49:34 +0300	[thread overview]
Message-ID: <agHebs-YfvLCtagH@ashevche-desk.local> (raw)
In-Reply-To: <20260511062755.30-1-sozdayvek@gmail.com>

On Mon, May 11, 2026 at 11:27:55AM +0500, Stepan Ionichev 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_interruptible() to match the
> runtime resume path. Without this, register writes that follow
> the mode change can hit the chip before it is ready.

...

> -	/* Wait upto 500 ms to be ready after changing mode */

First of all, the same comment, put better description on "why?"
based on the datasheet explanation.

> -	usleep_range(500, 1000);
> +	msleep_interruptible(BMG160_MAX_STARTUP_TIME_MS);

Hmm... This returns an error in case it's aborted by a signal or other means.
What are you supposed to do with that?

-- 
With Best Regards,
Andy Shevchenko



      parent reply	other threads:[~2026-05-11 13:49 UTC|newest]

Thread overview: 4+ 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-11 13:49 ` Andy Shevchenko [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=agHebs-YfvLCtagH@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hcazarim@yahoo.com \
    --cc=jic23@kernel.org \
    --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