[PATCH v2 2/2] iio: imu: lsm6dsx: Add alternative ACPI mount matrix retrieval

Samuel Dionne-Riel posted 2 patches 5 days, 6 hours ago
[PATCH v2 2/2] iio: imu: lsm6dsx: Add alternative ACPI mount matrix retrieval
Posted by Samuel Dionne-Riel 5 days, 6 hours ago
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.

The new `st_lsm6dsx_read_acpi_mount_matrix` function currently only
implements the *known* ACPI methods found in the wild, but the windows
driver seems to indicate more integration-specific methods could exist.

Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 9 ++++++++-
 1 file changed, 8 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 dc78227952a7c..2278cbf2b711f 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2635,6 +2635,13 @@ static int st_lsm6dsx_init_regulators(struct device *dev)
 	return 0;
 }
 
+static bool st_lsm6dsx_read_acpi_mount_matrix(struct device *dev,
+				      struct iio_mount_matrix *orientation)
+{
+	return iio_read_acpi_mount_matrix(dev, orientation, "ROTM") ||
+		iio_read_acpi_mount_matrix(dev, orientation, "SLA0");
+}
+
 int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
 		     struct regmap *regmap)
 {
@@ -2708,7 +2715,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
 			return err;
 	}
 
-	if (!iio_read_acpi_mount_matrix(hw->dev, &hw->orientation, "ROTM")) {
+	if (!st_lsm6dsx_read_acpi_mount_matrix(hw->dev, &hw->orientation)) {
 		err = iio_read_mount_matrix(hw->dev, &hw->orientation);
 		if (err)
 			return err;
-- 
2.51.0
Re: [PATCH v2 2/2] iio: imu: lsm6dsx: Add alternative ACPI mount matrix retrieval
Posted by Andy Shevchenko 3 days, 18 hours ago
On Sun, Feb 01, 2026 at 05:54:50PM -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.
> 
> The new `st_lsm6dsx_read_acpi_mount_matrix` function currently only

st_lsm6dsx_read_acpi_mount_matrix()

> implements the *known* ACPI methods found in the wild, but the windows

Windows

> driver seems to indicate more integration-specific methods could exist.

...

> +static bool st_lsm6dsx_read_acpi_mount_matrix(struct device *dev,
> +				      struct iio_mount_matrix *orientation)
> +{
> +	return iio_read_acpi_mount_matrix(dev, orientation, "ROTM") ||
> +		iio_read_acpi_mount_matrix(dev, orientation, "SLA0");

Indentation is incorrect.

> +}

-- 
With Best Regards,
Andy Shevchenko