Skip to contentSkip to conversation

Add dt-binding support for ti tmp006

PATCH In review Anup Sharma 3 participants 6 messages May 20, 2023 – May 28, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Add dt-binding support for ti tmp006

These patches introduce device tree binding support and add an of_device_id table entry to the driver.

Changes in v2:
- Keep the exsisting MODULE_DEVICE_TABLE entry.
- Removed the inner comma in of_device_id.
- Order the included header to improve code organization.
- Adding missing semicolon to fix syntax error detected using dt_binding_check.

Anup Sharma (2):
dt-bindings: iio: temperature: Add support for tmp006
iio: temperature: tmp006: Add OF device matching support

 .../bindings/iio/temperature/ti,tmp006.yaml   | 42 +++++++++++++++++++
 drivers/iio/temperature/tmp006.c              |  8 ++++
 2 files changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/temperature/ti,tmp006.yaml
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 dt-bindings: iio: temperature: Add support for tmp006

Add devicetree binding document for TMP006, IR thermopile sensor.

---
Changes:
V1 -> V2: Removed redundant dt-binding from subject.
Added supply information.
Adhere to the generic node name.
Adding missing semicolon to fix syntax error detected using dt_binding_check

---
 .../bindings/iio/temperature/ti,tmp006.yaml   | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/temperature/ti,tmp006.yaml
Documentation/devicetree/bindings/iio/temperature/ti,tmp006.yaml new file +42 -0
new file mode 100644
index 000000000000..d43002b9bfdc
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/temperature/ti,tmp006.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI TMP006 IR thermopile sensor
+
+maintainers:
+  - Peter Meerwald <[email protected]>
+
+description: |
+  TI TMP006 - Infrared Thermopile Sensor in Chip-Scale Package.
+  https://cdn.sparkfun.com/datasheets/Sensors/Temp/tmp006.pdf
+
+properties:
+  compatible:
+    const: ti,tmp006
+
+  reg:
+    maxItems: 1
+
+  vdd-supply:
+    description: provide VDD power to the sensor.
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        temperature-sensor@40 {
+            compatible = "ti,tmp006";
+            reg = <0x40>;
+            vdd-supply = <&ldo4_reg>;
+        };
+    };
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/2 iio: temperature: tmp006: Add OF device matching support

In reply to Anup Sharma

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.

---
Changes:
V1 -> V2: Keep the exsisting MODULE_DEVICE_TABLE entry.
Removed the inner comma in of_device_id. Order the included header to improve code organization.

---
 drivers/iio/temperature/tmp006.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/iio/temperature/tmp006.c +8 -0
index cdf08477e63f..5f5a7450bd5b 100644
@@ -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_new = tmp006_probe,
Signature · 1 line
2.34.1
maintainer
#3 lore raw
In reply to Anup Sharma
Quoted 10 lines · On Sat, 20 May 2023 16:21:50 +0530 Anup Sharma <[email protected]> wrote:

These patches introduce device tree binding support and add an of_device_id table entry to the driver.

Changes in v2:
- Keep the exsisting MODULE_DEVICE_TABLE entry.
- Removed the inner comma in of_device_id.
- Order the included header to improve code organization.
- Adding missing semicolon to fix syntax error detected using dt_binding_check.

LGTM - I'll leave them a little while though for others to comment before picking them up.

Thanks,

Jonathan

Quoted 9 lines

Anup Sharma (2):
dt-bindings: iio: temperature: Add support for tmp006
iio: temperature: tmp006: Add OF device matching support

 .../bindings/iio/temperature/ti,tmp006.yaml   | 42 +++++++++++++++++++
 drivers/iio/temperature/tmp006.c              |  8 ++++
 2 files changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/temperature/ti,tmp006.yaml
Reviewed-by
#4 lore raw
Quoted 13 lines · Jonathan Cameron
Quoted 10 lines · On Sat, 20 May 2023 16:21:50 +0530 Anup Sharma <[email protected]> wrote:

These patches introduce device tree binding support and add an of_device_id table entry to the driver.

Changes in v2:
- Keep the exsisting MODULE_DEVICE_TABLE entry.
- Removed the inner comma in of_device_id.
- Order the included header to improve code organization.
- Adding missing semicolon to fix syntax error detected using dt_binding_check.

Quoted 2 lines

LGTM - I'll leave them a little while though for others to comment before picking them up.

It may be a wee bit before you here from Krzysztof, but the binding check issues have been fixed, as have the things he pointed out in the original submission AFAICT.

Thanks,
Conor.

maintainer
#5 lore raw
Quoted 14 lines · On Sat, 20 May 2023 23:32:03 +0100 Conor Dooley <[email protected]> wrote:
Quoted 13 lines · Jonathan Cameron
Quoted 10 lines · On Sat, 20 May 2023 16:21:50 +0530 Anup Sharma <[email protected]> wrote:

These patches introduce device tree binding support and add an of_device_id table entry to the driver.

Changes in v2:
- Keep the exsisting MODULE_DEVICE_TABLE entry.
- Removed the inner comma in of_device_id.
- Order the included header to improve code organization.
- Adding missing semicolon to fix syntax error detected using dt_binding_check.

Quoted 8 lines
Quoted 2 lines

LGTM - I'll leave them a little while though for others to comment before picking them up.

It may be a wee bit before you here from Krzysztof, but the binding check issues have been fixed, as have the things he pointed out in the original submission AFAICT.

Thanks!

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to have their fun.

Thanks,

Jonathan

Quoted 2 lines

Thanks,
Conor.