Skip to contentSkip to conversation

dt-bindings: iio: adc: avia-hx711: add avia,hx710b compatible

PATCH Superseded Piyush Patle 4 participants 4 messages Apr 18 – Apr 19

Subsystems (3)

v1 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dt-bindings: iio: adc: avia-hx711: add avia,hx710b compatible

Add the HX710B compatible to the binding and describe the variant-specific channel and gain model.

Also add an example node for HX710B so the schema covers both supported parts.

---
 .../bindings/iio/adc/avia-hx711.yaml          | 36 +++++++++++++++----
 1 file changed, 30 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +30 -6
index 9c57eb13f892..19318c4dd994 100644
@@ -4,7 +4,7 @@
 $id: http://devicetree.org/schemas/iio/adc/avia-hx711.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: AVIA HX711 ADC chip for weight cells
+title: AVIA HX711 and HX710B ADCs
 
 maintainers:
   - Andreas Klinger <[email protected]>
@@ -12,9 +12,19 @@ maintainers:
 description: |
   Bit-banging driver using two GPIOs:
   - sck-gpio gives a clock to the sensor with 24 cycles for data retrieval
-    and up to 3 cycles for selection of the input channel and gain for the
-    next measurement
-  - dout-gpio is the sensor data the sensor responds to the clock
+    and 1 to 3 additional cycles for selection of the input channel and gain
+    for the next measurement
+  - dout-gpio is the sensor data output the sensor drives in response to
+    the clock
+
+  HX711: 24-bit ADC with selectable gain (32/64/128) and two differential
+  input channels. Channel A supports gain 64 and 128; channel B supports
+  gain 32.
+
+  HX710B: 24-bit ADC with fixed gain of 128. Channel 0 is the differential
+  input and channel 1 measures the DVDD-AVDD supply voltage difference.
+  Channel selection for the next conversion is controlled by the number of
+  trailing PD_SCK pulses.
 
   Specifications about the driver can be found at:
   http://www.aviaic.com/ENProducts.aspx
@@ -23,11 +33,12 @@ properties:
   compatible:
     enum:
       - avia,hx711
+      - avia,hx710b
 
   sck-gpios:
     description:
       Definition of the GPIO for the clock (output). In the datasheet it is
-      named PD_SCK
+      named PD_SCK.
     maxItems: 1
 
   dout-gpios:
@@ -43,6 +54,9 @@ properties:
       Definition of the regulator used as analog supply
 
   clock-frequency:
+    description:
+      Bit-bang clock frequency on PD_SCK. Keep the PD_SCK high time below
+      the chip power-down threshold.
     minimum: 20000
     maximum: 2500000
     default: 400000
@@ -58,10 +72,20 @@ additionalProperties: false
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
-    weight {
+    /* HX711 example */
+    weight0 {
         compatible = "avia,hx711";
         sck-gpios = <&gpio3 10 GPIO_ACTIVE_HIGH>;
         dout-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
         avdd-supply = <&avdd>;
         clock-frequency = <100000>;
     };
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    /* HX710B example */
+    weight1 {
+        compatible = "avia,hx710b";
+        sck-gpios = <&gpio3 11 GPIO_ACTIVE_HIGH>;
+        dout-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
+        avdd-supply = <&avdd>;
+    };
Signature · 1 line
2.43.0
reviewer
#1 lore raw
Quoted 34 lines · Piyush Patle

Add the HX710B compatible to the binding and describe the variant-specific channel and gain model.

Also add an example node for HX710B so the schema covers both supported parts.

---
 .../bindings/iio/adc/avia-hx711.yaml          | 36 +++++++++++++++----
 1 file changed, 30 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +4 -4
index 9c57eb13f892..19318c4dd994 100644
@@ -4,7 +4,7 @@
 $id: http://devicetree.org/schemas/iio/adc/avia-hx711.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: AVIA HX711 ADC chip for weight cells
+title: AVIA HX711 and HX710B ADCs
 
 maintainers:
   - Andreas Klinger <[email protected]>
@@ -12,9 +12,19 @@ maintainers:
 description: |
   Bit-banging driver using two GPIOs:
   - sck-gpio gives a clock to the sensor with 24 cycles for data retrieval
-    and up to 3 cycles for selection of the input channel and gain for the
-    next measurement
-  - dout-gpio is the sensor data the sensor responds to the clock
+    and 1 to 3 additional cycles for selection of the input channel and gain
+    for the next measurement
+  - dout-gpio is the sensor data output the sensor drives in response to

Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml maintainers: · line 27

Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +10 -0
+    the clock
+
+  HX711: 24-bit ADC with selectable gain (32/64/128) and two differential
+  input channels. Channel A supports gain 64 and 128; channel B supports
+  gain 32.
+
+  HX710B: 24-bit ADC with fixed gain of 128. Channel 0 is the differential
+  input and channel 1 measures the DVDD-AVDD supply voltage difference.
+  Channel selection for the next conversion is controlled by the number of
+  trailing PD_SCK pulses.

The bits about "bit-banging" and "channel selection" sound like driver implementation details that don't belong in the DT bindings.

Quoted 4 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +0 -0
   Specifications about the driver can be found at:
   http://www.aviaic.com/ENProducts.aspx

Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml properties: · line 41

Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +2 -1
@@ -23,11 +33,12 @@ properties:
   compatible:
     enum:
       - avia,hx711
+      - avia,hx710b
 
   sck-gpios:
     description:
       Definition of the GPIO for the clock (output). In the datasheet it is
-      named PD_SCK
+      named PD_SCK.

Save the cleanups for a separate patch to keep the adding HX710B changes clear.

I'm guessing the existing binding for HX711 is quite old because it is quite incomplete.

It has avdd-supply, but is missing vsup-supply and dvdd-supply.

It should probably also have a way to describe how the rate pin is wired.

And it should have a clocks property instead of clock-frequency.

It would make sense to have two clocks, on for XI/XO and one for PD_SCK. The second one being optional because of sck-gpios.

HX710B has many fewer pins, so we will need an:

allOf:
- if:

      properties:
	compatible:
	  const: avia,hx710b

section that sets anything for pins that chip doesn't have to false, like vsup-supply.

HX710B also has a vref-supply that HX711 doesn't have. (Unless these are the same thing by a different name?)

Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml properties: · line 59

Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +3 -0
     maxItems: 1
 
   dout-gpios:
@@ -43,6 +54,9 @@ properties:
       Definition of the regulator used as analog supply
 
   clock-frequency:
+    description:
+      Bit-bang clock frequency on PD_SCK. Keep the PD_SCK high time below
+      the chip power-down threshold.

I suspect that this was meant to be the crystal frequency (XI/XO), not PD_SCK since sck-gpios already exists for PD_SCK

Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml additionalProperties: false · line 75

Quoted 9 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +1 -1
     minimum: 20000
     maximum: 2500000
     default: 400000
@@ -58,10 +72,20 @@ additionalProperties: false
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
-    weight {
+    /* HX711 example */

The compatible string already has the part number, so this comment doesn't really and any new info.

Quoted 6 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +1 -0
+    weight0 {
         compatible = "avia,hx711";
         sck-gpios = <&gpio3 10 GPIO_ACTIVE_HIGH>;
         dout-gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
         avdd-supply = <&avdd>;
         clock-frequency = <100000>;

Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml additionalProperties: false · line 91

Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +9 -0
     };
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    /* HX710B example */
+    weight1 {
+        compatible = "avia,hx710b";
+        sck-gpios = <&gpio3 11 GPIO_ACTIVE_HIGH>;
+        dout-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
+        avdd-supply = <&avdd>;
+    };

There is nothing significantly different about this example, so it isn't particularly useful.

maintainer
#2 lore raw

Hi,

David Lechner <[email protected]> schrieb am Sa, 18. Apr 16:46:

Quoted 1 line · Piyush Patle

[...]

Quoted 17 lines
Quoted 4 lines

Specifications about the driver can be found at:
http://www.aviaic.com/ENProducts.aspx

Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml properties: · line 41

Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +2 -1
@@ -23,11 +33,12 @@ properties:
   compatible:
     enum:
       - avia,hx711
+      - avia,hx710b
 
   sck-gpios:
     description:
       Definition of the GPIO for the clock (output). In the datasheet it is
-      named PD_SCK
+      named PD_SCK.

Save the cleanups for a separate patch to keep the adding HX710B changes clear.

Quoted 8 lines

I'm guessing the existing binding for HX711 is quite old because it is quite incomplete.

It has avdd-supply, but is missing vsup-supply and dvdd-supply.

It should probably also have a way to describe how the rate pin is wired.

And it should have a clocks property instead of clock-frequency.

The real meaning is a wait time until the DOUT is stable. As a submitted the driver many years ago my suggestion of a wait time property was not accepted because it would have introduced a new property which didn't exit in those days. The suggestion was to name it clock-frequency because it already existed. This clock-frequency made the driver also a little bit more complicated because at the end we needed a waiting time and not a frequency.

Today i see there is as "wait-delay" property already introduced at other bindings. This would also simplify the driver a bit.

@[email protected], @[email protected], @[email protected]:
Would this change in the binding be acceptable?

If yes, i could prepare a driver and binding patch separate of this patchset to clean it up.

Quoted 24 lines

It would make sense to have two clocks, on for XI/XO and one for PD_SCK. The second one being optional because of sck-gpios.

HX710B has many fewer pins, so we will need an:

allOf:
- if:

      properties:
	compatible:
	  const: avia,hx710b

section that sets anything for pins that chip doesn't have to false, like vsup-supply.

HX710B also has a vref-supply that HX711 doesn't have. (Unless these are the same thing by a different name?)

Quoted 6 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +0 -0
     maxItems: 1
 
   dout-gpios:
@@ -43,6 +54,9 @@ properties:
       Definition of the regulator used as analog supply
 
Quoted 7 lines

Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml properties: · line 59

Quoted 4 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +3 -0
   clock-frequency:
+    description:
+      Bit-bang clock frequency on PD_SCK. Keep the PD_SCK high time below
+      the chip power-down threshold.

I suspect that this was meant to be the crystal frequency (XI/XO), not PD_SCK since sck-gpios already exists for PD_SCK

see above

[...]

Best regards,

Andreas

maintainer
#3 lore raw
Quoted 40 lines · On Sun, 19 Apr 2026 07:17:50 +0200 Andreas Klinger <[email protected]> wrote:

Hi,

David Lechner <[email protected]> schrieb am Sa, 18. Apr 16:46:

Quoted 1 line · Piyush Patle

[...]

Quoted 17 lines
Quoted 4 lines

Specifications about the driver can be found at:
http://www.aviaic.com/ENProducts.aspx

Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml properties: · line 41

Quoted 10 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +2 -1
@@ -23,11 +33,12 @@ properties:
   compatible:
     enum:
       - avia,hx711
+      - avia,hx710b
 
   sck-gpios:
     description:
       Definition of the GPIO for the clock (output). In the datasheet it is
-      named PD_SCK
+      named PD_SCK.  

Save the cleanups for a separate patch to keep the adding HX710B changes clear.

Quoted 8 lines

I'm guessing the existing binding for HX711 is quite old because it is quite incomplete.

It has avdd-supply, but is missing vsup-supply and dvdd-supply.

It should probably also have a way to describe how the rate pin is wired.

And it should have a clocks property instead of clock-frequency.

The real meaning is a wait time until the DOUT is stable. As a submitted the driver many years ago my suggestion of a wait time property was not accepted because it would have introduced a new property which didn't exit in those days. The suggestion was to name it clock-frequency because it already existed. This clock-frequency made the driver also a little bit more complicated because at the end we needed a waiting time and not a frequency.

Quoted 8 lines

Today i see there is as "wait-delay" property already introduced at other bindings. This would also simplify the driver a bit.

@[email protected], @[email protected], @[email protected]:
Would this change in the binding be acceptable?

If yes, i could prepare a driver and binding patch separate of this patchset to clean it up.

You would need to maintain backwards compatiblity with the old binding. Might be fine to deprecate it.

Jonathan

Quoted 41 lines
Quoted 25 lines

It would make sense to have two clocks, on for XI/XO and one for PD_SCK. The second one being optional because of sck-gpios.

HX710B has many fewer pins, so we will need an:

allOf:
- if:

      properties:
	compatible:
	  const: avia,hx710b

section that sets anything for pins that chip doesn't have to false, like vsup-supply.

HX710B also has a vref-supply that HX711 doesn't have. (Unless these are the same thing by a different name?)

Quoted 6 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +0 -0
     maxItems: 1
 
   dout-gpios:
@@ -43,6 +54,9 @@ properties:
       Definition of the regulator used as analog supply
 
Quoted 7 lines

Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml properties: · line 59

Quoted 4 lines
Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml +3 -0
   clock-frequency:
+    description:
+      Bit-bang clock frequency on PD_SCK. Keep the PD_SCK high time below
+      the chip power-down threshold.  

I suspect that this was meant to be the crystal frequency (XI/XO), not PD_SCK since sck-gpios already exists for PD_SCK

see above

[...]

Best regards,

Andreas