iio: imu: bmi323: Support loading of bmi323 driver for ASUS ROG ALLY
Subsystems (3)
PATCH 1/1 iio: imu: bmi323: Support loading of bmi323 driver for ASUS ROG ALLY
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.
---
drivers/iio/accel/bmc150-accel-core.c +4 -0
@@ -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.
---
drivers/iio/imu/bmi323/bmi323_i2c.c +8 -0
@@ -5,6 +5,7 @@* Copyright (C) 2023, Jagath Jog J <[email protected]> */ +#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_creturn 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
Jonathan Cameron
maintainerQuoted 5 lines · On Fri, 09 Feb 2024 08:05:14 -0800 Jonathan LoBue <[email protected]> wrote:
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.
Please reformat as a patch as per the documentation for submitting patches. Wrap the lines to 75 chars in the description.
Quoted 1 line
---
The cut lines affect what git will pick up and I don't think that's your intent.
More generally I'd just like to confirm I have understood the correctly. We have two incompatible devices advertised with the same ACPI ID? If anyone has contacts with Bosch or Asus can we chase down how this happened and preferably point out to them that it causes problems if they through device that don't have actually compatible register sets into the same ID.
I assume this occurred because there is some hyrda of a driver on windows that copes with all sorts of different Bosch devices.
It's a valid bosch ID - I've no idea how bosch issues these but normal practice is one per device interface (so if a device register compatible you can share an ID, not otherwise). They have lots of ID space (and can trivially get more if they need it)...
Solution wise, I'm not keen on having having a DMI check against particular boards. Possibly we can add another driver that binds just to the BOSCH ID and does just enough querying of the part ID (not the identify of the board) to figure out what it is and kick of probing the right driver.
Andy, you see more of this mess I think than anyway, any thoughts on how to handle this elegantly?
Jonathan
Quoted 67 lines
drivers/iio/accel/bmc150-accel-core.c +4
-1@@ -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.
---
drivers/iio/imu/bmi323/bmi323_i2c.c +8
-1@@ -5,6 +5,7 @@* Copyright (C) 2023, Jagath Jog J <[email protected]> */ +#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_creturn 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
Quoted 8 lines
Co-developed-by Jonathan LoBue <[email protected]>Signed-off-by Jonathan LoBue <[email protected]>Co-developed-by Luke D. Jones <[email protected]>Signed-off-by Luke D. Jones <[email protected]>Co-developed-by Denis Benato <[email protected]>Signed-off-by Denis Benato <[email protected]>Co-developed-by Antheas Kapenekakis <[email protected]>Signed-off-by Antheas Kapenekakis <[email protected]>
As above, look up how to submit a kernel patch.
https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html
Thanks,
Jonathan
Quoted 120 lines · PST Jonathan Cameron
Quoted 5 lines · On Fri, 09 Feb 2024 08:05:14 -0800 Jonathan LoBue <[email protected]> wrote:
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.
Please reformat as a patch as per the documentation for submitting patches. Wrap the lines to 75 chars in the description.
Quoted 1 line
---
The cut lines affect what git will pick up and I don't think that's your intent.
More generally I'd just like to confirm I have understood the correctly. We have two incompatible devices advertised with the same ACPI ID? If anyone has contacts with Bosch or Asus can we chase down how this happened and preferably point out to them that it causes problems if they through device that don't have actually compatible register sets into the same ID.
I assume this occurred because there is some hyrda of a driver on windows that copes with all sorts of different Bosch devices.
It's a valid bosch ID - I've no idea how bosch issues these but normal practice is one per device interface (so if a device register compatible you can share an ID, not otherwise). They have lots of ID space (and can trivially get more if they need it)...
Solution wise, I'm not keen on having having a DMI check against particular boards. Possibly we can add another driver that binds just to the BOSCH ID and does just enough querying of the part ID (not the identify of the board) to figure out what it is and kick of probing the right driver.
Andy, you see more of this mess I think than anyway, any thoughts on how to handle this elegantly?
Jonathan
Quoted 67 lines
drivers/iio/accel/bmc150-accel-core.c +4
-1@@ -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.
---
drivers/iio/imu/bmi323/bmi323_i2c.c +8
-1@@ -5,6 +5,7 @@* Copyright (C) 2023, Jagath Jog J <[email protected]> */ +#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_creturn 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 LoBueQuoted 8 lines
Co-developed-by Jonathan LoBue <[email protected]>Signed-off-by Jonathan LoBue <[email protected]>Co-developed-by Luke D. Jones <[email protected]>Signed-off-by Luke D. Jones <[email protected]>Co-developed-by Denis Benato <[email protected]>Signed-off-by Denis Benato <[email protected]>Co-developed-by Antheas Kapenekakis <[email protected]>Signed-off-by Antheas Kapenekakis <[email protected]>As above, look up how to submit a kernel patch.
Quoted 5 lines
https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html
Thanks,
Jonathan
Thank you for the feedback. I will work to fix the formatting. I must have made a mistake somewhere. I was referring to that exact website while doing this. The original source for the patch is here: https://github.com/jlobue10/ALLY_Nobara_fixes/raw/main/0003-iio-imu_Add_ROG_ALLY_bmi323-support.patch . Several Linux distros have been unofficially using it for a while now that I know of (Nobara, Bazzite, Manjaro, ChimeraOS soon).
I will fix that in a future reply. I normally use git diff and perhaps made a mistake trying to do the diff -up method instead. I will fix it. I understand that other canonical parts may be missing too. This will also be fixed in a future reply.
I completely agree with your assessment. This proposed patch is really meant as a temporary "band-aid" solution.
There should be consensus reached about a better long term solution going forward.
Needing to do the DMI match and abort the loading of the bmc150 driver for ASUS ROG ALLY is a symptom of a larger problem.
The generic identifier "BOSC0200" is not adequate when referring to multiple different devices that the kernel wants to load, which then happens on a first come basis. I think a better identifier in this case would be something like "BMI323" but this decision should be left up to BOSCH (and ASUS in this case). The problem is that these identifiers don't really matter for the Windows' side drivers so manufacturers give them little to no extra thought or consideration. There needs to be some agreement or consensus reached by the manufacturers in this regard. This is a much larger problem with several gyro drivers. I've had this conversation before and confirmed the larger issue with some ChimeraOS devs. Thanks.
Best Regards,
Jon LoBue
Jonathan Cameron
maintainerQuoted 133 lines · On Sat, 10 Feb 2024 08:23:00 -0800 Jonathan LoBue <[email protected]> wrote:
Quoted 120 lines · PST Jonathan Cameron
Quoted 5 lines · On Fri, 09 Feb 2024 08:05:14 -0800 Jonathan LoBue <[email protected]> wrote:
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.
Please reformat as a patch as per the documentation for submitting patches. Wrap the lines to 75 chars in the description.
Quoted 1 line
---
The cut lines affect what git will pick up and I don't think that's your intent.
More generally I'd just like to confirm I have understood the correctly. We have two incompatible devices advertised with the same ACPI ID? If anyone has contacts with Bosch or Asus can we chase down how this happened and preferably point out to them that it causes problems if they through device that don't have actually compatible register sets into the same ID.
I assume this occurred because there is some hyrda of a driver on windows that copes with all sorts of different Bosch devices.
It's a valid bosch ID - I've no idea how bosch issues these but normal practice is one per device interface (so if a device register compatible you can share an ID, not otherwise). They have lots of ID space (and can trivially get more if they need it)...
Solution wise, I'm not keen on having having a DMI check against particular boards. Possibly we can add another driver that binds just to the BOSCH ID and does just enough querying of the part ID (not the identify of the board) to figure out what it is and kick of probing the right driver.
Andy, you see more of this mess I think than anyway, any thoughts on how to handle this elegantly?
Jonathan
Quoted 67 lines
drivers/iio/accel/bmc150-accel-core.c +4
-1@@ -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.
---
drivers/iio/imu/bmi323/bmi323_i2c.c +8
-1@@ -5,6 +5,7 @@* Copyright (C) 2023, Jagath Jog J <[email protected]> */ +#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_creturn 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 LoBueQuoted 8 lines
Co-developed-by Jonathan LoBue <[email protected]>Signed-off-by Jonathan LoBue <[email protected]>Co-developed-by Luke D. Jones <[email protected]>Signed-off-by Luke D. Jones <[email protected]>Co-developed-by Denis Benato <[email protected]>Signed-off-by Denis Benato <[email protected]>Co-developed-by Antheas Kapenekakis <[email protected]>Signed-off-by Antheas Kapenekakis <[email protected]>As above, look up how to submit a kernel patch.
Quoted 5 lines
https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html
Thanks,
Jonathan
Thank you for the feedback. I will work to fix the formatting. I must have made a mistake somewhere. I was referring to that exact website while doing this. The original source for the patch is here: https://github.com/jlobue10/ALLY_Nobara_fixes/raw/main/0003-iio-imu_Add_ROG_ALLY_bmi323-support.patch . Several Linux distros have been unofficially using it for a while now that I know of (Nobara, Bazzite, Manjaro, ChimeraOS soon).
I will fix that in a future reply. I normally use git diff and perhaps made a mistake trying to do the diff -up method instead. I will fix it. I understand that other canonical parts may be missing too. This will also be fixed in a future reply.
Quoted 5 lines
I completely agree with your assessment. This proposed patch is really meant as a temporary "band-aid" solution.
There should be consensus reached about a better long term solution going forward.
Needing to do the DMI match and abort the loading of the bmc150 driver for ASUS ROG ALLY is a symptom of a larger problem.
The generic identifier "BOSC0200" is not adequate when referring to multiple different devices that the kernel wants to load, which then happens on a first come basis. I think a better identifier in this case would be something like "BMI323" but this decision should be left up to BOSCH (and ASUS in this case).
It needs to be a compliant ACPI ID. BOSC is Bosch's valid manufacturer ID. The code after that tends to just be allocated by someone inside the company who keeps a bit list of IDs (I have access to the list of HiSilicon HISIXXXX ones for example but no idea how Bosch manages this.)
Quoted 3 lines
The problem is that these identifiers don't really matter for the Windows' side drivers so manufacturers give them little to no extra thought or consideration. There needs to be some agreement or consensus reached by the manufacturers in this regard. This is a much larger problem with several gyro drivers. I've had this conversation before and confirmed the larger issue with some ChimeraOS devs. Thanks.
Sure. Please also wrap your emails to the mailing list to under 80 chars (roughly).
Quoted 3 lines
Best Regards,
Jon LoBue
Quoted 4 lines
It needs to be a compliant ACPI ID. BOSC is Bosch's valid manufacturer ID. The code after that tends to just be allocated by someone inside the company who keeps a bit list of IDs (I have access to the list of HiSilicon HISIXXXX ones for example but no idea how Bosch manages this.)
Understood. So if there isn't already a valid and unique identifier for the BMI323 chip, then BOSCH must come up with one in that BOSCXXXX format. Then ASUS should update the ACPI table with a BIOS update to use the proper code for the BOSCH BMI323 chip. This is certainly the better long-term solution. As it stands now, this proposed patch will get around the current problem. If and when BOSCH and ASUS update the identifier, then the first portion of this patch (unhooking from bmc150) could be removed. Then the ACPI match table added in the BMI323 driver would just need to be updated to reflect the proper code for the BOSCH BMI323 chip.
Quoted 1 line
Sure. Please also wrap your emails to the mailing list to under 80 chars (roughly).
Yes, sorry. Thank you for the guidance.
Best Regards,
Jon LoBue
PATCH 1/2 iio: accel: bmc150: ASUS ROG ALLY Abort Loading
From 0aed4d398be185d43b92db63693bb1c5c6a8a78b Mon Sep 17 00:00:00 2001
From: Jonathan LoBue <[email protected]>
Date: Sat, 10 Feb 2024 12:28:35 -0800
Subject: [PATCH 1/2] iio: accel: bmc150: ASUS ROG ALLY Abort Loading
This portion of the patch series aborts the loading of the bmc150 driver upon DMI board match for ASUS ROG ALLY and Ayaneo Air Plus (requested by ChimeraOS dev).
--- drivers/iio/accel/bmc150-accel-core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/iio/accel/bmc150-accel-core.c +4 -0
@@ -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 ;
Signature · 1 line
2.43.0
Re: [PATCH 1/2] iio: accel: bmc150: ASUS ROG ALLY Abort Loading
Quoted 5 lines · Jonathan LoBue
From
0aed4d398be185d43b92db63693bb1c5c6a8a78bMon Sep 17 00:00:00 2001
From: Jonathan LoBue <[email protected]>
Date: Sat, 10 Feb 2024 12:28:35 -0800
Subject: [PATCH 1/2] iio: accel: bmc150: ASUS ROG ALLY Abort Loading
Something went wrong, please use git send-email ... to send patches.
Quoted 3 lines
This portion of the patch series aborts the loading of the bmc150 driver upon DMI board match for ASUS ROG ALLY and Ayaneo Air Plus (requested by ChimeraOS dev).
...
drivers/iio/accel/bmc150-accel-core.c int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq, · line 1675
Quoted 2 lines
drivers/iio/accel/bmc150-accel-core.c +2
-0+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
Please, make this as the proper table (see many examples in drivers/platform/x86/ folder on how to do that).
...
Speaking of the PDx86 subsystem, OTOH maybe we want the quirk patch to be outside of IIO and enumerate the IIO drivers based on i2c/spi ID tables (there are also examples unde PDx86 folder for such tricks).
Hans, Ilpo, what do you think? (Jonathan, please also include Hans in the similar cases in the future with ACPI IDs and related ambiguity.)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 1/2] iio: accel: bmc150: ASUS ROG ALLY Abort Loading
Quoted 1 line · PST Andy Shevchenko
Something went wrong, please use
git send-email ...to send patches.
Will do once I can test the suggested updated table method.
Quoted 2 lines
Please, make this as the proper table (see many examples in
drivers/platform/x86/folder on how to do that).
This DMI board match and aborting of loading the driver is hopefully a temporary portion of this patch. The ideal fix is that BOSCH informs ASUS and other system builders of the proper and unique BOSCXXXX identifier so that BIOSes can be updated with those and this portion of the patch can be removed. As it stands now, this is the "band-aid" workaround of having conflicting (same) IDs for different chips.
Best Regards,
Jon LoBue
Re: [PATCH 1/2] iio: accel: bmc150: ASUS ROG ALLY Abort Loading
Quoted 9 lines · Jonathan LoBue
Quoted 1 line · PST Andy Shevchenko
Something went wrong, please use
git send-email ...to send patches.Will do once I can test the suggested updated table method.
Quoted 2 lines
Please, make this as the proper table (see many examples in
drivers/platform/x86/folder on how to do that).
Quoted 6 lines
This DMI board match and aborting of loading the driver is hopefully a temporary portion of this patch. The ideal fix is that BOSCH informs ASUS and other system builders of the proper and unique BOSCXXXX identifier so that BIOSes can be updated with those and this portion of the patch can be removed. As it stands now, this is the "band-aid" workaround of having conflicting (same) IDs for different chips.
Even if fixed (which has to be done anyway) it can be undone in old firmwares — there is no solution to make all affected users update firmware. Do we have real products on the market with the wrong ID (I assume we do)?
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 1/1 iio: imu: bmi323: Add and enable ACPI Match Table
This patch adds the ACPI match table for ASUS ROG ALLY to load the bmi323 driver with an ACPI match of "BOSC0200".
--- drivers/iio/imu/bmi323/bmi323_i2c.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/iio/imu/bmi323/bmi323_i2c.c +7 -0
@@ -93,6 +93,12 @@ static int bmi323_i2c_probe(struct i2c_client *i2c)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 +115,7 @@ static struct i2c_driver bmi323_i2c_driver = { .driver = { .name = "bmi323", .of_match_table = bmi323_of_i2c_match, + .acpi_match_table = bmi323_acpi_match, }, .probe = bmi323_i2c_probe, .id_table = bmi323_i2c_ids,
Signature · 1 line
2.43.0
Re: [PATCH v1] iio: imu: bmi323: Add and enable ACPI Match Table
Quoted 5 lines · Jonathan LoBue
This patch adds the ACPI match table for ASUS ROG ALLY to load the bmi323 driver with an ACPI match of "BOSC0200".
---
I'm lost. You sent a lot of patches / patch series all of which are v1. Can you:
- use versioning (git format-patch -v<X>..., where <X> is a plain version number)
- add a changelog here (after the cutter '---' line) to explain the history of the changes
?
...
drivers/iio/imu/bmi323/bmi323_i2c.c static int bmi323_i2c_probe(struct i2c_client *i2c) · line 99
Quoted 4 lines
drivers/iio/imu/bmi323/bmi323_i2c.c +4
-0+static const struct acpi_device_id bmi323_acpi_match[] = { + {"BOSC0200" }, + { } +};
Since there is a collision please add a big comment in _both_ drivers before such ID to explain what's going on.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v1] iio: imu: bmi323: Add and enable ACPI Match Table
Quoted 6 lines · PST Andy Shevchenko
I'm lost. You sent a lot of patches / patch series all of which are v1. Can you:
- use versioning (git format-patch -v<X>..., where <X> is a plain version number)
- add a changelog here (after the cutter '---' line) to explain the history of the changes
?
Yes, I will do this. The changes so far included dropping the no longer necessary DMI quirks portion in the bmc150 driver. I understand from your comment that we want to add a comment in the bmc150 driver though to explain what is going on with duplicate ACPI identifiers in different drivers. I will add a similar comment in the bmi323 driver. The changes so far also included the fixes that you requested earlier in bmi323:
dropping the duplicate header include entry (included already in other header file), removing the unnecessary comma in the ACPI match table portion, and removing the ACPI_PTR when invoking the ACPI match table.
Quoted 2 lines
Since there is a collision please add a big comment in _both_ drivers before such ID to explain what's going on.
I will do this and add a changelog after the cutter as requested. Since there are some changes from my initial submission attempt and with the additional requested comments, is v2 going to be okay to use so there's no ambiguity about which patch version to use? I will attach the version label with git format-patch as requested. Thanks.
Best Regards,
Jon LoBue
Re: [PATCH v1] iio: imu: bmi323: Add and enable ACPI Match Table
Quoted 18 lines · Jonathan LoBue
Quoted 6 lines · PST Andy Shevchenko
I'm lost. You sent a lot of patches / patch series all of which are v1. Can you:
- use versioning (git format-patch -v<X>..., where <X> is a plain version number)
- add a changelog here (after the cutter '---' line) to explain the history of the changes
?Yes, I will do this. The changes so far included dropping the no longer necessary DMI quirks portion in the bmc150 driver. I understand from your comment that we want to add a comment in the bmc150 driver though to explain what is going on with duplicate ACPI identifiers in different drivers. I will add a similar comment in the bmi323 driver. The changes so far also included the fixes that you requested earlier in bmi323:
dropping the duplicate header include entry (included already in other header file), removing the unnecessary comma in the ACPI match table portion, and removing theACPI_PTRwhen invoking the ACPI match table.
Quoted 7 lines
Quoted 2 lines
Since there is a collision please add a big comment in _both_ drivers before such ID to explain what's going on.
I will do this and add a changelog after the cutter as requested. Since there are some changes from my initial submission attempt and with the additional requested comments, is v2 going to be okay to use so there's no ambiguity about which patch version to use?
Sounds good as we seem never to have seen v2 on the topic.
Quoted 2 lines
I will attach the version label with
git format-patch as requested. Thanks.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 1/2 iio: accel: bmc150: Duplicate ACPI entries
This patch adds a description of the duplicate ACPI identifier issue between devices using bmc150 and bmi323.
---
Comment describing the duplicate ACPI identifier issue has been added before the "BOSC0200" entry here.
drivers/iio/accel/bmc150-accel-i2c.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/iio/accel/bmc150-accel-i2c.c +12 -0
@@ -13,6 +13,18 @@#include "bmc150-accel.h" +/* +* The "BOSC0200" ACPI identifier used here in the bmc150 driver is not +* unique to devices using bmc150. The same "BOSC0200" identifier is found +* in the ACPI tables of the ASUS ROG ALLY and Ayaneo AIR Plus which both +* use a Bosch BMI323 chip. This creates a conflict with duplicate ACPI +* identifiers which multiple drivers want to use. Fortunately, when the +* bmc150 driver starts to load on the ASUS ROG ALLY, the chip id check +* portion fails (correctly) and a dmesg output similar to this: +* "bmc150_accel_i2c i2c-BOSC0200:00: Invalid chip 0" can be seen. +* This allows the bmi323 driver to take over for ASUS ROG ALLY. +*/ +#ifdef CONFIG_ACPI static const struct acpi_device_id bmc150_acpi_dual_accel_ids[] = { {"BOSC0200"},
Signature · 1 line
2.43.0
Re: [PATCH v2 1/2] iio: accel: bmc150: Duplicate ACPI entries
Quoted 3 lines · Jonathan LoBue
This patch adds a description of the duplicate ACPI identifier issue between devices using bmc150 and bmi323.
With the remarks below,
(carry the tag if you send a new version)
...
Quoted 2 lines
Comment describing the duplicate ACPI identifier issue has been added before the "BOSC0200" entry here.
Hmm...
...
Quoted 2 lines
+/*
+ * The "BOSC0200" ACPI identifier used here in the bmc150 driver is not
s/ACPI//
s/in the bmc150 driver//
Quoted 4 lines
+ * unique to devices using bmc150. The same "BOSC0200" identifier is found
+ * in the ACPI tables of the ASUS ROG ALLY and Ayaneo AIR Plus which both
+ * use a Bosch BMI323 chip. This creates a conflict with duplicate ACPI
+ * identifiers which multiple drivers want to use. Fortunately, when the
Quoted 8 lines
+ * bmc150 driver starts to load on the ASUS ROG ALLY, the chip id check
+ * portion fails (correctly) and a dmesg output similar to this:
+ * "bmc150_accel_i2ci2c-BOSC0200:00: Invalid chip 0" can be seen.
+ * This allows the bmi323 driver to take over for ASUS ROG ALLY.
+ */
+
#ifdefCONFIG_ACPI
static const structacpi_device_idbmc150_acpi_dual_accel_ids[] = {
...it should be here. But don't resend, let's Jonathan to decide in case he won't amend this when applying.
Quoted 1 line
{"BOSC0200"},Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 1/2] iio: accel: bmc150: Duplicate ACPI entries
Quoted 10 lines · PST Andy Shevchenko
Quoted 3 lines · Jonathan LoBue
This patch adds a description of the duplicate ACPI identifier issue between devices using bmc150 and bmi323.
With the remarks below,
Reviewed-by Andy Shevchenko <[email protected]>(carry the tag if you send a new version)
...
Will do.
Quoted 4 lines
Quoted 2 lines
Comment describing the duplicate ACPI identifier issue has been added before the "BOSC0200" entry here.
Hmm...
You asked for a changelog after the cutter, although it really seems unnecessary to me here as it's repetitive in nature with comment above.
Quoted 6 lines
Quoted 2 lines
+/*
+ * The "BOSC0200" ACPI identifier used here in the bmc150 driver is nots/ACPI//
s/in the bmc150 driver//
So update the first sentence in the comment to be:
The "BOSC0200" identifier used here is not...
?
Quoted 13 lines
Quoted 4 lines
+ * unique to devices using bmc150. The same "BOSC0200" identifier is found
+ * in the ACPI tables of the ASUS ROG ALLY and Ayaneo AIR Plus which both
+ * use a Bosch BMI323 chip. This creates a conflict with duplicate ACPI
+ * identifiers which multiple drivers want to use. Fortunately, when theQuoted 8 lines
+ * bmc150 driver starts to load on the ASUS ROG ALLY, the chip id check
+ * portion fails (correctly) and a dmesg output similar to this:
+ * "bmc150_accel_i2ci2c-BOSC0200:00: Invalid chip 0" can be seen.
+ * This allows the bmi323 driver to take over for ASUS ROG ALLY.
+ */
+
#ifdefCONFIG_ACPI
static const structacpi_device_idbmc150_acpi_dual_accel_ids[] = {
Quoted 4 lines
...it should be here. But don't resend, let's Jonathan to decide in case he won't amend this when applying.
Quoted 1 line
{"BOSC0200"},
This seems to be a stylistic preference on whether or not to include this long comment inside of the ACPI match table or not. Stylistically, my preference would be to include it directly above the match table and not inside of it. I will wait for Jonathan Cameron's comments about what to do here.
Best Regards,
Jon LoBue
Re: [PATCH v2 1/2] iio: accel: bmc150: Duplicate ACPI entries
Quoted 2 lines · Jonathan LoBue
Quoted 1 line · PST Andy Shevchenko
On Wed, Feb 14, 2024 at 12:38 AM Jonathan LoBue <[email protected]> wrote:
...
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Comment describing the duplicate ACPI identifier issue has been added before the "BOSC0200" entry here.
Hmm...
You asked for a changelog after the cutter, although it really seems unnecessary to me here as it's repetitive in nature with comment above.
This is fine and needed. My comment was about the actual placement of the comment (should be immediately before the ID entry and not detached from it.
...
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
+ * The "BOSC0200" ACPI identifier used here in the bmc150 driver is not
s/ACPI//
s/in the bmc150 driver//So update the first sentence in the comment to be:
The "BOSC0200" identifier used here is not...
?
Yes.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
+ * unique to devices using bmc150. The same "BOSC0200" identifier is found
+ * in the ACPI tables of the ASUS ROG ALLY and Ayaneo AIR Plus which both
+ * use a Bosch BMI323 chip. This creates a conflict with duplicate ACPI
+ * identifiers which multiple drivers want to use. Fortunately, when the
+ * bmc150 driver starts to load on the ASUS ROG ALLY, the chip id check
+ * portion fails (correctly) and a dmesg output similar to this:
+ * "bmc150_accel_i2ci2c-BOSC0200:00: Invalid chip 0" can be seen.
+ * This allows the bmi323 driver to take over for ASUS ROG ALLY.
...
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
static const struct
acpi_device_idbmc150_acpi_dual_accel_ids[] = {...it should be here. But don't resend, let's Jonathan to decide in case he won't amend this when applying.
Quoted 7 lines
Quoted 1 line
Quoted 1 line
{"BOSC0200"},This seems to be a stylistic preference on whether or not to include this long comment inside of the ACPI match table or not. Stylistically, my preference would be to include it directly above the match table and not inside of it. I will wait for Jonathan Cameron's comments about what to do here.
In my p.o.v. it's not stylic as we refer to the exact ID and having comment detached is, besides being unusual, may go outdated too quickly as code is being grown and developed. So, I really want it to be closer to the ID entry.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 1/2] iio: accel: bmc150: Duplicate ACPI entries
Quoted 57 lines · On Wed, 14 Feb 2024 17:39:53 +0200 Andy Shevchenko <[email protected]>…
Quoted 2 lines · Jonathan LoBue
Quoted 1 line · PST Andy Shevchenko
On Wed, Feb 14, 2024 at 12:38 AM Jonathan LoBue <[email protected]> wrote:
...
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Comment describing the duplicate ACPI identifier issue has been added before the "BOSC0200" entry here.
Hmm...
You asked for a changelog after the cutter, although it really seems unnecessary to me here as it's repetitive in nature with comment above.
This is fine and needed. My comment was about the actual placement of the comment (should be immediately before the ID entry and not detached from it.
...
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
+ * The "BOSC0200" ACPI identifier used here in the bmc150 driver is not
s/ACPI//
s/in the bmc150 driver//So update the first sentence in the comment to be:
The "BOSC0200" identifier used here is not...
?Yes.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
+ * unique to devices using bmc150. The same "BOSC0200" identifier is found
+ * in the ACPI tables of the ASUS ROG ALLY and Ayaneo AIR Plus which both
+ * use a Bosch BMI323 chip. This creates a conflict with duplicate ACPI
+ * identifiers which multiple drivers want to use. Fortunately, when the
+ * bmc150 driver starts to load on the ASUS ROG ALLY, the chip id check
+ * portion fails (correctly) and a dmesg output similar to this:
+ * "bmc150_accel_i2ci2c-BOSC0200:00: Invalid chip 0" can be seen.
+ * This allows the bmi323 driver to take over for ASUS ROG ALLY....
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
static const struct
acpi_device_idbmc150_acpi_dual_accel_ids[] = {...it should be here. But don't resend, let's Jonathan to decide in case he won't amend this when applying.
Quoted 7 lines
Quoted 1 line
Quoted 1 line
{"BOSC0200"},This seems to be a stylistic preference on whether or not to include this long comment inside of the ACPI match table or not. Stylistically, my preference would be to include it directly above the match table and not inside of it. I will wait for Jonathan Cameron's comments about what to do here.
Quoted 4 lines
In my p.o.v. it's not stylic as we refer to the exact ID and having comment detached is, besides being unusual, may go outdated too quickly as code is being grown and developed. So, I really want it to be closer to the ID entry.
Yes, please send a v3 with it next to the relevant ID. Also dont send new versions in reply to old ones. For IIO patches at least, a new thread every time please.
Quoted 1 line
PATCH v2 2/2 iio: imu: bmi323: Add and enable ACPI Match Table
In reply to Andy ShevchenkoThis patch adds the ACPI match table for ASUS ROG ALLY to load the bmi323 driver with an ACPI match of "BOSC0200".
---
Formatting fixes, removed duplicate header, and removed ACPI_PTR from previous submission.
Added an explanation of the duplicate ACPI identifier issue between devices using bmc150 and bmi323.
drivers/iio/imu/bmi323/bmi323_i2c.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/iio/imu/bmi323/bmi323_i2c.c +20 -0
@@ -93,6 +93,25 @@ static int bmi323_i2c_probe(struct i2c_client *i2c)return bmi323_core_probe (dev); } +/* +* The "BOSC0200" ACPI identifier used here in the bmi323 driver is not +* unique to bmi323 devices. The same "BOSC0200" identifier is found in +* devices using the bmc150 chip. This creates a conflict with duplicate +* ACPI identifiers which multiple drivers want to use. If a non-bmi323 +* device starts to load with this "BOSC0200" ACPI match here, then the +* chip id check portion should fail and the driver should relinquish the +* device. If and when a different driver (such as bmc150) starts to load +* with the "BOSC0200" ACPI match, a short reset should ensure that the +* device is not in a bad state during that driver initialization. This +* device reset does occur in both the bmi323 and bmc150 init sequences. +*/ + +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 +128,7 @@ static struct i2c_driver bmi323_i2c_driver = { .driver = { .name = "bmi323", .of_match_table = bmi323_of_i2c_match, + .acpi_match_table = bmi323_acpi_match, }, .probe = bmi323_i2c_probe, .id_table = bmi323_i2c_ids,
Signature · 1 line
2.43.0
Re: [PATCH v2 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
Quoted 3 lines · Jonathan LoBue
This patch adds the ACPI match table for ASUS ROG ALLY to load the bmi323 driver with an ACPI match of "BOSC0200".
With the remarks below,
(carry the tag if you send a new version)
...
The below comment...
Quoted 2 lines
+/*
+ * The "BOSC0200" ACPI identifier used here in the bmi323 driver is not
s/ACPI//
s/in the bmi323 driver//
Quoted 6 lines
+ * unique to bmi323 devices. The same "BOSC0200" identifier is found in
+ * devices using the bmc150 chip. This creates a conflict with duplicate
+ * ACPI identifiers which multiple drivers want to use. If a non-bmi323
+ * device starts to load with this "BOSC0200" ACPI match here, then the
+ * chip id check portion should fail and the driver should relinquish the
+ * device.
This seems different wording to the other one. Have you looked at the code if it's indeed the case? Because we may not rely on the module load order.
drivers/iio/imu/bmi323/bmi323_i2c.c static int bmi323_i2c_probe(struct i2c_client *i2c) · line 109
Quoted 7 lines
If and when a different driver (such as bmc150) starts to load
+ * with the "BOSC0200" ACPI match, a short reset should ensure that the
+ * device is not in a bad state during that driver initialization. This
+ * device reset does occur in both the bmi323 and bmc150 init sequences.
+ */drivers/iio/imu/bmi323/bmi323_i2c.c +2
-0+ +static const struct acpi_device_id bmi323_acpi_match[] = {
...should be here (and indented accordingly).
Quoted 3 lines
drivers/iio/imu/bmi323/bmi323_i2c.c +3
-0+ { "BOSC0200" }, + { } +};
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
Quoted 11 lines · PST Andy Shevchenko
Quoted 3 lines · Jonathan LoBue
This patch adds the ACPI match table for ASUS ROG ALLY to load the bmi323 driver with an ACPI match of "BOSC0200".
With the remarks below,
Reviewed-by Andy Shevchenko <[email protected]>(carry the tag if you send a new version)
...
Quoted 7 lines
The below comment...
Quoted 2 lines
+/*
+ * The "BOSC0200" ACPI identifier used here in the bmi323 driver is nots/ACPI//
s/in the bmi323 driver//
I will fix the first sentence in the comment.
Quoted 4 lines
This seems different wording to the other one. Have you looked at the code if it's indeed the case? Because we may not rely on the module load order.
Yes it's slightly different wording intentionally. I am able to test that when the bmc150 driver starts loading on the ASUS ROG ALLY with a bmi323 chip that the ACPI match happens, the driver attempts to initialize but does correctly fail at the chip id check portion.
I do not own a device with a bmc150 chip in it, but the same should be happening in the reverse situation where a device with a bmc150 chip starts to load the bmi323 driver. There is a chip id check in the bmi323_init function where a bmc150 device should fail at, and the driver should release the device. Without a device, I am unable to test that this works correctly or not. Logically the code looks similar between the two drivers.
Quoted 14 lines
drivers/iio/imu/bmi323/bmi323_i2c.c static int bmi323_i2c_probe(struct i2c_client *i2c) · line 109
Quoted 7 lines
If and when a different driver (such as bmc150) starts to load
+ * with the "BOSC0200" ACPI match, a short reset should ensure that the
+ * device is not in a bad state during that driver initialization. This
+ * device reset does occur in both the bmi323 and bmc150 init sequences.
+ */drivers/iio/imu/bmi323/bmi323_i2c.c +2
-0+ +static const struct acpi_device_id bmi323_acpi_match[] = {...should be here (and indented accordingly).
Quoted 3 lines
drivers/iio/imu/bmi323/bmi323_i2c.c +3
-0+ { "BOSC0200" }, + { } +};
Depending on Jonathan Cameron's preference about where to put the comment,
and if he wants a v3 or not... If we want to make a v3, should I create a new thread for that?
Best Regards,
Jon LoBue
Re: [PATCH v2 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
Quoted 2 lines · Jonathan LoBue
Quoted 1 line · PST Andy Shevchenko
On Wed, Feb 14, 2024 at 12:39 AM Jonathan LoBue <[email protected]> wrote:
...
Quoted 7 lines
I do not own a device with a bmc150 chip in it, but the same should be happening in the reverse situation where a device with a bmc150 chip starts to load the bmi323 driver. There is a chip id check in the
bmi323_initfunction where a bmc150 device should fail at, and the driver should release the device. Without a device, I am unable to test that this works correctly or not. Logically the code looks similar between the two drivers.
But are those IDs different?
...
Quoted 2 lines
Depending on Jonathan Cameron's preference about where to put the comment,
and if he wants a v3 or not... If we want to make a v3, should I create a new thread for that?
Sure.
I also recommend looking at my "smart" script [1] that helps sending kernel related patches. Improvements are welcome as GH pull-requests!
[1]: https://github.com/andy-shev/home-bin-tools/blob/master/ge2maintainer.sh
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
Quoted 1 line · PST Andy Shevchenko
But are those IDs different?
During the chip id check during init (after ACPI match), yes those IDs are different between devices with bmi323 and bmc150.
Quoted 4 lines
I also recommend looking at my "smart" script [1] that helps sending kernel related patches. Improvements are welcome as GH pull-requests!
[1]: https://github.com/andy-shev/home-bin-tools/blob/master/ge2maintainer.sh
Thanks for this useful script, and thanks for your patience and guidance. If I make a future submission after this patch series, the whole process should go much smoother as I have learned a lot in this thread.
Best Regards,
Jon LoBue
Re: [PATCH v2 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
Quoted 6 lines · Jonathan LoBue
Quoted 1 line · PST Andy Shevchenko
But are those IDs different?
During the chip id check during init (after ACPI match), yes those IDs are different between devices with bmi323 and bmc150.
Thanks for confirming!
Perhaps you may improve the wording based on this information.
Quoted 8 lines
Quoted 4 lines
I also recommend looking at my "smart" script [1] that helps sending kernel related patches. Improvements are welcome as GH pull-requests!
[1]: https://github.com/andy-shev/home-bin-tools/blob/master/ge2maintainer.sh
Thanks for this useful script, and thanks for your patience and guidance. If I make a future submission after this patch series, the whole process should go much smoother as I have learned a lot in this thread.
You're welcome!
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
In reply to Jonathan LoBueQuoted 4 lines · On Tue, 13 Feb 2024 14:39:10 -0800 Jonathan LoBue <[email protected]> wrote:
This patch adds the ACPI match table for ASUS ROG ALLY to load the bmi323 driver with an ACPI match of "BOSC0200".
Co-developed-by Jonathan LoBue <[email protected]>
Take another look at how to use Co-developed in submitting-patches.rst there are examples - key is that the author (From: in the email) does not have a Co-developed-by line.
Quoted 56 lines
Signed-off-by Jonathan LoBue <[email protected]>Co-developed-by Luke D. Jones <[email protected]>Signed-off-by Luke D. Jones <[email protected]>Co-developed-by Denis Benato <[email protected]>Signed-off-by Denis Benato <[email protected]>Co-developed-by Antheas Kapenekakis <[email protected]>Signed-off-by Antheas Kapenekakis <[email protected]>---
Formatting fixes, removed duplicate header, and removed
ACPI_PTRfrom previous submission.Added an explanation of the duplicate ACPI identifier issue between devices using bmc150 and bmi323.
drivers/iio/imu/bmi323/bmi323_i2c.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)drivers/iio/imu/bmi323/bmi323_i2c.c +20
-0@@ -93,6 +93,25 @@ static int bmi323_i2c_probe(struct i2c_client *i2c)return bmi323_core_probe (dev); } +/* +* The "BOSC0200" ACPI identifier used here in the bmi323 driver is not +* unique to bmi323 devices. The same "BOSC0200" identifier is found in +* devices using the bmc150 chip. This creates a conflict with duplicate +* ACPI identifiers which multiple drivers want to use. If a non-bmi323 +* device starts to load with this "BOSC0200" ACPI match here, then the +* chip id check portion should fail and the driver should relinquish the +* device. If and when a different driver (such as bmc150) starts to load +* with the "BOSC0200" ACPI match, a short reset should ensure that the +* device is not in a bad state during that driver initialization. This +* device reset does occur in both the bmi323 and bmc150 init sequences. +*/ + +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 +128,7 @@ static struct i2c_driver bmi323_i2c_driver = { .driver = { .name = "bmi323", .of_match_table = bmi323_of_i2c_match, + .acpi_match_table = bmi323_acpi_match, }, .probe = bmi323_i2c_probe, .id_table = bmi323_i2c_ids,
Re: [PATCH 1/2] iio: accel: bmc150: ASUS ROG ALLY Abort Loading
In reply to Andy ShevchenkoQuoted 4 lines · PST Andy Shevchenko
Even if fixed (which has to be done anyway) it can be undone in old firmwares — there is no solution to make all affected users update firmware. Do we have real products on the market with the wrong ID (I assume we do)?
After some conversations with other devs today, we retested and confirmed that the DMI quirks to abort loading of bmc150 is actually unnecessary. There was some confusion among us about why they had tried that approach in the past. The bmc150 driver does in fact start to load on ASUS ROG ALLY with a "BOSC0200" ACPI match, but when it gets to the chip id check portion it correctly aborts loading the driver for mismatched chip ID. This allows the bmi323 driver to pick it up properly with the "BOSC0200" ACPI match table match. Tested and confirmed working on my end with the submitted v1 patch. The DMI quirks and any modifications to bmc150 driver has been dropped. Thanks all for the feedback and help.
Best Regards,
Jon LoBue
PATCH 2/2 iio: imu: bmi323: Add and enable ACPI Match Table
In reply to Jonathan LoBueFrom c65d1ef44d749958f02d2b9a50a0e788b4497854 Mon Sep 17 00:00:00 2001
From: Jonathan LoBue <[email protected]>
Date: Sat, 10 Feb 2024 12:31:54 -0800
Subject: [PATCH 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
This patch adds the ACPI match table for ASUS ROG ALLY to load the bmi323 driver with an ACPI match of "BOSC0200".
--- drivers/iio/imu/bmi323/bmi323_i2c.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/iio/imu/bmi323/bmi323_i2c.c +8 -0
@@ -5,6 +5,7 @@* Copyright (C) 2023, Jagath Jog J <[email protected]> */ +#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_client *i2c)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_driver = { .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,
Signature · 1 line
2.43.0
Jonathan Cameron
maintainerRe: [PATCH 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
Quoted 8 lines · On Sat, 10 Feb 2024 14:34:11 -0800 Jonathan LoBue <[email protected]> wrote:
From
c65d1ef44d749958f02d2b9a50a0e788b4497854Mon Sep 17 00:00:00 2001
From: Jonathan LoBue <[email protected]>
Date: Sat, 10 Feb 2024 12:31:54 -0800
Subject: [PATCH 2/2] iio: imu: bmi323: Add and enable ACPI Match TableThis patch adds the ACPI match table for ASUS ROG ALLY to load the bmi323 driver with an ACPI match of "BOSC0200".
Quoted 8 lines
Co-developed-by Jonathan LoBue <[email protected]>Signed-off-by Jonathan LoBue <[email protected]>Co-developed-by Luke D. Jones <[email protected]>Signed-off-by Luke D. Jones <[email protected]>Co-developed-by Denis Benato <[email protected]>Signed-off-by Denis Benato <[email protected]>Co-developed-by Antheas Kapenekakis <[email protected]>Signed-off-by Antheas Kapenekakis <[email protected]>
This approach is sustainable or maintainable. Let's wait to see what people think of the suggestion I made of a wrapper driver that is capable of identifying the device and causing the correct driver to be loaded.
If nothing else this has no DMI type protections so if this one loads on a board where it is a BMC150 compatible part we'll end up in the same mess you were seeing just the other way around.
Jonathan
Quoted 37 lines
--- drivers/iio/imu/bmi323/bmi323_i2c.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/iio/imu/bmi323/bmi323_i2c.c +8
-0@@ -5,6 +5,7 @@* Copyright (C) 2023, Jagath Jog J <[email protected]> */ +#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_client *i2c)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_driver = { .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,
Re: [PATCH 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
In reply to Jonathan LoBueQuoted 5 lines · Jonathan LoBue
From
c65d1ef44d749958f02d2b9a50a0e788b4497854Mon Sep 17 00:00:00 2001
From: Jonathan LoBue <[email protected]>
Date: Sat, 10 Feb 2024 12:31:54 -0800
Subject: [PATCH 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
Something went wrong with the email body.
Quoted 2 lines
This patch adds the ACPI match table for ASUS ROG ALLY to load the bmi323 driver with an ACPI match of "BOSC0200".
...
Quoted 1 line
+#include <
linux/acpi.h>
It's not used. You don't need it as the proper one is already included...
Quoted 2 lines
#include <
linux/i2c.h>
#include <linux/mod_devicetable.h>
...here ^^^.
Quoted 1 line
#include <
linux/module.h>
...
drivers/iio/imu/bmi323/bmi323_i2c.c static int bmi323_i2c_probe(struct i2c_client *i2c) · line 99
Quoted 3 lines
drivers/iio/imu/bmi323/bmi323_i2c.c +3
-0+static const struct acpi_device_id bmi323_acpi_match[] = { + {"BOSC0200" }, + { },
No comma for the terminator line.
Quoted 1 line
+};
...
Quoted 1 line
+ .acpi_match_table =
ACPI_PTR(bmi323_acpi_match),
No ACPI_PTR() in new code. It's more problematic than helpful.
...
Above for your information for the future contributions, as I said in the other patch comment, I think the better approach is to enumerate from an external driver under the PDx86 realm.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
Quoted 6 lines · PST Andy Shevchenko
No
ACPI_PTR()in new code. It's more problematic than helpful.Above for your information for the future contributions, as I said in the other patch comment, I think the better approach is to enumerate from an external driver under the PDx86 realm.
Thanks for the constructive feedback. I'm working to fix and re-send via git send-email. I think the ACPI match table method should be okay and seems pretty standard for a lot of devices. The problem in this case is that the identifiers are not currently unique to each chip. This is something that should be rectified with BOSCH and system builders and then in the future, the ACPI match table(s) can be updated, and the aborting portion of loading the bmc150 driver for ASUS ROG ALLY can be removed.
Best Regards,
Jon LoBue
Re: [PATCH 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
Quoted 1 line · Jonathan LoBue
On Sunday, February 11, 2024 9:08:59 AM PST Andy Shevchenko wrote:
...
Quoted 7 lines
Quoted 5 lines
No
ACPI_PTR()in new code. It's more problematic than helpful.Above for your information for the future contributions, as I said in the other patch comment, I think the better approach is to enumerate from an external driver under the PDx86 realm.
Thanks for the constructive feedback.
You're welcome!
Quoted 4 lines
I'm working to fix and re-send via
git send-email. I think the ACPI match table method should be okay and seems pretty standard for a lot of devices. The problem in this case is that the identifiers are not currently unique to each chip.
Yes, that's why this portion is called "DMI quirk". And it does not belong to the driver as such. In some cases we may have it inside the driver, but here, I believe, and Hans can correct me, we may avoid polluting the driver with a quirk.
Quoted 4 lines
This is something
that should be rectified with BOSCH and system builders and then in the future, the ACPI match table(s) can be updated, and the aborting portion of loading the bmc150 driver for ASUS ROG ALLY can be removed.
As I said in a reply to the other patch, it probably will stay forever.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 2/2] iio: imu: bmi323: Add and enable ACPI Match Table
Quoted 5 lines · PST Andy Shevchenko
Yes, that's why this portion is called "DMI quirk". And it does not belong to the driver as such. In some cases we may have it inside the driver, but here, I believe, and Hans can correct me, we may avoid polluting the driver with a quirk.
After discussing with some devs who have worked on gyro software, I have decided to abandon this "DMI quirk" approach in favor of fixing the bmc150 chip id check to properly abandon the driver loading when appropriate. This should be a far better approach and work for all affected devices. I will need to re-write (and test) the first portion of this 2 part patch in this manner before I re-submit. Thanks.
Best Regards,
Jon LoBue