Re: [PATCH 2/2] iio: imu: bmi323: Add and enable ACPI Match Table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 10 Feb 2024 14:34:11 -0800
Jonathan LoBue <jlobue10@xxxxxxxxx> wrote:

> From c65d1ef44d749958f02d2b9a50a0e788b4497854 Mon Sep 17 00:00:00 2001
> From: Jonathan LoBue <jlobue10@xxxxxxxxx>
> 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".
> 
> Co-developed-by: Jonathan LoBue <jlobue10@xxxxxxxxx>
> Signed-off-by: Jonathan LoBue <jlobue10@xxxxxxxxx>
> Co-developed-by: Luke D. Jones <luke@xxxxxxxxxx>
> Signed-off-by: Luke D. Jones <luke@xxxxxxxxxx>
> Co-developed-by: Denis Benato <benato.denis96@xxxxxxxxx>
> Signed-off-by: Denis Benato <benato.denis96@xxxxxxxxx>
> Co-developed-by: Antheas Kapenekakis <lkml@xxxxxxxxxxx>
> Signed-off-by: Antheas Kapenekakis <lkml@xxxxxxxxxxx>

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



> ---
>  drivers/iio/imu/bmi323/bmi323_i2c.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/iio/imu/bmi323/bmi323_i2c.c b/drivers/iio/imu/bmi323/bmi323_i2c.c
> index 20a8001b9956..346ba2d1a169 100644
> --- 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@xxxxxxxxx>
>   */
>  
> +#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,





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux