> > > On 29/05/2020 09.44, Lorenzo Bianconi wrote: > > On May 29, Sean Nyekjaer wrote: > > > > > > > > > > > > > Could a solution, be to call st_lsm6dsx_reset_hw_ts() in st_lsm6dsx_resume() > > > > > ? > > > > > > > > yes, I think so. Could you please try to patch below? Thanks. > > > > > > > > > > Hi Lorenzo, > > > > > > I have tried your patch, and the timestamp seems to behave like before. > > > > > > https://gist.github.com/sknsean/959d3421f66cb49144e7841a8a08a2be > > > Sorry NTP have been connected for a while :) > > > > > > I will enable some more debug to trace what is happening. > > > > > > /Sean > > > > Hi Sean, > > > > thx for testing. Is the FIFO enabled before the suspend (in other words, is > > st_lsm6dsx_resume_fifo running in st_lsm6dsx_resume?) what is the value of > > sensor->ts_ref after the resume? > > I have applied this patch: > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c > b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c > > index 7de10bd636ea..915829f89d31 100644 > > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c > > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c > > @@ -304,12 +304,28 @@ static int st_lsm6dsx_reset_hw_ts(struct st_lsm6dsx_hw > *hw) > > > > int st_lsm6dsx_resume_fifo(struct st_lsm6dsx_hw *hw) > > { > > - int err; > > + int err, i; > > + struct st_lsm6dsx_sensor *sensor; > > > > + printk("st_lsm6dsx_resume_fifo\n"); > > + for (i = 0; i < ST_LSM6DSX_ID_MAX; i++) { > > + if (!hw->iio_devs[i]) > > + continue; > > + > > + sensor = iio_priv(hw->iio_devs[i]); > > + printk("Before[%d]: %lld\n", i, sensor->ts_ref); > > + } > > /* reset hw ts counter */ > > err = st_lsm6dsx_reset_hw_ts(hw); > > if (err < 0) > > return err; > > + for (i = 0; i < ST_LSM6DSX_ID_MAX; i++) { > > + if (!hw->iio_devs[i]) > > + continue; > > + > > + sensor = iio_priv(hw->iio_devs[i]); > > + printk("After[%d]: %lld\n", i, sensor->ts_ref); > > + } > > > > return st_lsm6dsx_set_fifo_mode(hw, ST_LSM6DSX_FIFO_CONT); > > } > > And dmesg: > [ 949.295585] st_lsm6dsx_resume_fifo > > [ 949.295617] Before[0]: 0 > > [ 949.295636] Before[1]: 0 > > [ 949.296456] After[0]: 1590740890980204361 > > [ 949.296476] After[1]: 1590740890980207987 > > [ 953.380200] PM: suspend entry (deep) > > [ 953.790084] Filesystems sync: 0.409 seconds > > [ 953.795329] Freezing user space processes ... (elapsed 0.002 seconds) > done. > > [ 953.798124] OOM killer disabled. > > [ 953.798140] Freezing remaining freezable tasks ... (elapsed 0.001 > seconds) done. > > [ 953.800016] printk: Suspending console(s) (use no_console_suspend to > debug) > > [ 953.869535] PM: suspend devices took 0.070 seconds > > [ 953.883280] Disabling non-boot CPUs ... > > [ 953.897700] st_lsm6dsx_resume_fifo > > [ 953.897732] Before[0]: 1590740890980204361 > > [ 953.897752] Before[1]: 1590740890980207987 > > [ 953.898572] After[0]: 1590740895583500924 > > [ 953.898594] After[1]: 1590740895583504049 > > [ 953.914484] PM: resume devices took 0.020 seconds > > [ 953.914533] OOM killer enabled. > > [ 953.914552] Restarting tasks ... done. > > [ 953.947170] PM: suspend exit > > /Sean Ack, values seem properly updated, while values reported to the upserspace are using wrong value? could you please try to dump ts samples reading the hw queue after the resume? Regards, Lorenzo
Attachment:
signature.asc
Description: PGP signature