* [PATCH 0/1] iio: imu: bmi323: Use the new shared iio_read_acpi_mount_matrix() helper
@ 2024-05-23 17:47 Denis Benato
2024-05-23 17:47 ` [PATCH 1/1] iio: imu: bmi323: Use iio read_acpi_mount_matrix() helper Denis Benato
0 siblings, 1 reply; 3+ messages in thread
From: Denis Benato @ 2024-05-23 17:47 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Denis Benato, Jagath Jog J, Lars-Peter Clausen, Luke D . Jones,
Jonathan LoBue, linux-iio, linux-kernel
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(-)
--
2.44.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] iio: imu: bmi323: Use iio read_acpi_mount_matrix() helper
2024-05-23 17:47 [PATCH 0/1] iio: imu: bmi323: Use the new shared iio_read_acpi_mount_matrix() helper Denis Benato
@ 2024-05-23 17:47 ` Denis Benato
2024-05-26 12:24 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Denis Benato @ 2024-05-23 17:47 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Denis Benato, Jagath Jog J, Lars-Peter Clausen, Luke D . Jones,
Jonathan LoBue, linux-iio, linux-kernel
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.
Co-developed-by: Luke D. Jones <luke@ljones.dev>
Co-developed-by: Jonathan LoBue <jlobue10@gmail.com>
Signed-off-by: Denis Benato <benato.denis96@gmail.com>
---
drivers/iio/imu/bmi323/bmi323_core.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/imu/bmi323/bmi323_core.c b/drivers/iio/imu/bmi323/bmi323_core.c
index 5d42ab9b176a..b391e5e701b1 100644
--- a/drivers/iio/imu/bmi323/bmi323_core.c
+++ b/drivers/iio/imu/bmi323/bmi323_core.c
@@ -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;
--
2.44.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] iio: imu: bmi323: Use iio read_acpi_mount_matrix() helper
2024-05-23 17:47 ` [PATCH 1/1] iio: imu: bmi323: Use iio read_acpi_mount_matrix() helper Denis Benato
@ 2024-05-26 12:24 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2024-05-26 12:24 UTC (permalink / raw)
To: Denis Benato
Cc: Jagath Jog J, Lars-Peter Clausen, Luke D . Jones, Jonathan LoBue,
linux-iio, linux-kernel
On Thu, 23 May 2024 19:47:36 +0200
Denis Benato <benato.denis96@gmail.com> wrote:
> 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.
>
> Co-developed-by: Luke D. Jones <luke@ljones.dev>
> Co-developed-by: Jonathan LoBue <jlobue10@gmail.com>
> Signed-off-by: Denis Benato <benato.denis96@gmail.com>
Applied.
Thanks,
Jonathan
> ---
> drivers/iio/imu/bmi323/bmi323_core.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/imu/bmi323/bmi323_core.c b/drivers/iio/imu/bmi323/bmi323_core.c
> index 5d42ab9b176a..b391e5e701b1 100644
> --- a/drivers/iio/imu/bmi323/bmi323_core.c
> +++ b/drivers/iio/imu/bmi323/bmi323_core.c
> @@ -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;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-26 12:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-23 17:47 [PATCH 0/1] iio: imu: bmi323: Use the new shared iio_read_acpi_mount_matrix() helper Denis Benato
2024-05-23 17:47 ` [PATCH 1/1] iio: imu: bmi323: Use iio read_acpi_mount_matrix() helper Denis Benato
2024-05-26 12:24 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox