summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorAnup Sharma <anupnewsmail@gmail.com>2023-05-20 12:55:38 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2023-05-28 21:22:03 +0200
commit12a875055c15279c4f2db14cb0b593d81d16fc0b (patch)
treeea9a85e14fabf5c7d4ebfce3b962d378b40bdc15 /drivers/iio
parentdt-bindings: iio: temperature: Add support for tmp006 (diff)
downloadlinux-12a875055c15279c4f2db14cb0b593d81d16fc0b.tar.xz
linux-12a875055c15279c4f2db14cb0b593d81d16fc0b.zip
iio: temperature: tmp006: Add OF device matching support
Adds an of_device_id table entry to the driver, enabling device matching through device tree. With this update, the driver can now match devices using both the i2c_device_id entry and the newly added of_device_id table. Signed-off-by: Anup Sharma <anupnewsmail@gmail.com> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/72746bdfd8f74171943e41759b891c7af40627ec.1684579603.git.anupnewsmail@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/temperature/tmp006.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
index 811d7eaa939c..3a3904fe138c 100644
--- a/drivers/iio/temperature/tmp006.c
+++ b/drivers/iio/temperature/tmp006.c
@@ -15,6 +15,7 @@
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/module.h>
+#include <linux/mod_devicetable.h>
#include <linux/pm.h>
#include <linux/bitops.h>
@@ -272,6 +273,12 @@ static int tmp006_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(tmp006_pm_ops, tmp006_suspend, tmp006_resume);
+static const struct of_device_id tmp006_of_match[] = {
+ { .compatible = "ti,tmp006" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, tmp006_of_match);
+
static const struct i2c_device_id tmp006_id[] = {
{ "tmp006", 0 },
{ }
@@ -281,6 +288,7 @@ MODULE_DEVICE_TABLE(i2c, tmp006_id);
static struct i2c_driver tmp006_driver = {
.driver = {
.name = "tmp006",
+ .of_match_table = tmp006_of_match,
.pm = pm_sleep_ptr(&tmp006_pm_ops),
},
.probe = tmp006_probe,