diff mbox series

[v2,11/13] dt-bindings: iio: add binding for BME680 driver

Message ID 20241021195316.58911-12-vassilisamir@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series : chemical: bme680: 2nd set of cleanup | expand

Commit Message

Vasileios Amoiridis Oct. 21, 2024, 7:53 p.m. UTC
Add dt-binding for BME680 gas sensor device. The device incorporates as
well temperature, pressure and relative humidity sensors.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
---
 .../bindings/iio/chemical/bosch,bme680.yaml   | 64 +++++++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  |  2 -
 2 files changed, 64 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml

Comments

Rob Herring (Arm) Oct. 21, 2024, 9:22 p.m. UTC | #1
On Mon, 21 Oct 2024 21:53:14 +0200, Vasileios Amoiridis wrote:
> Add dt-binding for BME680 gas sensor device. The device incorporates as
> well temperature, pressure and relative humidity sensors.
> 
> Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
> ---
>  .../bindings/iio/chemical/bosch,bme680.yaml   | 64 +++++++++++++++++++
>  .../devicetree/bindings/trivial-devices.yaml  |  2 -
>  2 files changed, 64 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/spi/spi-mux.example.dtb: sensor@1: 'vdd-supply' is a required property
	from schema $id: http://devicetree.org/schemas/iio/chemical/bosch,bme680.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/spi/spi-mux.example.dtb: sensor@1: 'vddio-supply' is a required property
	from schema $id: http://devicetree.org/schemas/iio/chemical/bosch,bme680.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/spi/spi-controller.example.dtb: sensor@1: 'vdd-supply' is a required property
	from schema $id: http://devicetree.org/schemas/iio/chemical/bosch,bme680.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/spi/spi-controller.example.dtb: sensor@1: 'vddio-supply' is a required property
	from schema $id: http://devicetree.org/schemas/iio/chemical/bosch,bme680.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/cirrus,cs42l43.example.dtb: sensor@0: 'vdd-supply' is a required property
	from schema $id: http://devicetree.org/schemas/iio/chemical/bosch,bme680.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/cirrus,cs42l43.example.dtb: sensor@0: 'vddio-supply' is a required property
	from schema $id: http://devicetree.org/schemas/iio/chemical/bosch,bme680.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20241021195316.58911-12-vassilisamir@gmail.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

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 after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Rob Herring (Arm) Oct. 22, 2024, 1:41 p.m. UTC | #2
On Mon, Oct 21, 2024 at 09:53:14PM +0200, Vasileios Amoiridis wrote:
> Add dt-binding for BME680 gas sensor device. The device incorporates as
> well temperature, pressure and relative humidity sensors.

You aren't adding a binding for bme680, but extending it.

Drop the 2nd 'bindings' from subject. 

Something like this:

dt-bindings: iio/chemical: bosch,bme680: Add supply properties

> 
> Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
> ---
>  .../bindings/iio/chemical/bosch,bme680.yaml   | 64 +++++++++++++++++++
>  .../devicetree/bindings/trivial-devices.yaml  |  2 -
>  2 files changed, 64 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml b/Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml
> new file mode 100644
> index 000000000000..e54df3afa7b2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml
> @@ -0,0 +1,64 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/chemical/bosch,bme680.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Bosch BME680 Gas sensor
> +
> +maintainers:
> +  - Vasileios Amoiridis <vassilisamir@gmail.com>
> +
> +description:

You need '>' to maintain paragraphs.

> +  BME680 is a gas sensor which combines relative humidity, barometric pressure,
> +  ambient temperature and gas (VOC - Volatile Organic Compounds) measurements.
> +
> +  https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf
> +
> +properties:
> +  compatible:
> +    const: bosch,bme680
> +
> +  reg:
> +    maxItems: 1
> +
> +  vdd-supply: true
> +  vddio-supply: true
> +
> +required:
> +  - compatible
> +  - reg
> +  - vdd-supply
> +  - vddio-supply

These supplies can't be required. That's an ABI change from what was 
already supported.

