Skip to contentSkip to conversation

dt-bindings: iio: adc: ti,ads7038: Add description for ADS7038

PATCH In review [email protected] 4 participants 4 messages Oct 16, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 dt-bindings: iio: adc: ti,ads7038: Add description for ADS7038

From: Andre Werner <[email protected]>

Add basic description for ADS7038 ADC devices. The devicetree adds the following device specific options:

- average-samples: Program device's programmable average filter.
- crc-enabled: Enable the CRC check for SPI transfers. Sadly, this option has currently no effect in the driver.
- status-enabled: Enable the appending of the device's status on the measure value transmission.
- gpio-controller: Sadly function not implemented yet in the driver.

---
v3
- Delete ADS7138 compatible and comments.
- Add options for CRC, status and average samples as well as gpio-controller.
- Update example.
- add regulator for digital IO voltage.

---
 .../bindings/iio/adc/ti,ads7038.yaml          | 83 +++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml
Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml new file +83 -0
new file mode 100644
index 000000000000..fc1054ca93f7
@@ -0,0 +1,83 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/ti,ads7038.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments ADS7038 and similar ADCs
+
+maintainers:
+  - Andre Werner <[email protected]>
+
+description: |
+  Family of 7 channel, 12 bit ADCs with SPI interface.
+
+  Datasheet: https://www.ti.com/lit/gpn/ads7038
+
+properties:
+  compatible:
+    enum:
+      - ti,ads7038
+
+  reg:
+    maxItems: 1
+
+  spi-max-frequency:
+    maximum: 60000000
+
+  avdd-supply:
+    description: Analog supply voltage, also used as the reference voltage to the ADC.
+
+  dvdd-supply:
+    description: Digital I/O supply voltage.
+
+  average-samples:
+    description: |
+      If specified ADC is configured for avaraging measurements (OSR_CFG Register).
+      This effects output format for measurement and sampling time.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1, 2, 3, 4, 5, 6, 7]
+
+  status-enabled:
+    description: |
+      If specified ADC transmits chip status (DATA_CFG Register).
+
+  crc-enabled:
+    description: |
+      Checking the integrity of the data bits exchanged over
+      SPI interface (GENERAL_CFG Register).
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+    description: |
+      Should be 2. See gpio.txt in this directory for a
+      description of the cells format.
+
+required:
+  - compatible
+  - reg
+  - avdd-supply
+  - dvdd-supply
+  - gpio-controller
+  - "#gpio-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        adc@0 {
+            compatible = "ti,ads7038";
+            reg = <0>;
+            avdd-supply = <&refin_avdd_supply>;
+            dvdd-supply = <&refin_dvdd_supply>;
+            spi-max-frequency = <10000000>;
+            gpio-controller;
+            #gpio-cells = <2>;
+        };
+    };
Signature · 1 line
2.42.0
#1 lore raw
Quoted 12 lines · On 16/10/2023 09:02, [email protected] wrote:

From: Andre Werner <[email protected]>

Add basic description for ADS7038 ADC devices. The devicetree adds the following device specific options:

- average-samples: Program device's programmable average filter.
- crc-enabled: Enable the CRC check for SPI transfers. Sadly, this option has currently no effect in the driver.
- status-enabled: Enable the appending of the device's status on the measure value transmission.
- gpio-controller: Sadly function not implemented yet in the driver.

Quoted 8 lines

---
v3
- Delete ADS7138 compatible and comments.
- Add options for CRC, status and average samples as well as gpio-controller.
- Update example.
- add regulator for digital IO voltage.

You received several build errors before. Did you really test it now, because looks like not.

Quoted 43 lines
---
 .../bindings/iio/adc/ti,ads7038.yaml          | 83 +++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml
Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml new file +32 -0
new file mode 100644
index 000000000000..fc1054ca93f7
@@ -0,0 +1,83 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/ti,ads7038.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments ADS7038 and similar ADCs
+
+maintainers:
+  - Andre Werner <[email protected]>
+
+description: |
+  Family of 7 channel, 12 bit ADCs with SPI interface.
+
+  Datasheet: https://www.ti.com/lit/gpn/ads7038
+
+properties:
+  compatible:
+    enum:
+      - ti,ads7038
+
+  reg:
+    maxItems: 1
+
+  spi-max-frequency:
+    maximum: 60000000
+
+  avdd-supply:
+    description: Analog supply voltage, also used as the reference voltage to the ADC.
+
+  dvdd-supply:
+    description: Digital I/O supply voltage.

Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml line 42

Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml new file +10 -0
+
+  average-samples:
+    description: |
+      If specified ADC is configured for avaraging measurements (OSR_CFG Register).
+      This effects output format for measurement and sampling time.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1, 2, 3, 4, 5, 6, 7]
+
+  status-enabled:
+    description: |

