diff mbox

[1/1] hwmon/adt7411: Add devicetree bindings

Message ID 1386532718-13586-2-git-send-email-bgamari.foss@gmail.com
State Superseded, archived
Headers show

Commit Message

Ben Gamari Dec. 8, 2013, 7:58 p.m. UTC
There isn't reallly any configuration necessary so the bindings are
consequently quite simple.

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
---
 Documentation/devicetree/bindings/hwmon/adt7411.txt | 11 +++++++++++
 drivers/hwmon/adt7411.c                             |  8 ++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/adt7411.txt

Comments

Guenter Roeck Dec. 8, 2013, 8:32 p.m. UTC | #1
On 12/08/2013 11:58 AM, Ben Gamari wrote:
> There isn't reallly any configuration necessary so the bindings are
> consequently quite simple.
>
> Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
> ---

i2c devices don't require explicit bindings unless driver specific bindings are needed.
Please see Documentation/devicetree/bindings/i2c/trivial-devices.txt for details.
You might want to consider adding the device into the trivial-devices.txt file instead.

Guenter

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Gamari Dec. 8, 2013, 8:53 p.m. UTC | #2
Guenter Roeck <linux@roeck-us.net> writes:

> On 12/08/2013 11:58 AM, Ben Gamari wrote:
>> There isn't reallly any configuration necessary so the bindings are
>> consequently quite simple.
>>
>> Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
>> ---
>
> i2c devices don't require explicit bindings unless driver specific bindings are needed.
> Please see Documentation/devicetree/bindings/i2c/trivial-devices.txt for details.
> You might want to consider adding the device into the trivial-devices.txt file instead.
>
Thanks! I was not aware of this. Patch coming.

How does the devicetree code handle the vendor prefix in the compatible
field? For instance, the AD7414 has compatible="ad,ad7414" yet the
driver never mentions "ad", only "ad7414". Is the vendor prefix stripped
off while searching for compatible drivers?

On that note, it seems that adt7461 is listed twice in this file; once
as "adi,adt7461" and again as "adt7461". Is this expected?

Thanks again.

Cheers,

- Ben
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/hwmon/adt7411.txt b/Documentation/devicetree/bindings/hwmon/adt7411.txt
new file mode 100644
index 0000000..04ec1bb
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/adt7411.txt
@@ -0,0 +1,11 @@ 
+ADT7411 (I2C)
+
+This device is a dual interface (I2C and SPI) 8-channel 10-bit ADC &
+temperature sensor. This driver currently only supports the I2C interface.
+
+Required properties:
+
+  - compatible : must be "analog,adt7411"
+  - reg : I2C bus address of the device
+  - #address-cells : must be <1>
+  - #size-cells : must be <0>
diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c
index d9299de..ece2308 100644
--- a/drivers/hwmon/adt7411.c
+++ b/drivers/hwmon/adt7411.c
@@ -334,9 +334,17 @@  static const struct i2c_device_id adt7411_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adt7411_id);
 
+static const struct of_device_id adt7411_dt_ids[] = {
+	{ .compatible = "analog,adt7411", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, adt7411_dt_ids);
+
 static struct i2c_driver adt7411_driver = {
 	.driver		= {
 		.name		= "adt7411",
+		.owner		= THIS_MODULE,
+		.of_match_table = adt7411_dt_ids,
 	},
 	.probe  = adt7411_probe,
 	.remove	= adt7411_remove,