> +
> +allOf:
> +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        bme680@77 {
> +            compatible = "bosch,bme680";
> +            reg = <0x77>;
> +            vddio-supply = <&vddio>;
> +            vdd-supply = <&vdd>;
> +        };
> +    };
> +  - |
> +    spi {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        bme680@0 {
> +            compatible = "bosch,bme680";
> +            reg = <0>;
> +            spi-max-frequency = <500000>;
> +            vddio-supply = <&vddio>;
> +            vdd-supply = <&vdd>;
> +        };
> +    };
> diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
> index 0108d7507215..3d9c08ed7bce 100644
> --- a/Documentation/devicetree/bindings/trivial-devices.yaml
> +++ b/Documentation/devicetree/bindings/trivial-devices.yaml
> @@ -55,8 +55,6 @@ properties:
>            - atmel,atsha204a
>              # BPA-RS600: Power Supply
>            - blutek,bpa-rs600
> -            # Bosch Sensortec pressure, temperature, humididty and VOC sensor
> -          - bosch,bme680
>              # CM32181: Ambient Light Sensor
>            - capella,cm32181
>              # CM3232: Ambient Light Sensor
> -- 
> 2.43.0
>
Jonathan Cameron Oct. 22, 2024, 5:24 p.m. UTC | #3
On Tue, 22 Oct 2024 08:41:02 -0500
Rob Herring <robh@kernel.org> wrote:

> On Mon, Oct 21, 2024 at 09:53:14PM +0200, Vasileios Amoiridis wrote:
> > Add dt-binding for BME680 gas sensor device. The device incorporates as
> > well temperature, pressure and relative humidity sensors.  
> 
> You aren't adding a binding for bme680, but extending it.
> 
> Drop the 2nd 'bindings' from subject. 
> 
> Something like this:
> 
> dt-bindings: iio/chemical: bosch,bme680: Add supply properties
> 
> > 
> > Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
> > ---
> >  .../bindings/iio/chemical/bosch,bme680.yaml   | 64 +++++++++++++++++++
> >  .../devicetree/bindings/trivial-devices.yaml  |  2 -
> >  2 files changed, 64 insertions(+), 2 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml b/Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml
> > new file mode 100644
> > index 000000000000..e54df3afa7b2
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml
> > @@ -0,0 +1,64 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/chemical/bosch,bme680.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Bosch BME680 Gas sensor
> > +
> > +maintainers:
> > +  - Vasileios Amoiridis <vassilisamir@gmail.com>
> > +
> > +description:  
> 
> You need '>' to maintain paragraphs.
> 
> > +  BME680 is a gas sensor which combines relative humidity, barometric pressure,
> > +  ambient temperature and gas (VOC - Volatile Organic Compounds) measurements.
> > +
> > +  https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf
> > +
> > +properties:
> > +  compatible:
> > +    const: bosch,bme680
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  vdd-supply: true
> > +  vddio-supply: true
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - vdd-supply
> > +  - vddio-supply  
> 
> These supplies can't be required. That's an ABI change from what was 
> already supported.
Hi Rob,

I thought for supplies the convention was that if the power is needed
for functioning device then to put them as required.

In case were they were missing in an original binding
allow stub regulators to deal with a DT that predates that.
Non linux cases are obviously trickier to predict but these
supplies must be on or the binding wouldn't have worked before this
point.

I remember I was very much on the side that they were optional and
convinced by others that this was the way to go.

We've added supplies for old bindings as required in the past
so probably broken someone if I have this wrong :(

Jonathan
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml b/Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml
new file mode 100644
index 000000000000..e54df3afa7b2
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/chemical/bosch,bme680.yaml
@@ -0,0 +1,64 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/chemical/bosch,bme680.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bosch BME680 Gas sensor
+
+maintainers:
+  - Vasileios Amoiridis <vassilisamir@gmail.com>
+
+description:
+  BME680 is a gas sensor which combines relative humidity, barometric pressure,
+  ambient temperature and gas (VOC - Volatile Organic Compounds) measurements.
+
+  https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bme680-ds001.pdf
+
+properties:
+  compatible:
+    const: bosch,bme680
+
+  reg:
+    maxItems: 1
+
+  vdd-supply: true
+  vddio-supply: true
+
+required:
+  - compatible
+  - reg
+  - vdd-supply
+  - vddio-supply
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        bme680@77 {
+            compatible = "bosch,bme680";
+            reg = <0x77>;
+            vddio-supply = <&vddio>;
+            vdd-supply = <&vdd>;
+        };
+    };
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        bme680@0 {
+            compatible = "bosch,bme680";
+            reg = <0>;
+            spi-max-frequency = <500000>;
+            vddio-supply = <&vddio>;
+            vdd-supply = <&vdd>;
+        };
+    };
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index 0108d7507215..3d9c08ed7bce 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -55,8 +55,6 @@  properties:
           - atmel,atsha204a
             # BPA-RS600: Power Supply
           - blutek,bpa-rs600
-            # Bosch Sensortec pressure, temperature, humididty and VOC sensor
-          - bosch,bme680
             # CM32181: Ambient Light Sensor
           - capella,cm32181
             # CM3232: Ambient Light Sensor