linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Add dt-binding support for ti tmp006
@ 2023-05-14 19:00 Anup Sharma
  2023-05-14 19:01 ` [PATCH 1/2] dt-bindings: iio: temperature: Add support for tmp006 Anup Sharma
  2023-05-14 19:03 ` [PATCH 2/2] iio: temperature: tmp006: Add OF device matching support Anup Sharma
  0 siblings, 2 replies; 7+ messages in thread
From: Anup Sharma @ 2023-05-14 19:00 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Anup Sharma, Peter Meerwald,
	u.kleine-koenig, andriy.shevchenko, linux-iio, devicetree,
	linux-kernel

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

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] dt-bindings: iio: temperature: Add support for tmp006
  2023-05-14 19:00 [PATCH 0/2] Add dt-binding support for ti tmp006 Anup Sharma
@ 2023-05-14 19:01 ` Anup Sharma
  2023-05-15  6:17   ` Krzysztof Kozlowski
  2023-05-15  6:23   ` Krzysztof Kozlowski
  2023-05-14 19:03 ` [PATCH 2/2] iio: temperature: tmp006: Add OF device matching support Anup Sharma
  1 sibling, 2 replies; 7+ messages in thread
From: Anup Sharma @ 2023-05-14 19:01 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Anup Sharma, Peter Meerwald,
	u.kleine-koenig, andriy.shevchenko, linux-iio, devicetree,
	linux-kernel

Add devicetree binding document for TMP006, IR thermopile sensor.

Signed-off-by: Anup Sharma <anupnewsmail@gmail.com>

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

diff --git a/Documentation/devicetree/bindings/iio/temperature/ti,tmp006.yaml b/Documentation/devicetree/bindings/iio/temperature/ti,tmp006.yaml
new file mode 100644
index 000000000000..4915c3e2d721
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/temperature/ti,tmp006.yaml
@@ -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 <pmeerw@pmeerw.net>
+
+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>
+        };
+    };
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] iio: temperature: tmp006: Add OF device matching support
  2023-05-14 19:00 [PATCH 0/2] Add dt-binding support for ti tmp006 Anup Sharma
  2023-05-14 19:01 ` [PATCH 1/2] dt-bindings: iio: temperature: Add support for tmp006 Anup Sharma
@ 2023-05-14 19:03 ` Anup Sharma
  2023-05-15  6:18   ` Krzysztof Kozlowski
  2023-05-15 21:45   ` Andy Shevchenko
  1 sibling, 2 replies; 7+ messages in thread
From: Anup Sharma @ 2023-05-14 19:03 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Anup Sharma, Peter Meerwald,
	u.kleine-koenig, andriy.shevchenko, linux-iio, devicetree,
	linux-kernel

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>
---
 drivers/iio/temperature/tmp006.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
index cdf08477e63f..2b1782263cc9 100644
--- a/drivers/iio/temperature/tmp006.c
+++ b/drivers/iio/temperature/tmp006.c
@@ -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,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dt-bindings: iio: temperature: Add support for tmp006
  2023-05-14 19:01 ` [PATCH 1/2] dt-bindings: iio: temperature: Add support for tmp006 Anup Sharma
@ 2023-05-15  6:17   ` Krzysztof Kozlowski
  2023-05-15  6:23   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2023-05-15  6:17 UTC (permalink / raw)
  To: Anup Sharma, Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Peter Meerwald,
	u.kleine-koenig, andriy.shevchenko, linux-iio, devicetree,
	linux-kernel

On 14/05/2023 21:01, Anup Sharma wrote:
> Add devicetree binding document for TMP006, IR thermopile sensor.
> 
> Signed-off-by: Anup Sharma <anupnewsmail@gmail.com>
> 

Missing ---


> Changes:
> V1 -> V2: Removed redundant dt-binding from subject.
>           Added supply information.
>           Adhere to the generic node name.
> ---


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] iio: temperature: tmp006: Add OF device matching support
  2023-05-14 19:03 ` [PATCH 2/2] iio: temperature: tmp006: Add OF device matching support Anup Sharma
@ 2023-05-15  6:18   ` Krzysztof Kozlowski
  2023-05-15 21:45   ` Andy Shevchenko
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2023-05-15  6:18 UTC (permalink / raw)
  To: Anup Sharma, Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Peter Meerwald,
	u.kleine-koenig, andriy.shevchenko, linux-iio, devicetree,
	linux-kernel

On 14/05/2023 21:03, Anup Sharma wrote:
> 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>
> ---
>  drivers/iio/temperature/tmp006.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
> index cdf08477e63f..2b1782263cc9 100644
> --- a/drivers/iio/temperature/tmp006.c
> +++ b/drivers/iio/temperature/tmp006.c
> @@ -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", },
> +	{ }
> +};
> +

Drop blank line.

> +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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dt-bindings: iio: temperature: Add support for tmp006
  2023-05-14 19:01 ` [PATCH 1/2] dt-bindings: iio: temperature: Add support for tmp006 Anup Sharma
  2023-05-15  6:17   ` Krzysztof Kozlowski
@ 2023-05-15  6:23   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2023-05-15  6:23 UTC (permalink / raw)
  To: Anup Sharma
  Cc: Peter Meerwald, u.kleine-koenig, devicetree, Jonathan Cameron,
	Krzysztof Kozlowski, Lars-Peter Clausen, andriy.shevchenko,
	Conor Dooley, Rob Herring, linux-kernel, linux-iio

On Mon, 15 May 2023 00:31:59 +0530, Anup Sharma wrote:
> Add devicetree binding document for TMP006, IR thermopile sensor.
> 
> Signed-off-by: Anup Sharma <anupnewsmail@gmail.com>
> 
> 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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] iio: temperature: tmp006: Add OF device matching support
  2023-05-14 19:03 ` [PATCH 2/2] iio: temperature: tmp006: Add OF device matching support Anup Sharma
  2023-05-15  6:18   ` Krzysztof Kozlowski
@ 2023-05-15 21:45   ` Andy Shevchenko
  1 sibling, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2023-05-15 21:45 UTC (permalink / raw)
  To: Anup Sharma
  Cc: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Peter Meerwald,
	u.kleine-koenig, linux-iio, devicetree, linux-kernel

On Mon, May 15, 2023 at 12:33:06AM +0530, Anup Sharma wrote:
> 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.

...

>  #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)

...

> +static const struct of_device_id tmp006_of_match[] = {
> +	{ .compatible = "ti,tmp006", },

Inner comma is not needed.

> +	{ }
> +};

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-05-15 21:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-14 19:00 [PATCH 0/2] Add dt-binding support for ti tmp006 Anup Sharma
2023-05-14 19:01 ` [PATCH 1/2] dt-bindings: iio: temperature: Add support for tmp006 Anup Sharma
2023-05-15  6:17   ` Krzysztof Kozlowski
2023-05-15  6:23   ` Krzysztof Kozlowski
2023-05-14 19:03 ` [PATCH 2/2] iio: temperature: tmp006: Add OF device matching support Anup Sharma
2023-05-15  6:18   ` Krzysztof Kozlowski
2023-05-15 21:45   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).