[PATCH] hwmon: lm73: add device tree support to LM73 driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds device tree support to the lm73 driver. It is a
trivial i2c device that matches against the compatible property
value "national,lm73":

    i2c {
            /* ... */

            temperature-sensor@49 {
                    compatible = "national,lm73";
                    reg = <0x49>;
            };
    };

Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
---
 Documentation/devicetree/bindings/i2c/trivial-devices.txt |    1 +
 drivers/hwmon/lm73.c                                      |    9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
index 2f5322b..6d27042 100644
--- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
@@ -39,6 +39,7 @@ maxim,ds1050		5 Bit Programmable, Pulse-Width Modulator
 maxim,max1237		Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
 maxim,max6625		9-Bit/12-Bit Temperature Sensors with I²C-Compatible Serial Interface
 mc,rv3029c2		Real Time Clock Module with I2C-Bus
+national,lm73		I2C TEMP SENSOR
 national,lm75		I2C TEMP SENSOR
 national,lm80		Serial Interface ACPI-Compatible Microprocessor System Hardware Monitor
 national,lm92		±0.33°C Accurate, 12-Bit + Sign Temperature Sensor and Thermal Window Comparator with Two-Wire Interface
diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c
index 8fa2632..96bcf25 100644
--- a/drivers/hwmon/lm73.c
+++ b/drivers/hwmon/lm73.c
@@ -20,6 +20,7 @@
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
 #include <linux/err.h>
+#include <linux/of.h>
 
 
 /* Addresses scanned */
@@ -182,10 +183,18 @@ static int lm73_detect(struct i2c_client *new_client,
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id lm73_dt_ids[] = {
+	{ .compatible = "national,lm73" },
+	{}
+};
+#endif
+
 static struct i2c_driver lm73_driver = {
 	.class		= I2C_CLASS_HWMON,
 	.driver = {
 		.name	= "lm73",
+		.of_match_table = of_match_ptr(lm73_dt_ids),
 	},
 	.probe		= lm73_probe,
 	.remove		= lm73_remove,
-- 
1.7.10.4


_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux