* [PATCH] iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot
@ 2022-01-31 11:08 Lorenzo Bianconi
2022-01-31 12:46 ` Mario TESI
0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Bianconi @ 2022-01-31 11:08 UTC (permalink / raw)
To: jic23; +Cc: lorenzo.bianconi, linux-iio, mario.tesi
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.
Reported-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
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)
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot
2022-01-31 11:08 [PATCH] iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot Lorenzo Bianconi
@ 2022-01-31 12:46 ` Mario TESI
2022-02-05 17:45 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Mario TESI @ 2022-01-31 12:46 UTC (permalink / raw)
To: Lorenzo Bianconi, jic23; +Cc: lorenzo.bianconi, linux-iio
Tested-by: Mario Tesi <mario.tesi@st.com>
________________________________________
Da: Lorenzo Bianconi <lorenzo@kernel.org>
Inviato: lunedì 31 gennaio 2022 12:08
A: jic23@kernel.org
Cc: lorenzo.bianconi@redhat.com; linux-iio@vger.kernel.org; Mario TESI
Oggetto: [PATCH] iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot
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.
Reported-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
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)
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot
2022-01-31 12:46 ` Mario TESI
@ 2022-02-05 17:45 ` Jonathan Cameron
2022-02-05 21:54 ` lorenzo.bianconi
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2022-02-05 17:45 UTC (permalink / raw)
To: Mario TESI; +Cc: Lorenzo Bianconi, lorenzo.bianconi, linux-iio
On Mon, 31 Jan 2022 12:46:56 +0000
Mario TESI <mario.tesi@st.com> wrote:
> Tested-by: Mario Tesi <mario.tesi@st.com>
> ________________________________________
> Da: Lorenzo Bianconi <lorenzo@kernel.org>
> Inviato: lunedì 31 gennaio 2022 12:08
> A: jic23@kernel.org
> Cc: lorenzo.bianconi@redhat.com; linux-iio@vger.kernel.org; Mario TESI
> Oggetto: [PATCH] iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot
>
> 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.
>
> Reported-by: Mario Tesi <mario.tesi@st.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Fixes tag? This definitely looks like stable material to me
so we want a clear record of when the issue was introduced.
Thanks,
Jonathan
> ---
> 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)
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot
2022-02-05 17:45 ` Jonathan Cameron
@ 2022-02-05 21:54 ` lorenzo.bianconi
0 siblings, 0 replies; 4+ messages in thread
From: lorenzo.bianconi @ 2022-02-05 21:54 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Mario TESI, Lorenzo Bianconi, linux-iio
[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]
> On Mon, 31 Jan 2022 12:46:56 +0000
> Mario TESI <mario.tesi@st.com> wrote:
>
> > Tested-by: Mario Tesi <mario.tesi@st.com>
> > ________________________________________
> > Da: Lorenzo Bianconi <lorenzo@kernel.org>
> > Inviato: lunedì 31 gennaio 2022 12:08
> > A: jic23@kernel.org
> > Cc: lorenzo.bianconi@redhat.com; linux-iio@vger.kernel.org; Mario TESI
> > Oggetto: [PATCH] iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot
> >
> > 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.
> >
> > Reported-by: Mario Tesi <mario.tesi@st.com>
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
>
> Fixes tag? This definitely looks like stable material to me
> so we want a clear record of when the issue was introduced.
>
> Thanks,
ack, right. I will add it in v2.
Regards,
Lorenzo
>
> Jonathan
>
>
> > ---
> > 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)
> > --
> > 2.34.1
> >
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-05 21:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31 11:08 [PATCH] iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot Lorenzo Bianconi
2022-01-31 12:46 ` Mario TESI
2022-02-05 17:45 ` Jonathan Cameron
2022-02-05 21:54 ` lorenzo.bianconi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.