The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] iio: accel: mma8452: add ACPI match table
@ 2026-08-07 13:51 veeenjoyer24
  2026-08-07 14:59 ` Joshua Crofts
  0 siblings, 1 reply; 4+ messages in thread
From: veeenjoyer24 @ 2026-08-07 13:51 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	veeenjoyer24, Greg Kroah-Hartman, linux-iio, linux-kernel

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 <danilsirin24@gmail.com>
---
 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


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

end of thread, other threads:[~2026-08-07 23:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07 13:51 [PATCH] iio: accel: mma8452: add ACPI match table veeenjoyer24
2026-08-07 14:59 ` Joshua Crofts
2026-08-07 17:13   ` [PATCH v2] " Danil Sirin
2026-08-07 23:28     ` Jonathan Cameron

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