Do not need '|' unless you need to preserve formatting.

Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml line 43

Quoted 1 line
Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml new file +1 -0
+      If specified ADC transmits chip status (DATA_CFG Register).

Missing type.

You described the desired Linux feature or behavior, not the actual hardware. The bindings are about the latter, so instead you need to rephrase the property and its description to match actual hardware capabilities/features/configuration etc. Why this is a property of a board?

Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml line 48

Quoted 5 lines
Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml new file +5 -0
+
+  crc-enabled:
+    description: |
+      Checking the integrity of the data bits exchanged over
+      SPI interface (GENERAL_CFG Register).

Same comment.

Best regards,
Krzysztof

maintainer
#2 lore raw
Quoted 81 lines · On Mon, 16 Oct 2023 09:18:46 +0200 Krzysztof Kozlowski…
Quoted 12 lines · On 16/10/2023 09:02, [email protected] wrote:

From: Andre Werner <[email protected]>

Add basic description for ADS7038 ADC devices. The devicetree adds the following device specific options:

- average-samples: Program device's programmable average filter.
- crc-enabled: Enable the CRC check for SPI transfers. Sadly, this option has currently no effect in the driver.
- status-enabled: Enable the appending of the device's status on the measure value transmission.
- gpio-controller: Sadly function not implemented yet in the driver.

Quoted 8 lines

---
v3
- Delete ADS7138 compatible and comments.
- Add options for CRC, status and average samples as well as gpio-controller.
- Update example.
- add regulator for digital IO voltage.

You received several build errors before. Did you really test it now, because looks like not.

Quoted 43 lines
---
 .../bindings/iio/adc/ti,ads7038.yaml          | 83 +++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml
Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml new file +32 -0
new file mode 100644
index 000000000000..fc1054ca93f7
@@ -0,0 +1,83 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/ti,ads7038.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments ADS7038 and similar ADCs
+
+maintainers:
+  - Andre Werner <[email protected]>
+
+description: |
+  Family of 7 channel, 12 bit ADCs with SPI interface.
+
+  Datasheet: https://www.ti.com/lit/gpn/ads7038
+
+properties:
+  compatible:
+    enum:
+      - ti,ads7038
+
+  reg:
+    maxItems: 1
+
+  spi-max-frequency:
+    maximum: 60000000
+
+  avdd-supply:
+    description: Analog supply voltage, also used as the reference voltage to the ADC.
+
+  dvdd-supply:
+    description: Digital I/O supply voltage.

Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml line 42

Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml new file +10 -0
+
+  average-samples:
+    description: |
+      If specified ADC is configured for avaraging measurements (OSR_CFG Register).
+      This effects output format for measurement and sampling time.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1, 2, 3, 4, 5, 6, 7]
+
+  status-enabled:
+    description: |  

Do not need '|' unless you need to preserve formatting.

Quoted 8 lines

Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml line 43

Quoted 1 line
Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml new file +1 -0
+      If specified ADC transmits chip status (DATA_CFG Register).  

Missing type.

You described the desired Linux feature or behavior, not the actual hardware. The bindings are about the latter, so instead you need to rephrase the property and its description to match actual hardware capabilities/features/configuration etc. Why this is a property of a board?

Agreed - if this information is useful always transmit or enabling when whatever feature makes it useful is enabled by the driver / userspace interaction. If it's not useful don't :)

Quoted 8 lines

Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml line 48

Quoted 6 lines
Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml new file +5 -0
+
+  crc-enabled:
+    description: |
+      Checking the integrity of the data bits exchanged over
+      SPI interface (GENERAL_CFG Register).  

Same comment.

Even if you do want to make this controllable from userspace, we will need a strong argument for why. People rarely buy CRC capable chips and not want it turned on. I'd just always turn it on.

Quoted 6 lines

Best regards,
Krzysztof

maintainer
#3 lore raw
In reply to [email protected]
Quoted 20 lines · On Mon, 16 Oct 2023 09:02:04 +0200, [email protected] wrote:

From: Andre Werner <[email protected]>

Add basic description for ADS7038 ADC devices. The devicetree adds the following device specific options:

- average-samples: Program device's programmable average filter.
- crc-enabled: Enable the CRC check for SPI transfers. Sadly, this option has currently no effect in the driver.
- status-enabled: Enable the appending of the device's status on the measure value transmission.
- gpio-controller: Sadly function not implemented yet in the driver.

---
v3
- Delete ADS7138 compatible and comments.
- Add options for CRC, status and average samples as well as gpio-controller.
- Update example.
- add regulator for digital IO voltage.

Quoted 5 lines
---
 .../bindings/iio/adc/ti,ads7038.yaml          | 83 +++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads7038.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:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml: status-enabled: missing type definition /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/ti,ads7038.yaml: crc-enabled: missing type definition

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

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.