Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: imu: bmi323: Support loading of bmi323 driver for ASUS ROG ALLY
@ 2024-02-09 16:05 Jonathan LoBue
  2024-02-10 15:25 ` Jonathan Cameron
  0 siblings, 1 reply; 32+ messages in thread
From: Jonathan LoBue @ 2024-02-09 16:05 UTC (permalink / raw)
  To: jagathjog1996; +Cc: jic23, luke, dbenato.denis96, lkml, linux-iio

[-- Attachment #1: Type: text/plain, Size: 2889 bytes --]

Due to an ACPI match of "BOSC0200" and existing gyro drivers, the ASUS ROG ALLY attempts to incorrectly load the bmc150 driver.
This leaves the gyro inoperable for ASUS ROG ALLY. The correct gyro driver, bmi323, has already been upstreamed as part of the 6.8 kernel changes.
In order to load the correct bmi323 driver for ASUS ROG ALLY's gyro, this patch uses a DMI match to unhook the ASUS ROG ALLY from loading the bmc150 driver.
This unhooking is also added for the Ayaneo AIR Plus device, as requested by ChimeraOS devs.

---

--- a/drivers/iio/accel/bmc150-accel-core.c
+++ b/drivers/iio/accel/bmc150-accel-core.c
@@ -10,6 +10,7 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/acpi.h>
+#include <linux/dmi.h>
 #include <linux/of_irq.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
@@ -1670,6 +1671,9 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
 	struct iio_dev *indio_dev;
 	int ret;
 
+	if (dmi_match(DMI_BOARD_NAME, "RC71L") || (dmi_match(DMI_BOARD_NAME, "AB05-AMD") && dmi_match(DMI_PRODUCT_NAME, "AIR Plus")))
+		return -ENODEV; // Abort loading bmc150 for ASUS ROG ALLY, Ayaneo Air Plus
+
 	indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
 	if (!indio_dev)
 		return -ENOMEM;

---

Now, after this unhooking from bmc150, loading the correct bmi323 driver needs to occur. In order to accomplish this, an ACPI match table is added to bmi323.

---

--- a/drivers/iio/imu/bmi323/bmi323_i2c.c
+++ b/drivers/iio/imu/bmi323/bmi323_i2c.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2023, Jagath Jog J <jagathjog1996@gmail.com>
  */
 
+#include <linux/acpi.h>
 #include <linux/i2c.h>
 #include <linux/mod_devicetable.h>
 #include <linux/module.h>
@@ -93,6 +94,12 @@ static int bmi323_i2c_probe(struct i2c_c
 	return bmi323_core_probe(dev);
 }
 
+static const struct acpi_device_id bmi323_acpi_match[] = {
+	{"BOSC0200"},
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, bmi323_acpi_match);
+
 static const struct i2c_device_id bmi323_i2c_ids[] = {
 	{ "bmi323" },
 	{ }
@@ -109,6 +116,7 @@ static struct i2c_driver bmi323_i2c_driv
 	.driver = {
 		.name = "bmi323",
 		.of_match_table = bmi323_of_i2c_match,
+		.acpi_match_table = ACPI_PTR(bmi323_acpi_match),
 	},
 	.probe = bmi323_i2c_probe,
 	.id_table = bmi323_i2c_ids,

---

Patching these two files in this manner successfully accomplishes unhooking the ASUS ROG ALLY from the bmc150 driver and loading of the bmi323 driver.

Best Regards,
Jon LoBue

Co-developed-by: Jonathan LoBue <jlobue10@gmail.com>
Signed-off-by: Jonathan LoBue <jlobue10@gmail.com>
Co-developed-by: Luke D. Jones <luke@ljones.dev>
Signed-off-by: Luke D. Jones <luke@ljones.dev>
Co-developed-by: Denis Benato <dbenato.denis96@gmail.com>
Signed-off-by: Denis Benato <dbenato.denis96@gmail.com>
Co-developed-by: Antheas Kapenekakis <lkml@antheas.dev>
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2024-02-14 18:21 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-09 16:05 [PATCH] iio: imu: bmi323: Support loading of bmi323 driver for ASUS ROG ALLY Jonathan LoBue
2024-02-10 15:25 ` Jonathan Cameron
2024-02-10 16:23   ` Jonathan LoBue
2024-02-10 16:49     ` Jonathan Cameron
2024-02-10 20:43       ` Jonathan LoBue
2024-02-10 22:32         ` [PATCH 1/2] iio: accel: bmc150: ASUS ROG ALLY Abort Loading Jonathan LoBue
2024-02-11 17:04           ` Andy Shevchenko
2024-02-12  7:21             ` Jonathan LoBue
2024-02-12  9:46               ` Andy Shevchenko
2024-02-13  2:39                 ` [PATCH v1] iio: imu: bmi323: Add and enable ACPI Match Table Jonathan LoBue
2024-02-13 10:49                   ` Andy Shevchenko
2024-02-13 17:14                     ` Jonathan LoBue
2024-02-13 17:29                       ` Andy Shevchenko
2024-02-13 22:38                         ` [PATCH v2 1/2] iio: accel: bmc150: Duplicate ACPI entries Jonathan LoBue
2024-02-14  9:35                           ` Andy Shevchenko
2024-02-14 15:07                             ` Jonathan LoBue
2024-02-14 15:39                               ` Andy Shevchenko
2024-02-14 16:16                                 ` Jonathan Cameron
2024-02-13 22:39                         ` [PATCH v2 2/2] iio: imu: bmi323: Add and enable ACPI Match Table Jonathan LoBue
2024-02-14  9:39                           ` Andy Shevchenko
2024-02-14 15:15                             ` Jonathan LoBue
2024-02-14 15:31                               ` Andy Shevchenko
2024-02-14 17:35                                 ` Jonathan LoBue
2024-02-14 18:21                                   ` Andy Shevchenko
2024-02-14 16:19                           ` Jonathan Cameron
2024-02-13  2:47                 ` [PATCH 1/2] iio: accel: bmc150: ASUS ROG ALLY Abort Loading Jonathan LoBue
2024-02-10 22:34         ` [PATCH 2/2] iio: imu: bmi323: Add and enable ACPI Match Table Jonathan LoBue
2024-02-11 16:31           ` Jonathan Cameron
2024-02-11 17:08           ` Andy Shevchenko
2024-02-12  7:30             ` Jonathan LoBue
2024-02-12  9:50               ` Andy Shevchenko
2024-02-12 17:33                 ` Jonathan LoBue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox