[PATCH v3] iio: accel: adxl345: Add ACPI HID table

From: Kai-Heng Feng
Date: Mon Feb 14 2022 - 23:30:10 EST


x86 boards may use ACPI HID "ADS0345" for adxl345 device.

Analog replied:
"ADS034X is not a valid PNP ID. ADS0345 would be.
I'm not aware that this ID is already taken.
Feel free to submit a mainline Linux input mailing list patch."

So add an ACPI match table for that accordingly.

Suggested-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@xxxxxxxxxxxxx>
---
v3:
- Convert the driver from input to iio.

v2:
- Drop ACPI_PTR()
- Drop redundant empty line and comma
- Add info from vendor

drivers/iio/accel/adxl345_i2c.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/iio/accel/adxl345_i2c.c b/drivers/iio/accel/adxl345_i2c.c
index a431cba216e69..1d57050c775de 100644
--- a/drivers/iio/accel/adxl345_i2c.c
+++ b/drivers/iio/accel/adxl345_i2c.c
@@ -41,6 +41,7 @@ static int adxl345_i2c_probe(struct i2c_client *client,
static const struct i2c_device_id adxl345_i2c_id[] = {
{ "adxl345", ADXL345 },
{ "adxl375", ADXL375 },
+ { "ADS0345:00", ADXL345 },
{ }
};

@@ -54,10 +55,17 @@ static const struct of_device_id adxl345_of_match[] = {

MODULE_DEVICE_TABLE(of, adxl345_of_match);

+static const struct acpi_device_id adxl345_acpi_match[] = {
+ { "ADS0345" },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, adxl345_acpi_match);
+
static struct i2c_driver adxl345_i2c_driver = {
.driver = {
.name = "adxl345_i2c",
.of_match_table = adxl345_of_match,
+ .acpi_match_table = adxl345_acpi_match,
},
.probe = adxl345_i2c_probe,
.id_table = adxl345_i2c_id,
--
2.34.1