From: Jonathan Cameron <jic23@kernel.org>
To: Samuel Dionne-Riel <samuel@dionne-riel.com>
Cc: "Lorenzo Bianconi" <lorenzo@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: imu: lsm6dsx: Add alternative ACPI mount matrix retrieval
Date: Sat, 27 Dec 2025 18:00:06 +0000 [thread overview]
Message-ID: <20251227180006.139c64e2@jic23-huawei> (raw)
In-Reply-To: <20251223025351.3099978-4-samuel@dionne-riel.com>
On Mon, 22 Dec 2025 21:53:51 -0500
Samuel Dionne-Riel <samuel@dionne-riel.com> wrote:
> This uses the SLA0 matrix, which is how the SMOCF05 configuration
> exposes the mounting information for the accelerometer.
>
> On a limited sample size of one (1) unit, the SLG0 matrix is the
> identity matrix. It is unknown how the SLG0 mounting matrix would
> logically affect the data, if it differed from the identity matrix.
> After all, the IMU is mounted as one single unit, its mounting can't
> differ on the gyroscope compared to the accelerometer.
Hi Samuel
*sigh* More ACPI creativity. Thanks for your detailed investigation.
I'm a bit curious why they didn't use the ones Microsoft defined
for windows but otherwise fine to support this. A comment on the
approach below.
>
> Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index 49ac17806e720..4bf1f7f7552d1 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -2707,6 +2707,12 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
> return err;
> }
>
> + if (!iio_read_acpi_mount_matrix(hw->dev, &hw->orientation, "SLA0")) {
> + err = iio_read_mount_matrix(hw->dev, &hw->orientation);
Whilst this 'works' this internal call is pointless as we already did this
if there was not match on ROTM just off the context visible here.
I think the way to do this cleanly is probably to have an st_read_acpi_mount_matrix()
helper that tries ROTM and SLA0 in turn. Then have something like;
if(!st_read_acpi_mount_matrix(hw->dev, &hw->orientation)) {
err = iio_read_mount_matrix(hw->dev, &hw->orientation);
if (err)
return err;
}
> + if (err)
> + return err;
> + }
> +
> for (i = 0; i < ST_LSM6DSX_ID_MAX; i++) {
> if (!hw->iio_devs[i])
> continue;
next prev parent reply other threads:[~2025-12-27 18:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 2:53 [PATCH 0/2] iio: imu: lsm6dsx: Support SMOCF05 ACPI ID Samuel Dionne-Riel
2025-12-23 2:53 ` [PATCH 1/2] iio: imu: lsm6dsx: Support SMOCF05 ACPI ID for LSM6DS3TR-C Samuel Dionne-Riel
2025-12-28 17:18 ` Andy Shevchenko
2025-12-23 2:53 ` [PATCH 2/2] iio: imu: lsm6dsx: Add alternative ACPI mount matrix retrieval Samuel Dionne-Riel
2025-12-27 18:00 ` Jonathan Cameron [this message]
2025-12-28 17:21 ` Andy Shevchenko
2025-12-27 18:04 ` [PATCH 0/2] iio: imu: lsm6dsx: Support SMOCF05 ACPI ID Jonathan Cameron
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=20251227180006.139c64e2@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=nuno.sa@analog.com \
--cc=samuel@dionne-riel.com \
/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®