From: Lorenzo Bianconi <lorenzo@kernel.org>
To: phil.williams@advisoft.co.nz
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Mario Tesi" <martepisa@gmail.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] iio: imu: st_lsm6dsx: fall back to 25 us/tick without a trim
Date: Mon, 16 Nov 2026 09:55:43 +0100 [thread overview]
Message-ID: <avrFD8e4UlKOB4NB@lore-desk> (raw)
In-Reply-To: <20261116-st-lsm6dsx-ts-fallback-v1-1-8ace30afbfb5@advisoft.co.nz>
[-- Attachment #1: Type: text/plain, Size: 2772 bytes --]
On Nov 16, Phil Williams via B4 Relay wrote:
> 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.
>
> These parts have no freq_fine register, so there is no trim to apply.
> Use the previous fixed scale of 25000 ns/tick when ts_sensitivity is
> unset. Entries that already set it are left alone.
>
> Fixes: 8abbf45fcda0 ("iio: st_lsm6dsx: Fixed calibrated timestamp calculation")
> Cc: stable@vger.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.
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 8 +++++++-
> 1 file changed, 7 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 823f8ac66..98db90a30 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -2525,8 +2525,14 @@ static int st_lsm6dsx_init_hw_timer(struct st_lsm6dsx_hw *hw)
> return err;
> }
>
> - /* calibrate timestamp sensitivity */
> + /*
> + * Parts with no freq_fine register have no trim and leave
> + * ts_sensitivity unset. Those parts used a fixed 25 us/tick.
> + * A zero gain publishes every FIFO sample with one timestamp.
> + */
> hw->ts_gain = ts_settings->ts_sensitivity;
> + if (!hw->ts_gain)
> + hw->ts_gain = 25000;
I guess the patch is fine but it seems a bit weird to set .ts_sensitivity to
25000 for ST_LSM6DSR_* family in st_lsm6dsx_sensor_settings array and keep this
chek here. Is it better to just add the missing info in
st_lsm6dsx_sensor_settings? (I do not have a strong opinion about it).
Regards,
Lorenzo
> if (ts_settings->freq_fine) {
> err = regmap_read(hw->regmap, ts_settings->freq_fine, &val);
> if (err < 0)
>
> ---
> 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 --]
prev parent reply other threads:[~2026-11-16 8:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-15 21:40 Phil Williams via B4 Relay
2026-11-16 8:55 ` Lorenzo Bianconi [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=avrFD8e4UlKOB4NB@lore-desk \
--to=lorenzo@kernel.org \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martepisa@gmail.com \
--cc=nuno.sa@analog.com \
--cc=phil.williams@advisoft.co.nz \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®