diff mbox series

[v3,2/2] dt-bindings: iio: humidity: Add TI HDC302x support

Message ID 20231125102749.2876-1-579lpy@gmail.com
State Not Applicable
Headers show
Series None | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success
robh/dtbs-check warning build log
robh/dt-meta-schema success

Commit Message

Li peiyu Nov. 25, 2023, 10:27 a.m. UTC
From: Li peiyu <579lpy@gmail.com>

Add device tree bindings for HDC3020/HDC3021/HDC3022 humidity and
temperature sensors.

Signed-off-by: Li peiyu <579lpy@gmail.com>
---
changes for v3:
- Use a fallback compatible
changes for v2:
- change the maintainers to me.
- hdc3020,hdc3021,hdc3022 are compatible,I've changed the dirver.
- change the node name to humidity-sensor.

 .../bindings/iio/humidity/ti,hdc3020.yaml     | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/humidity/ti,hdc3020.yaml

Comments

Jonathan Cameron Nov. 25, 2023, 2:55 p.m. UTC | #1
On Sat, 25 Nov 2023 18:27:49 +0800
579lpy@gmail.com wrote:

> From: Li peiyu <579lpy@gmail.com>
> 
> Add device tree bindings for HDC3020/HDC3021/HDC3022 humidity and
> temperature sensors.
> 
> Signed-off-by: Li peiyu <579lpy@gmail.com>
> ---
> changes for v3:
> - Use a fallback compatible
> changes for v2:
> - change the maintainers to me.
> - hdc3020,hdc3021,hdc3022 are compatible,I've changed the dirver.
> - change the node name to humidity-sensor.
> 
>  .../bindings/iio/humidity/ti,hdc3020.yaml     | 63 +++++++++++++++++++
>  1 file changed, 63 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/humidity/ti,hdc3020.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iio/humidity/ti,hdc3020.yaml b/Documentation/devicetree/bindings/iio/humidity/ti,hdc3020.yaml
> new file mode 100644
> index 000000000000..08080bb9cd75
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/humidity/ti,hdc3020.yaml
> @@ -0,0 +1,63 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/humidity/ti,hdc3020.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: HDC3020/HDC3021/HDC3022 humidity and temperature iio sensors
> +
> +maintainers:
> +  - Li peiyu <579lpy@gmail.com>
> +
> +description:
> +  https://www.ti.com/lit/ds/symlink/hdc3020.pdf
> +
> +  The HDC302x is an integrated capacitive based relative humidity (RH)
> +  and temperature sensor.
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - items:
> +          - enum:
> +              - ti,hdc3021
> +              - ti,hdc3022
> +          - const: ti,hdc3020
> +      - items:
> +          - const: ti,hdc3020
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  vdd-supply: true
> +
> +  reg:
> +    maxItems: 1
> +
> +required:
> +  - compatible
Convention is to have power supplies that must be turned on in the
required even if you can have them supplied via stub regulators if they
aren't specified. This separates them from supplies that are really optional
such as optional reference supplies where there is an alternative internal
reference generator.

> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        humidity-sensor@47 {
> +            compatible = "ti,hdc3020";
> +            reg = <0x47>;
> +        };
> +    };
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        humidity-sensor@47 {
> +            compatible = "ti,hdc3021", "ti,hdc3020";
I'd just keep this one as an example. Good that you tested both, but now
we don't need two examples.  Also provide the vdd-supply.

Ideally I'd like the driver to turn it on with a devm_regulator_get_enable() call
as those are so simple, I'm not worried about if you've been able to test that or not.

> +            reg = <0x47>;
> +        };
> +    };
Conor Dooley Nov. 27, 2023, 5:53 p.m. UTC | #2
On Sat, Nov 25, 2023 at 06:27:49PM +0800, 579lpy@gmail.com wrote:
> From: Li peiyu <579lpy@gmail.com>
> 
> Add device tree bindings for HDC3020/HDC3021/HDC3022 humidity and
> temperature sensors.
> 
> Signed-off-by: Li peiyu <579lpy@gmail.com>

With Jonathans comments applied:
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Cheers,
Conor.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/humidity/ti,hdc3020.yaml b/Documentation/devicetree/bindings/iio/humidity/ti,hdc3020.yaml
new file mode 100644
index 000000000000..08080bb9cd75
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/humidity/ti,hdc3020.yaml
@@ -0,0 +1,63 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/humidity/ti,hdc3020.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: HDC3020/HDC3021/HDC3022 humidity and temperature iio sensors
+
+maintainers:
+  - Li peiyu <579lpy@gmail.com>
+
+description:
+  https://www.ti.com/lit/ds/symlink/hdc3020.pdf
+
+  The HDC302x is an integrated capacitive based relative humidity (RH)
+  and temperature sensor.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - ti,hdc3021
+              - ti,hdc3022
+          - const: ti,hdc3020
+      - items:
+          - const: ti,hdc3020
+
+  interrupts:
+    maxItems: 1
+
+  vdd-supply: true
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        humidity-sensor@47 {
+            compatible = "ti,hdc3020";
+            reg = <0x47>;
+        };
+    };
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        humidity-sensor@47 {
+            compatible = "ti,hdc3021", "ti,hdc3020";
+            reg = <0x47>;
+        };
+    };