Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: lorenzo.bianconi@redhat.com, linux-iio@vger.kernel.org,
	mario.tesi@st.com
Subject: Re: [PATCH v2] iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot
Date: Sun, 6 Feb 2022 15:32:33 +0000	[thread overview]
Message-ID: <20220206153233.45a96a9c@jic23-huawei> (raw)
In-Reply-To: <b41ebda5535895298716c76d939f9f165fcd2d13.1644098120.git.lorenzo@kernel.org>

On Sat,  5 Feb 2022 22:57:42 +0100
Lorenzo Bianconi <lorenzo@kernel.org> wrote:

> We need to wait for sensor settling time (~ 3/ODR) before reading data
> in st_lsm6dsx_read_oneshot routine in order to avoid corrupted samples.
> 
> Fixes: 290a6ce11d938 ("iio: imu: add support to lsm6dsx driver")
> Reported-by: Mario Tesi <mario.tesi@st.com>
> Tested-by: Mario Tesi <mario.tesi@st.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Thanks for the quick update.

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

> ---
> Changes since v1:
> - add missing Fixes tag.
> ---
>  drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index 727b4b6ac696..93f0c6bce502 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -1374,8 +1374,12 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor,
>  	if (err < 0)
>  		return err;
>  
> +	/*
> +	 * we need to wait for sensor settling time before
> +	 * reading data in order to avoid corrupted samples
> +	 */
>  	delay = 1000000000 / sensor->odr;
> -	usleep_range(delay, 2 * delay);
> +	usleep_range(3 * delay, 4 * delay);
>  
>  	err = st_lsm6dsx_read_locked(hw, addr, &data, sizeof(data));
>  	if (err < 0)


      reply	other threads:[~2022-02-06 15:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-05 21:57 [PATCH v2] iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot Lorenzo Bianconi
2022-02-06 15:32 ` Jonathan Cameron [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=20220206153233.45a96a9c@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=lorenzo@kernel.org \
    --cc=mario.tesi@st.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