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.
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);
+ if (err)
+ return err;
+ }
+
for (i = 0; i < ST_LSM6DSX_ID_MAX; i++) {
if (!hw->iio_devs[i])
continue;
--
2.51.0
On Mon, Dec 22, 2025 at 09:53:51PM -0500, Samuel Dionne-Riel 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.
...
> --- 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);
> + if (err)
> + return err;
> + }
Seems that Accelerometer and Gyroscope have different methods, also the I²C
addresses and interrupt(s) are referring to the respective names in Vendor
Data fields. Perhaps that makes sense to also implement.
I,o,w, I don't think this patch is correct (place to put things in).
--
With Best Regards,
Andy Shevchenko
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;
© 2016 - 2026 Red Hat, Inc.