* [PATCH] iio: imu: st_lsm6dsx: reset hw ts after resume
@ 2020-07-10 13:49 Lorenzo Bianconi
2020-07-11 11:49 ` Sean Nyekjaer
0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Bianconi @ 2020-07-10 13:49 UTC (permalink / raw)
To: jic23; +Cc: sean, linux-iio, lorenzo.bianconi
Reset hw time sampling after the device resume in order to keep timing
in sync
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 3 +--
.../iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 23 ++++++++++++-------
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +-
3 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
index b56df409ed0f..529970195b39 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
@@ -436,8 +436,7 @@ int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor,
u16 watermark);
int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable);
int st_lsm6dsx_flush_fifo(struct st_lsm6dsx_hw *hw);
-int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
- enum st_lsm6dsx_fifo_mode fifo_mode);
+int st_lsm6dsx_resume_fifo(struct st_lsm6dsx_hw *hw);
int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw);
int st_lsm6dsx_read_tagged_fifo(struct st_lsm6dsx_hw *hw);
int st_lsm6dsx_check_odr(struct st_lsm6dsx_sensor *sensor, u32 odr, u8 *val);
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
index afd00daeefb2..7de10bd636ea 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
@@ -184,8 +184,8 @@ static int st_lsm6dsx_update_decimators(struct st_lsm6dsx_hw *hw)
return err;
}
-int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
- enum st_lsm6dsx_fifo_mode fifo_mode)
+static int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
+ enum st_lsm6dsx_fifo_mode fifo_mode)
{
unsigned int data;
@@ -302,6 +302,18 @@ static int st_lsm6dsx_reset_hw_ts(struct st_lsm6dsx_hw *hw)
return 0;
}
+int st_lsm6dsx_resume_fifo(struct st_lsm6dsx_hw *hw)
+{
+ int err;
+
+ /* reset hw ts counter */
+ err = st_lsm6dsx_reset_hw_ts(hw);
+ if (err < 0)
+ return err;
+
+ return st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
+}
+
/*
* Set max bulk read to ST_LSM6DSX_MAX_WORD_LEN/ST_LSM6DSX_MAX_TAGGED_WORD_LEN
* in order to avoid a kmalloc for each bus access
@@ -675,12 +687,7 @@ int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable)
goto out;
if (fifo_mask) {
- /* reset hw ts counter */
- err = st_lsm6dsx_reset_hw_ts(hw);
- if (err < 0)
- goto out;
-
- err = st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
+ err = st_lsm6dsx_resume_fifo(hw);
if (err < 0)
goto out;
}
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index c8ddeb3f48ff..346c24281d26 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2457,7 +2457,7 @@ static int __maybe_unused st_lsm6dsx_resume(struct device *dev)
}
if (hw->fifo_mask)
- err = st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
+ err = st_lsm6dsx_resume_fifo(hw);
return err;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: imu: st_lsm6dsx: reset hw ts after resume
2020-07-10 13:49 [PATCH] iio: imu: st_lsm6dsx: reset hw ts after resume Lorenzo Bianconi
@ 2020-07-11 11:49 ` Sean Nyekjaer
2020-07-12 11:10 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Sean Nyekjaer @ 2020-07-11 11:49 UTC (permalink / raw)
To: Lorenzo Bianconi, jic23; +Cc: linux-iio, lorenzo.bianconi
On 10/07/2020 15.49, Lorenzo Bianconi wrote:
> Reset hw time sampling after the device resume in order to keep timing
> in sync
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Sean Nyekjaer <sean@geanix.com>
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 3 +--
> .../iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 23 ++++++++++++-------
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +-
> 3 files changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> index b56df409ed0f..529970195b39 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> @@ -436,8 +436,7 @@ int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor,
> u16 watermark);
> int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable);
> int st_lsm6dsx_flush_fifo(struct st_lsm6dsx_hw *hw);
> -int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
> - enum st_lsm6dsx_fifo_mode fifo_mode);
> +int st_lsm6dsx_resume_fifo(struct st_lsm6dsx_hw *hw);
> int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw);
> int st_lsm6dsx_read_tagged_fifo(struct st_lsm6dsx_hw *hw);
> int st_lsm6dsx_check_odr(struct st_lsm6dsx_sensor *sensor, u32 odr, u8 *val);
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> index afd00daeefb2..7de10bd636ea 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> @@ -184,8 +184,8 @@ static int st_lsm6dsx_update_decimators(struct st_lsm6dsx_hw *hw)
> return err;
> }
>
> -int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
> - enum st_lsm6dsx_fifo_mode fifo_mode)
> +static int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
> + enum st_lsm6dsx_fifo_mode fifo_mode)
> {
> unsigned int data;
>
> @@ -302,6 +302,18 @@ static int st_lsm6dsx_reset_hw_ts(struct st_lsm6dsx_hw *hw)
> return 0;
> }
>
> +int st_lsm6dsx_resume_fifo(struct st_lsm6dsx_hw *hw)
> +{
> + int err;
> +
> + /* reset hw ts counter */
> + err = st_lsm6dsx_reset_hw_ts(hw);
> + if (err < 0)
> + return err;
> +
> + return st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
> +}
> +
> /*
> * Set max bulk read to ST_LSM6DSX_MAX_WORD_LEN/ST_LSM6DSX_MAX_TAGGED_WORD_LEN
> * in order to avoid a kmalloc for each bus access
> @@ -675,12 +687,7 @@ int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable)
> goto out;
>
> if (fifo_mask) {
> - /* reset hw ts counter */
> - err = st_lsm6dsx_reset_hw_ts(hw);
> - if (err < 0)
> - goto out;
> -
> - err = st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
> + err = st_lsm6dsx_resume_fifo(hw);
> if (err < 0)
> goto out;
> }
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index c8ddeb3f48ff..346c24281d26 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -2457,7 +2457,7 @@ static int __maybe_unused st_lsm6dsx_resume(struct device *dev)
> }
>
> if (hw->fifo_mask)
> - err = st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
> + err = st_lsm6dsx_resume_fifo(hw);
>
> return err;
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: imu: st_lsm6dsx: reset hw ts after resume
2020-07-11 11:49 ` Sean Nyekjaer
@ 2020-07-12 11:10 ` Jonathan Cameron
2020-07-12 14:33 ` Lorenzo Bianconi
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2020-07-12 11:10 UTC (permalink / raw)
To: Sean Nyekjaer; +Cc: Lorenzo Bianconi, linux-iio, lorenzo.bianconi
On Sat, 11 Jul 2020 13:49:37 +0200
Sean Nyekjaer <sean@geanix.com> wrote:
> On 10/07/2020 15.49, Lorenzo Bianconi wrote:
> > Reset hw time sampling after the device resume in order to keep timing
> > in sync
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> Tested-by: Sean Nyekjaer <sean@geanix.com>
Hi Lorenzo,
Patch is fine, but I'd like a couple of changes to the description:
1. More detail! For what we have here no one will have any real idea
of whether an issue they are seeing is the same one or not.
2. Fixes tag / or something telling me why this shouldn't be back ported.
Thanks,
Jonathan
> > ---
> > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 3 +--
> > .../iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 23 ++++++++++++-------
> > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +-
> > 3 files changed, 17 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> > index b56df409ed0f..529970195b39 100644
> > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> > @@ -436,8 +436,7 @@ int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor,
> > u16 watermark);
> > int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable);
> > int st_lsm6dsx_flush_fifo(struct st_lsm6dsx_hw *hw);
> > -int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
> > - enum st_lsm6dsx_fifo_mode fifo_mode);
> > +int st_lsm6dsx_resume_fifo(struct st_lsm6dsx_hw *hw);
> > int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw);
> > int st_lsm6dsx_read_tagged_fifo(struct st_lsm6dsx_hw *hw);
> > int st_lsm6dsx_check_odr(struct st_lsm6dsx_sensor *sensor, u32 odr, u8 *val);
> > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> > index afd00daeefb2..7de10bd636ea 100644
> > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> > @@ -184,8 +184,8 @@ static int st_lsm6dsx_update_decimators(struct st_lsm6dsx_hw *hw)
> > return err;
> > }
> >
> > -int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
> > - enum st_lsm6dsx_fifo_mode fifo_mode)
> > +static int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
> > + enum st_lsm6dsx_fifo_mode fifo_mode)
> > {
> > unsigned int data;
> >
> > @@ -302,6 +302,18 @@ static int st_lsm6dsx_reset_hw_ts(struct st_lsm6dsx_hw *hw)
> > return 0;
> > }
> >
> > +int st_lsm6dsx_resume_fifo(struct st_lsm6dsx_hw *hw)
> > +{
> > + int err;
> > +
> > + /* reset hw ts counter */
> > + err = st_lsm6dsx_reset_hw_ts(hw);
> > + if (err < 0)
> > + return err;
> > +
> > + return st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
> > +}
> > +
> > /*
> > * Set max bulk read to ST_LSM6DSX_MAX_WORD_LEN/ST_LSM6DSX_MAX_TAGGED_WORD_LEN
> > * in order to avoid a kmalloc for each bus access
> > @@ -675,12 +687,7 @@ int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable)
> > goto out;
> >
> > if (fifo_mask) {
> > - /* reset hw ts counter */
> > - err = st_lsm6dsx_reset_hw_ts(hw);
> > - if (err < 0)
> > - goto out;
> > -
> > - err = st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
> > + err = st_lsm6dsx_resume_fifo(hw);
> > if (err < 0)
> > goto out;
> > }
> > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > index c8ddeb3f48ff..346c24281d26 100644
> > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > @@ -2457,7 +2457,7 @@ static int __maybe_unused st_lsm6dsx_resume(struct device *dev)
> > }
> >
> > if (hw->fifo_mask)
> > - err = st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
> > + err = st_lsm6dsx_resume_fifo(hw);
> >
> > return err;
> > }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: imu: st_lsm6dsx: reset hw ts after resume
2020-07-12 11:10 ` Jonathan Cameron
@ 2020-07-12 14:33 ` Lorenzo Bianconi
0 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2020-07-12 14:33 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Sean Nyekjaer, linux-iio, lorenzo.bianconi
[-- Attachment #1: Type: text/plain, Size: 4320 bytes --]
> On Sat, 11 Jul 2020 13:49:37 +0200
> Sean Nyekjaer <sean@geanix.com> wrote:
>
> > On 10/07/2020 15.49, Lorenzo Bianconi wrote:
> > > Reset hw time sampling after the device resume in order to keep timing
> > > in sync
> > >
> > > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > Tested-by: Sean Nyekjaer <sean@geanix.com>
> Hi Lorenzo,
Hi Jonathan,
>
> Patch is fine, but I'd like a couple of changes to the description:
> 1. More detail! For what we have here no one will have any real idea
> of whether an issue they are seeing is the same one or not.
> 2. Fixes tag / or something telling me why this shouldn't be back ported.
sure, I will fix them in v2.
Regards,
Lorenzo
>
> Thanks,
>
> Jonathan
>
> > > ---
> > > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 3 +--
> > > .../iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 23 ++++++++++++-------
> > > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +-
> > > 3 files changed, 17 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> > > index b56df409ed0f..529970195b39 100644
> > > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> > > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
> > > @@ -436,8 +436,7 @@ int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor,
> > > u16 watermark);
> > > int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable);
> > > int st_lsm6dsx_flush_fifo(struct st_lsm6dsx_hw *hw);
> > > -int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
> > > - enum st_lsm6dsx_fifo_mode fifo_mode);
> > > +int st_lsm6dsx_resume_fifo(struct st_lsm6dsx_hw *hw);
> > > int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw);
> > > int st_lsm6dsx_read_tagged_fifo(struct st_lsm6dsx_hw *hw);
> > > int st_lsm6dsx_check_odr(struct st_lsm6dsx_sensor *sensor, u32 odr, u8 *val);
> > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> > > index afd00daeefb2..7de10bd636ea 100644
> > > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> > > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
> > > @@ -184,8 +184,8 @@ static int st_lsm6dsx_update_decimators(struct st_lsm6dsx_hw *hw)
> > > return err;
> > > }
> > >
> > > -int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
> > > - enum st_lsm6dsx_fifo_mode fifo_mode)
> > > +static int st_lsm6dsx_set_fifo_mode(struct st_lsm6dsx_hw *hw,
> > > + enum st_lsm6dsx_fifo_mode fifo_mode)
> > > {
> > > unsigned int data;
> > >
> > > @@ -302,6 +302,18 @@ static int st_lsm6dsx_reset_hw_ts(struct st_lsm6dsx_hw *hw)
> > > return 0;
> > > }
> > >
> > > +int st_lsm6dsx_resume_fifo(struct st_lsm6dsx_hw *hw)
> > > +{
> > > + int err;
> > > +
> > > + /* reset hw ts counter */
> > > + err = st_lsm6dsx_reset_hw_ts(hw);
> > > + if (err < 0)
> > > + return err;
> > > +
> > > + return st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
> > > +}
> > > +
> > > /*
> > > * Set max bulk read to ST_LSM6DSX_MAX_WORD_LEN/ST_LSM6DSX_MAX_TAGGED_WORD_LEN
> > > * in order to avoid a kmalloc for each bus access
> > > @@ -675,12 +687,7 @@ int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable)
> > > goto out;
> > >
> > > if (fifo_mask) {
> > > - /* reset hw ts counter */
> > > - err = st_lsm6dsx_reset_hw_ts(hw);
> > > - if (err < 0)
> > > - goto out;
> > > -
> > > - err = st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
> > > + err = st_lsm6dsx_resume_fifo(hw);
> > > if (err < 0)
> > > goto out;
> > > }
> > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > > index c8ddeb3f48ff..346c24281d26 100644
> > > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> > > @@ -2457,7 +2457,7 @@ static int __maybe_unused st_lsm6dsx_resume(struct device *dev)
> > > }
> > >
> > > if (hw->fifo_mask)
> > > - err = st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT);
> > > + err = st_lsm6dsx_resume_fifo(hw);
> > >
> > > return err;
> > > }
> >
>
[-- 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:[~2020-07-12 14:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10 13:49 [PATCH] iio: imu: st_lsm6dsx: reset hw ts after resume Lorenzo Bianconi
2020-07-11 11:49 ` Sean Nyekjaer
2020-07-12 11:10 ` Jonathan Cameron
2020-07-12 14:33 ` 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.