Add dt-binding support for ti tmp006
Subsystems (2)
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.
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 | 10 ++++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/iio/temperature/ti,tmp006.yaml
Signature · 1 line
2.34.1
PATCH 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.
--- .../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
@@ -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
PATCH 2/2 iio: temperature: tmp006: Add OF device matching support
In reply to Anup SharmaAdds 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.
--- drivers/iio/temperature/tmp006.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/iio/temperature/tmp006.c +9 -1
@@ -17,6 +17,7 @@#include <linux/module.h> #include <linux/pm.h> #include <linux/bitops.h> +#include <linux/mod_devicetable.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h>
@@ -272,15 +273,22 @@ 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 }, { } }; -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
Re: [PATCH 1/2] dt-bindings: iio: temperature: Add support for tmp006
In reply to Anup SharmaQuoted 4 lines · Anup Sharma
Add devicetree binding document for TMP006, IR thermopile sensor.
Signed-off-by Anup Sharma <[email protected]>
Missing ---
Quoted 5 lines
Changes:
V1 -> V2: Removed redundant dt-binding from subject.
Added supply information.
Adhere to the generic node name.
---
Best regards,
Krzysztof
Re: [PATCH 2/2] iio: temperature: tmp006: Add OF device matching support
In reply to Anup SharmaQuoted 23 lines · Anup Sharma
Adds an
of_device_idtable entry to the driver, enabling device matching through device tree. With this update, the driver can now match devices using both thei2c_device_identry and the newly addedof_device_idtable.Signed-off-by Anup Sharma <[email protected]>--- drivers/iio/temperature/tmp006.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/iio/temperature/tmp006.c +1
-0@@ -17,6 +17,7 @@#include <linux/module.h> #include <linux/pm.h> #include <linux/bitops.h> +#include <linux/mod_devicetable.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h>
drivers/iio/temperature/tmp006.c static int tmp006_resume(struct device *dev) · line 280
Quoted 8 lines
drivers/iio/temperature/tmp006.c +5
-0@@ -272,15 +273,22 @@ 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" , }, + { } +}; +
Drop blank line.
drivers/iio/temperature/tmp006.c static int tmp006_resume(struct device *dev) · line 279
Quoted 7 lines
drivers/iio/temperature/tmp006.c +2
-1+MODULE_DEVICE_TABLE (of, tmp006_of_match); +static const struct i2c_device_id tmp006_id[] = { {"tmp006" ,0 }, { } }; -MODULE_DEVICE_TABLE (i2c, tmp006_id);
This should stay.
Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: iio: temperature: Add support for tmp006
In reply to Anup SharmaQuoted 4 lines · Anup Sharma
Add devicetree binding document for TMP006, IR thermopile sensor.
Signed-off-by Anup Sharma <[email protected]>
Quoted 9 lines
Changes:
V1 -> V2: Removed redundant dt-binding from subject.
Added supply information.
Adhere to the generic node name.--- .../bindings/iio/temperature/ti,tmp006.yaml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/temperature/ti,tmp006.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/iio/temperature/ti,tmp006.example.dts:25.13-14 syntax error FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/iio/temperature/ti,tmp006.example.dtb] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1512: dt_binding_check] Error 2
See https://patchwork.ozlabs.org/patch/1781058
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
Re: [PATCH 2/2] iio: temperature: tmp006: Add OF device matching support
In reply to Anup SharmaQuoted 4 lines · Anup Sharma
Adds an
of_device_idtable entry to the driver, enabling device matching through device tree. With this update, the driver can now match devices using both thei2c_device_identry and the newly addedof_device_idtable.
...
Quoted 5 lines
#include <
linux/module.h>
#include <linux/pm.h>
#include <linux/bitops.h>+#include <
linux/mod_devicetable.h>
Can you try to keep this ordered as much as possible? (For example, by locating a new inclusion near to module.h)
...
drivers/iio/temperature/tmp006.c static int tmp006_resume(struct device *dev) · line 277
Quoted 2 lines
drivers/iio/temperature/tmp006.c +2
-0+static const struct of_device_id tmp006_of_match[] = { + { .compatible ="ti,tmp006" , },
Inner comma is not needed.
Quoted 2 lines
drivers/iio/temperature/tmp006.c +2
-0+ { } +};
Signature · 2 lines
With Best Regards, Andy Shevchenko