diff mbox series

[2/3] dt-bindings: add device tree support for winsen MHZ19B CO2 sensor

Message ID 20250329164905.632491-3-gye976@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series add support for winsen MHZ19B CO2 sensor | expand

Commit Message

gyeyoung March 29, 2025, 4:49 p.m. UTC
Add device tree support for winsen MHZ19B sensor.

Signed-off-by: Gyeyoung Baek <gye976@gmail.com>
---
 .../bindings/iio/chemical/winsen,mhz19b.yaml  | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml

Comments

Krzysztof Kozlowski March 30, 2025, 9:39 a.m. UTC | #1
On 29/03/2025 17:49, Gyeyoung Baek wrote:
> Add device tree support for winsen MHZ19B sensor.
> 
> Signed-off-by: Gyeyoung Baek <gye976@gmail.com>
> ---
>  .../bindings/iio/chemical/winsen,mhz19b.yaml  | 31 +++++++++++++++++++
>  1 file changed, 31 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml b/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
> new file mode 100644
> index 000000000000..c08681e43281
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
> @@ -0,0 +1,31 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/chemical/dht11.yaml#

Never tested.

> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MHZ19B CO2 sensor
> +
> +maintainers:
> +  - Gyeyoung Baek <gye976@gmail.com>
> +
> +description: |
> +   CO2 sensor using UART serdev bus interface.

serdev is Linux thing. Just drop description.

> +
> +properties:
> +  compatible:
> +    const: winsen,mhz19b
> +
> +required:
> +  - compatible
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    serial {
> +      mhz19b-co2-sensor {

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation



Best regards,
Krzysztof
Jonathan Cameron March 30, 2025, 12:50 p.m. UTC | #2
On Sun, 30 Mar 2025 01:49:04 +0900
Gyeyoung Baek <gye976@gmail.com> wrote:

> Add device tree support for winsen MHZ19B sensor.
> 
> Signed-off-by: Gyeyoung Baek <gye976@gmail.com>
> ---
>  .../bindings/iio/chemical/winsen,mhz19b.yaml  | 31 +++++++++++++++++++
>  1 file changed, 31 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml b/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
> new file mode 100644
> index 000000000000..c08681e43281
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
> @@ -0,0 +1,31 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/chemical/dht11.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MHZ19B CO2 sensor
> +
> +maintainers:
> +  - Gyeyoung Baek <gye976@gmail.com>
> +
> +description: |
> +   CO2 sensor using UART serdev bus interface.
> +
> +properties:
> +  compatible:
> +    const: winsen,mhz19b
Hi, 

Welcome to IIO. 

Just one additional comment from me.

Bindings should be as complete as possible and also reflect
the existence of things like power supplies even if your particular
board is relying in them being always turned on.

So you need 
vin-supply: true;

and add it to the required items.




> +
> +required:
> +  - compatible
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    serial {
> +      mhz19b-co2-sensor {
> +        compatible = "winsen,mhz19b";
> +      };
> +    };
> +...
gyeyoung March 31, 2025, 1:11 a.m. UTC | #3
On Sun, Mar 30, 2025 at 6:39 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On 29/03/2025 17:49, Gyeyoung Baek wrote:
> > Add device tree support for winsen MHZ19B sensor.
> >
> > Signed-off-by: Gyeyoung Baek <gye976@gmail.com>
> > ---
> >  .../bindings/iio/chemical/winsen,mhz19b.yaml  | 31 +++++++++++++++++++
> >  1 file changed, 31 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml b/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
> > new file mode 100644
> > index 000000000000..c08681e43281
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
> > @@ -0,0 +1,31 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/chemical/dht11.yaml#
>
> Never tested.

sorry, I missed that, my mistake.

> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: MHZ19B CO2 sensor
> > +
> > +maintainers:
> > +  - Gyeyoung Baek <gye976@gmail.com>
> > +
> > +description: |
> > +   CO2 sensor using UART serdev bus interface.
>
> serdev is Linux thing. Just drop description.

oh, I see that a hardware-specific description is needed here.
I now understand the documentation style. thanks.

> > +
> > +properties:
> > +  compatible:
> > +    const: winsen,mhz19b
> > +
> > +required:
> > +  - compatible
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    serial {
> > +      mhz19b-co2-sensor {
>
> Node names should be generic. See also an explanation and list of
> examples (not exhaustive) in DT specification:
> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
>
>
>
> Best regards,
> Krzysztof

Thanks,
Gyeyoung Baek
gyeyoung March 31, 2025, 1:32 a.m. UTC | #4
Hello Jonathan, thank you for the review.


On Sun, Mar 30, 2025 at 9:50 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Sun, 30 Mar 2025 01:49:04 +0900
> Gyeyoung Baek <gye976@gmail.com> wrote:
>
> > Add device tree support for winsen MHZ19B sensor.
> >
> > Signed-off-by: Gyeyoung Baek <gye976@gmail.com>
> > ---
> >  .../bindings/iio/chemical/winsen,mhz19b.yaml  | 31 +++++++++++++++++++
> >  1 file changed, 31 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml b/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
> > new file mode 100644
> > index 000000000000..c08681e43281
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
> > @@ -0,0 +1,31 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/chemical/dht11.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: MHZ19B CO2 sensor
> > +
> > +maintainers:
> > +  - Gyeyoung Baek <gye976@gmail.com>
> > +
> > +description: |
> > +   CO2 sensor using UART serdev bus interface.
> > +
> > +properties:
> > +  compatible:
> > +    const: winsen,mhz19b
> Hi,
>
> Welcome to IIO.
>
> Just one additional comment from me.
>
> Bindings should be as complete as possible and also reflect
> the existence of things like power supplies even if your particular
> board is relying in them being always turned on.
>
> So you need
> vin-supply: true;
>
> and add it to the required items.
>

Yes, I will add that by referring to other IIO code. thanks.

>
>
> > +
> > +required:
> > +  - compatible
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    serial {
> > +      mhz19b-co2-sensor {
> > +        compatible = "winsen,mhz19b";
> > +      };
> > +    };
> > +...
>

Thanks,
Gyeyoung Baek
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml b/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
new file mode 100644
index 000000000000..c08681e43281
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/chemical/winsen,mhz19b.yaml
@@ -0,0 +1,31 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/chemical/dht11.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MHZ19B CO2 sensor
+
+maintainers:
+  - Gyeyoung Baek <gye976@gmail.com>
+
+description: |
+   CO2 sensor using UART serdev bus interface.
+
+properties:
+  compatible:
+    const: winsen,mhz19b
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    serial {
+      mhz19b-co2-sensor {
+        compatible = "winsen,mhz19b";
+      };
+    };
+...