[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1487239327-21406-5-git-send-email-eraretuya@gmail.com>
Date: Thu, 16 Feb 2017 18:02:07 +0800
From: Eva Rachel Retuya <eraretuya@...il.com>
To: jic23@...nel.org, linux-iio@...r.kernel.org
Cc: knaack.h@....de, lars@...afoo.de, pmeerw@...erw.net,
dmitry.torokhov@...il.com, michael.hennerich@...log.com,
daniel.baluta@...il.com, amsfield22@...il.com,
florian.vaussard@...g-vd.ch, linux-kernel@...r.kernel.org,
Eva Rachel Retuya <eraretuya@...il.com>
Subject: [PATCH 4/4] iio: accel: adxl345: Add ACPI support
Allow probing the adxl345 on both I2C and SPI protocols using ACPI.
Signed-off-by: Eva Rachel Retuya <eraretuya@...il.com>
---
drivers/iio/accel/adxl345_i2c.c | 9 +++++++++
drivers/iio/accel/adxl345_spi.c | 9 +++++++++
2 files changed, 18 insertions(+)
diff --git a/drivers/iio/accel/adxl345_i2c.c b/drivers/iio/accel/adxl345_i2c.c
index b114eb0..13080ff 100644
--- a/drivers/iio/accel/adxl345_i2c.c
+++ b/drivers/iio/accel/adxl345_i2c.c
@@ -12,6 +12,7 @@
* 0x53 (ALT ADDRESS pin grounded)
*/
+#include <linux/acpi.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/regmap.h>
@@ -54,9 +55,17 @@ static const struct i2c_device_id adxl345_i2c_id[] = {
MODULE_DEVICE_TABLE(i2c, adxl345_i2c_id);
+static const struct acpi_device_id adxl345_acpi_id[] = {
+ { "ADX0345", 0 },
+ { }
+};
+
+MODULE_DEVICE_TABLE(acpi, adxl345_acpi_id);
+
static struct i2c_driver adxl345_i2c_driver = {
.driver = {
.name = "adxl345_i2c",
+ .acpi_match_table = ACPI_PTR(adxl345_acpi_id),
},
.probe = adxl345_i2c_probe,
.remove = adxl345_i2c_remove,
diff --git a/drivers/iio/accel/adxl345_spi.c b/drivers/iio/accel/adxl345_spi.c
index 5fcd1fa..3f2a1db 100644
--- a/drivers/iio/accel/adxl345_spi.c
+++ b/drivers/iio/accel/adxl345_spi.c
@@ -10,6 +10,7 @@
* SPI driver for ADXL345
*/
+#include <linux/acpi.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/spi/spi.h>
@@ -59,9 +60,17 @@ static const struct spi_device_id adxl345_spi_id[] = {
MODULE_DEVICE_TABLE(spi, adxl345_spi_id);
+static const struct acpi_device_id adxl345_acpi_id[] = {
+ { "ADX0345", 0 },
+ { }
+};
+
+MODULE_DEVICE_TABLE(acpi, adxl345_acpi_id);
+
static struct spi_driver adxl345_spi_driver = {
.driver = {
.name = "adxl345_spi",
+ .acpi_match_table = ACPI_PTR(adxl345_acpi_id),
},
.probe = adxl345_spi_probe,
.remove = adxl345_spi_remove,
--
2.7.4
Powered by blists - more mailing lists