* [PATCH v2] iio: imu: st_lsm6dsx: set ts_sensitivity on parts without freq_fine
@ 2026-11-24 23:15 Phil Williams via B4 Relay
2026-11-25 8:11 ` Lorenzo Bianconi
0 siblings, 1 reply; 2+ messages in thread
From: Phil Williams via B4 Relay @ 2026-11-24 23:15 UTC (permalink / raw)
To: Lorenzo Bianconi, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Mario Tesi
Cc: linux-iio, linux-kernel, Jonathan Cameron, stable, Phil Williams
From: Phil Williams <phil.williams@advisoft.co.nz>
Commit 8abbf45fcda0 ("iio: st_lsm6dsx: Fixed calibrated timestamp
calculation") takes the FIFO timestamp scale from ts_sensitivity.
That field is only filled in for parts that have freq_fine. The
untagged-FIFO parts are left at zero:
LSM6DS3
LSM6DS3H
LSM6DSL, LSM6DSM, ISM330DLC and LSM6DS3TR-C
st_lsm6dsx_read_fifo() multiplies the raw counter by hw->ts_gain, so
every sample is published with the timestamp taken when the buffer
was enabled. The accelerometer and gyroscope values still update.
Userspace that integrates attitude from the timestamp delta treats a
stuck timestamp as dt = 0.
Set ts_sensitivity to the previous fixed scale of 25000 ns/tick on
those entries. They have no freq_fine register, so ts_trim_coeff is
left unset and no trim is applied.
Fixes: 8abbf45fcda0 ("iio: st_lsm6dsx: Fixed calibrated timestamp calculation")
Cc: stable@vger.kernel.org
Suggested-by: Lorenzo Bianconi <lorenzo@kernel.org>
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Phil Williams <phil.williams@advisoft.co.nz>
---
Resending inline. The first copy went out as an attachment.
No code changes.
---
Changes in v2:
- Drop the ts_gain fallback in st_lsm6dsx_init_hw_timer() and set
.ts_sensitivity = 25000 in the LSM6DS3, LSM6DS3H and LSM6DSL settings
entries instead (Lorenzo, Jonathan).
- Leave .ts_trim_coeff unset on those entries since they have no
freq_fine register (Francesco).
- Link to v1: https://lore.kernel.org/r/20261116-st-lsm6dsx-ts-fallback-v1-1-8ace30afbfb5@advisoft.co.nz
---
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index 823f8ac66..dffaf76b5 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -434,6 +434,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
.addr = 0x09,
.mask = GENMASK(5, 3),
},
+ .ts_sensitivity = 25000,
},
.event_settings = {
.sources = {
@@ -601,6 +602,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
.addr = 0x09,
.mask = GENMASK(5, 3),
},
+ .ts_sensitivity = 25000,
},
.event_settings = {
.sources = {
@@ -802,6 +804,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
.addr = 0x09,
.mask = GENMASK(5, 3),
},
+ .ts_sensitivity = 25000,
},
.shub_settings = {
.page_mux = {
---
base-commit: fa2933aac170dd19c6a7f0d7b81a8f537e40915c
change-id: 20261116-st-lsm6dsx-ts-fallback-cd21f1d1e30e
Best regards,
--
Phil Williams <phil.williams@advisoft.co.nz>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] iio: imu: st_lsm6dsx: set ts_sensitivity on parts without freq_fine
2026-11-24 23:15 [PATCH v2] iio: imu: st_lsm6dsx: set ts_sensitivity on parts without freq_fine Phil Williams via B4 Relay
@ 2026-11-25 8:11 ` Lorenzo Bianconi
0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Bianconi @ 2026-11-25 8:11 UTC (permalink / raw)
To: phil.williams
Cc: Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Mario Tesi, linux-iio, linux-kernel, stable
[-- Attachment #1: Type: text/plain, Size: 3046 bytes --]
> From: Phil Williams <phil.williams@advisoft.co.nz>
>
> Commit 8abbf45fcda0 ("iio: st_lsm6dsx: Fixed calibrated timestamp
> calculation") takes the FIFO timestamp scale from ts_sensitivity.
> That field is only filled in for parts that have freq_fine. The
> untagged-FIFO parts are left at zero:
>
> LSM6DS3
> LSM6DS3H
> LSM6DSL, LSM6DSM, ISM330DLC and LSM6DS3TR-C
>
> st_lsm6dsx_read_fifo() multiplies the raw counter by hw->ts_gain, so
> every sample is published with the timestamp taken when the buffer
> was enabled. The accelerometer and gyroscope values still update.
> Userspace that integrates attitude from the timestamp delta treats a
> stuck timestamp as dt = 0.
>
> Set ts_sensitivity to the previous fixed scale of 25000 ns/tick on
> those entries. They have no freq_fine register, so ts_trim_coeff is
> left unset and no trim is applied.
>
> Fixes: 8abbf45fcda0 ("iio: st_lsm6dsx: Fixed calibrated timestamp calculation")
> Cc: stable@vger.kernel.org
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
> Suggested-by: Lorenzo Bianconi <lorenzo@kernel.org>
> Suggested-by: Jonathan Cameron <jic23@kernel.org>
> Signed-off-by: Phil Williams <phil.williams@advisoft.co.nz>
> ---
> Resending inline. The first copy went out as an attachment.
> No code changes.
> ---
> Changes in v2:
> - Drop the ts_gain fallback in st_lsm6dsx_init_hw_timer() and set
> .ts_sensitivity = 25000 in the LSM6DS3, LSM6DS3H and LSM6DSL settings
> entries instead (Lorenzo, Jonathan).
> - Leave .ts_trim_coeff unset on those entries since they have no
> freq_fine register (Francesco).
> - Link to v1: https://lore.kernel.org/r/20261116-st-lsm6dsx-ts-fallback-v1-1-8ace30afbfb5@advisoft.co.nz
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index 823f8ac66..dffaf76b5 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -434,6 +434,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
> .addr = 0x09,
> .mask = GENMASK(5, 3),
> },
> + .ts_sensitivity = 25000,
> },
> .event_settings = {
> .sources = {
> @@ -601,6 +602,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
> .addr = 0x09,
> .mask = GENMASK(5, 3),
> },
> + .ts_sensitivity = 25000,
> },
> .event_settings = {
> .sources = {
> @@ -802,6 +804,7 @@ static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = {
> .addr = 0x09,
> .mask = GENMASK(5, 3),
> },
> + .ts_sensitivity = 25000,
> },
> .shub_settings = {
> .page_mux = {
>
> ---
> base-commit: fa2933aac170dd19c6a7f0d7b81a8f537e40915c
> change-id: 20261116-st-lsm6dsx-ts-fallback-cd21f1d1e30e
>
> Best regards,
> --
> Phil Williams <phil.williams@advisoft.co.nz>
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-25 8:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-24 23:15 [PATCH v2] iio: imu: st_lsm6dsx: set ts_sensitivity on parts without freq_fine Phil Williams via B4 Relay
2026-11-25 8:11 ` Lorenzo Bianconi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®