[PATCH] iio: accel: mma8452: add ACPI match table
veeenjoyer24 <[email protected]>
| Newsgroups | org.kernel.vger.linux-kernel,org.kernel.vger.linux-iio |
|---|---|
| Message-ID | <[email protected]> |
The mma8452 driver supports obtaining chip-specific data through i2c_get_match_data(), but only provides OF and I2C match tables. On ACPI-based x86 systems, compatible devices such as the MMA8653 are enumerated via ACPI. Without an ACPI match table, the driver never binds to those devices. Add an ACPI match table mapping the supported devices to the existing chip information structures. Tested on a Bay Trail tablet exposing an ACPI device with HID "MMA8653". With this change the driver successfully probes, reads the expected chip ID (0x5a), and registers an IIO device. Signed-off-by: veeenjoyer24 <[email protected]> --- drivers/iio/accel/mma8452.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index cefc7cf4b..8cb78e4cf 100644 --- a/drivers/iio/accel/mma8452.c +++ b/drivers/iio/accel/mma8452.c @@ -1822,6 +1822,17 @@ static const struct dev_pm_ops mma8452_pm_ops = { mma8452_runtime_resume, NULL) }; +static const struct acpi_device_id mma8452_acpi_id[] = { + { "FXLS8471", (kernel_ulong_t)&mma_chip_info_table[fxls8471] }, + { "MMA8451", (kernel_ulong_t)&mma_chip_info_table[mma8451] }, + { "MMA8452", (kernel_ulong_t)&mma_chip_info_table[mma8452] }, + { "MMA8453", (kernel_ulong_t)&mma_chip_info_table[mma8453] }, + { "MMA8652", (kernel_ulong_t)&mma_chip_info_table[mma8652] }, + { "MMA8653", (kernel_ulong_t)&mma_chip_info_table[mma8653] }, + { } +}; +MODULE_DEVICE_TABLE(acpi, mma8452_acpi_id); + static const struct i2c_device_id mma8452_id[] = { { "fxls8471", (kernel_ulong_t)&mma_chip_info_table[fxls8471] }, { "mma8451", (kernel_ulong_t)&mma_chip_info_table[mma8451] }, @@ -1837,6 +1848,7 @@ static struct i2c_driver mma8452_driver = { .driver = { .name = "mma8452", .of_match_table = mma8452_dt_ids, + .acpi_match_table = mma8452_acpi_id, .pm = &mma8452_pm_ops, }, .probe = mma8452_probe, -- 2.55.0