Skip to contentSkip to conversation

iio: imu: bmi323: Use the new shared iio_read_acpi_mount_matrix() helper

PATCH Applied Denis Benato 2 participants 3 messages May 23, 2024 – May 26, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover iio: imu: bmi323: Use the new shared iio_read_acpi_mount_matrix() helper

The default mount matrix (identity matrix) for the Asus RC71L is wrong: the correct one is defined in the ACPI ROTM object.

The introduction of the iio_read_acpi_mount_matrix() helper was originally meant to share a good implementation among two devices:
one of those is the bmc150 device. As pointed out previously the bmi323 is defined in the same way as the bmc150 on the ACPI, where ROTM can also be found.

I have confirmed this patch loads the correct mount matrix on my testing device.

Denis Benato (1):
iio: imu: bmi323: Use iio read_acpi_mount_matrix() helper

 drivers/iio/imu/bmi323/bmi323_core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.44.0
#1 lore raw

PATCH 1/1 iio: imu: bmi323: Use iio read_acpi_mount_matrix() helper

bmi150-accel and bmi323-imu are declared in an almost identical way in the ACPI and in some devices such as the Asus RC71L the "ROTM" property can be found: parse and use the ACPI-defined mount-matrix.

---
 drivers/iio/imu/bmi323/bmi323_core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iio/imu/bmi323/bmi323_core.c +5 -3
index 5d42ab9b176a..b391e5e701b1 100644
@@ -2083,9 +2083,11 @@ int bmi323_core_probe(struct device *dev)
 	if (ret)
 		return -EINVAL;
 
-	ret = iio_read_mount_matrix(dev, &data->orientation);
-	if (ret)
-		return ret;
+	if (!iio_read_acpi_mount_matrix(dev, &data->orientation, "ROTM")) {
+		ret = iio_read_mount_matrix(dev, &data->orientation);
+		if (ret)
+			return ret;
+	}
 
 	indio_dev->name = "bmi323-imu";
 	indio_dev->info = &bmi323_info;
Signature · 1 line
2.44.0
maintainer Applied
#2 lore raw

Re: [PATCH 1/1] iio: imu: bmi323: Use iio read_acpi_mount_matrix() helper

Quoted 5 lines · On Thu, 23 May 2024 19:47:36 +0200 Denis Benato <[email protected]>…

bmi150-accel and bmi323-imu are declared in an almost identical way in the ACPI and in some devices such as the Asus RC71L the "ROTM" property can be found: parse and use the ACPI-defined mount-matrix.

Applied.

Thanks,

Jonathan

Quoted 23 lines
---
 drivers/iio/imu/bmi323/bmi323_core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iio/imu/bmi323/bmi323_core.c +5 -3
index 5d42ab9b176a..b391e5e701b1 100644
@@ -2083,9 +2083,11 @@ int bmi323_core_probe(struct device *dev)
 	if (ret)
 		return -EINVAL;
 
-	ret = iio_read_mount_matrix(dev, &data->orientation);
-	if (ret)
-		return ret;
+	if (!iio_read_acpi_mount_matrix(dev, &data->orientation, "ROTM")) {
+		ret = iio_read_mount_matrix(dev, &data->orientation);
+		if (ret)
+			return ret;
+	}
 
 	indio_dev->name = "bmi323-imu";
 	indio_dev->info = &bmi323_info;