Devicetree
 help / color / mirror / Atom feed
* [PATCH v3 0/2] iio: adc: ti-ads1119: Add driver
@ 2024-06-17 18:32 Francesco Dolcini
  2024-06-17 18:32 ` [PATCH v3 1/2] dt-bindings: iio: adc: add ti,ads1119 Francesco Dolcini
  0 siblings, 1 reply; 4+ messages in thread
From: Francesco Dolcini @ 2024-06-17 18:32 UTC (permalink / raw)
  To: Francesco Dolcini, João Paulo Gonçalves,
	Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Liam Girdwood, Mark Brown
  Cc: Francesco Dolcini, linux-iio, devicetree, linux-kernel

From: Francesco Dolcini <francesco.dolcini@toradex.com>

The ADS1119 is a precision, 16-bit, analog-to-digital converter (ADC)
that features two differential or four single-ended inputs through a
flexible input multiplexer (MUX), rail-to-rail input
buffers, a programmable gain stage, a voltage reference, and an
oscillator.

Apart from normal single conversion, the driver also supports
continuous conversion mode using a triggered buffer. However, in this
mode only one channel can be scanned at a time.

v3:
 bindings:
 - add avdd and dvdd supplies
 - add Reviewed-by: Conor Dooley <conor.dooley@microchip.com

 driver:
 - add MICRO constant on necessary places 
 - add devm_regulator_bulk_get_enable() to handle avdd/dvdd supplies
 - add power down action with devm_add_action_or_reset()
 - add buffer setup functions
 - add iio_validate_scan_mask_onehot() to guarantee only one scan channels
 - add support to other triggers than only the adc irq
 - add device check to adc irq trigger to guarantee associating it only its own device
 - add a cached value for the config register
 - change ads1119_get_hw_datarate() return  
 - change return location in read_raw() and write_raw() 
 - change return location in ads1119_read_data() 
 - change the scan buf to a local struct with correct size and alignment
 - change ads1119_update_config_reg() to ads1119_upd_cfg_reg()
 - fix over wrap in read_poll_timeout() 
 - remove unnecessary goto label in ads1119_single_conversion() 
 - remove unnecessary empty lines 
 - remove scan mask from the driver state
 - remove ads1119_validate_gain() and call it inline in write_raw()
 - remove all ads1119_cmd functions and use i2c_smbus inline

v2: https://lore.kernel.org/all/20240606163529.87528-1-francesco@dolcini.it/
 bindings:
 - add diff-channels and single-channel
 - remove ti,gain and ti,datarate
 - more details on the patch changelog

 driver:
 - adaptation for the binding changes
 - changed i2c read/write to the device (not using regmap anymore, use FIELD macros)
 - more details on the patch changelog

v1: https://lore.kernel.org/all/20240527154050.24975-1-francesco@dolcini.it/

João Paulo Gonçalves (2):
  dt-bindings: iio: adc: add ti,ads1119
  iio: adc: ti-ads1119: Add driver

 .../bindings/iio/adc/ti,ads1119.yaml          | 155 ++++
 MAINTAINERS                                   |   8 +
 drivers/iio/adc/Kconfig                       |  12 +
 drivers/iio/adc/Makefile                      |   1 +
 drivers/iio/adc/ti-ads1119.c                  | 839 ++++++++++++++++++
 5 files changed, 1015 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1119.yaml
 create mode 100644 drivers/iio/adc/ti-ads1119.c

-- 
2.39.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 1/2] dt-bindings: iio: adc: add ti,ads1119
  2024-06-17 18:32 [PATCH v3 0/2] iio: adc: ti-ads1119: Add driver Francesco Dolcini
@ 2024-06-17 18:32 ` Francesco Dolcini
  2024-06-17 19:30   ` Rob Herring (Arm)
  0 siblings, 1 reply; 4+ messages in thread
From: Francesco Dolcini @ 2024-06-17 18:32 UTC (permalink / raw)
  To: Francesco Dolcini, João Paulo Gonçalves,
	Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: João Paulo Gonçalves, linux-iio, devicetree,
	linux-kernel, Francesco Dolcini, Conor Dooley

From: João Paulo Gonçalves <joao.goncalves@toradex.com>

Add devicetree bindings for Texas Instruments ADS1119 16-bit ADC
with I2C interface.

Datasheet: https://www.ti.com/lit/gpn/ads1119
Signed-off-by: João Paulo Gonçalves <joao.goncalves@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
---
v3:
 - add avdd and dvdd supplies
 - add Reviewed-by: Conor Dooley <conor.dooley@microchip.com

v2:
 - add diff-channels and single-channel
 - add XOR check to make diff/single channel property required 
 - add interrupts, reset-gpios and vref-supply to the example 
 - fix missing additionalProperties/unevaluatedProperties warning in channels
 - remove ti,gain and ti,datarate as they aren't fixed hw properties
 - remove unnecessary | 
---
 .../bindings/iio/adc/ti,ads1119.yaml          | 155 ++++++++++++++++++
 MAINTAINERS                                   |   7 +
 2 files changed, 162 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1119.yaml

diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads1119.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads1119.yaml
new file mode 100644
index 000000000000..ba6850ab1f90
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/ti,ads1119.yaml
@@ -0,0 +1,155 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/ti,ads1119.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments ADS1119 ADC
+
+maintainers:
+  - João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
+
+description:
+  The TI ADS1119 is a precision 16-bit ADC over I2C that offers single-ended and
+  differential measurements using a multiplexed input. It features a programmable
+  gain, a programmable sample rate, an internal oscillator and voltage reference,
+  and a 50/60Hz rejection filter.
+
+properties:
+  compatible:
+    const: ti,ads1119
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  avdd-supply: true
+  dvdd-supply: true
+
+  vref-supply:
+    description:
+      ADC external reference voltage (VREF).
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  "#io-channel-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+  - avdd-supply
+  - dvdd-supply
+
+patternProperties:
+  "^channel@([0-6])$":
+    $ref: adc.yaml
+    type: object
+    properties:
+      reg:
+        minimum: 0
+        maximum: 6
+
+      diff-channels:
+        description:
+          Differential input channels AIN0-AIN1, AIN2-AIN3 and AIN1-AIN2.
+        oneOf:
+          - items:
+              - const: 0
+              - const: 1
+          - items:
+              - const: 2
+              - const: 3
+          - items:
+              - const: 1
+              - const: 2
+
+      single-channel:
+        description:
+          Single-ended input channels AIN0, AIN1, AIN2 and AIN3.
+        minimum: 0
+        maximum: 3
+
+    oneOf:
+      - required:
+          - diff-channels
+      - required:
+          - single-channel
+
+    required:
+      - reg
+
+    unevaluatedProperties: false
+
+additionalProperties: false
+
+examples:
+  - |
+
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        adc@40 {
+            compatible = "ti,ads1119";
+            reg = <0x40>;
+            interrupt-parent = <&gpio1>;
+            interrupts = <25 IRQ_TYPE_EDGE_FALLING>;
+            reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
+            avdd-supply = <&reg_avdd_ads1119>;
+            dvdd-supply = <&reg_dvdd_ads1119>;
+            vref-supply = <&reg_vref_ads1119>;
+            #address-cells = <1>;
+            #size-cells = <0>;
+            #io-channel-cells = <1>;
+
+            channel@0 {
+                reg = <0>;
+                single-channel = <0>;
+            };
+
+            channel@1 {
+                reg = <1>;
+                diff-channels = <0 1>;
+            };
+
+            channel@2 {
+                reg = <2>;
+                single-channel = <3>;
+            };
+
+            channel@3 {
+                reg = <3>;
+                single-channel = <1>;
+            };
+
+            channel@4 {
+                reg = <4>;
+                single-channel = <2>;
+            };
+
+            channel@5 {
+                reg = <5>;
+                diff-channels = <1 2>;
+            };
+
+            channel@6 {
+                reg = <6>;
+                diff-channels = <2 3>;
+            };
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index bff979a507ba..8acc2c83605c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -22390,6 +22390,13 @@ M:	Robert Richter <rric@kernel.org>
 S:	Odd Fixes
 F:	drivers/gpio/gpio-thunderx.c
 
+TI ADS1119 ADC DRIVER
+M:	Francesco Dolcini <francesco@dolcini.it>
+M:	João Paulo Gonçalves <jpaulo.silvagoncalves@gmail.com>
+L:	linux-iio@vger.kernel.org
+S:	Maintained
+F:	Documentation/devicetree/bindings/iio/adc/ti,ads1119.yaml
+
 TI ADS7924 ADC DRIVER
 M:	Hugo Villeneuve <hvilleneuve@dimonoff.com>
 L:	linux-iio@vger.kernel.org
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: iio: adc: add ti,ads1119
  2024-06-17 18:32 ` [PATCH v3 1/2] dt-bindings: iio: adc: add ti,ads1119 Francesco Dolcini
@ 2024-06-17 19:30   ` Rob Herring (Arm)
  2024-06-17 20:02     ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Herring (Arm) @ 2024-06-17 19:30 UTC (permalink / raw)
  To: Francesco Dolcini
  Cc: linux-iio, Lars-Peter Clausen, João Paulo Gonçalves,
	João Paulo Gonçalves, Conor Dooley, Krzysztof Kozlowski,
	devicetree, Conor Dooley, linux-kernel, Francesco Dolcini,
	Jonathan Cameron


On Mon, 17 Jun 2024 20:32:14 +0200, Francesco Dolcini wrote:
> From: João Paulo Gonçalves <joao.goncalves@toradex.com>
> 
> Add devicetree bindings for Texas Instruments ADS1119 16-bit ADC
> with I2C interface.
> 
> Datasheet: https://www.ti.com/lit/gpn/ads1119
> Signed-off-by: João Paulo Gonçalves <joao.goncalves@toradex.com>
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
> ---
> v3:
>  - add avdd and dvdd supplies
>  - add Reviewed-by: Conor Dooley <conor.dooley@microchip.com
> 
> v2:
>  - add diff-channels and single-channel
>  - add XOR check to make diff/single channel property required
>  - add interrupts, reset-gpios and vref-supply to the example
>  - fix missing additionalProperties/unevaluatedProperties warning in channels
>  - remove ti,gain and ti,datarate as they aren't fixed hw properties
>  - remove unnecessary |
> ---
>  .../bindings/iio/adc/ti,ads1119.yaml          | 155 ++++++++++++++++++
>  MAINTAINERS                                   |   7 +
>  2 files changed, 162 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1119.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/iio/adc/ti,ads1119.yaml: single-channel: missing type definition

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240617183215.4080-2-francesco@dolcini.it

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: iio: adc: add ti,ads1119
  2024-06-17 19:30   ` Rob Herring (Arm)
@ 2024-06-17 20:02     ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2024-06-17 20:02 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Francesco Dolcini, linux-iio, Lars-Peter Clausen,
	João Paulo Gonçalves, João Paulo Gonçalves,
	Conor Dooley, Krzysztof Kozlowski, devicetree, Conor Dooley,
	linux-kernel, Francesco Dolcini

On Mon, 17 Jun 2024 13:30:01 -0600
"Rob Herring (Arm)" <robh@kernel.org> wrote:

> On Mon, 17 Jun 2024 20:32:14 +0200, Francesco Dolcini wrote:
> > From: João Paulo Gonçalves <joao.goncalves@toradex.com>
> > 
> > Add devicetree bindings for Texas Instruments ADS1119 16-bit ADC
> > with I2C interface.
> > 
> > Datasheet: https://www.ti.com/lit/gpn/ads1119
> > Signed-off-by: João Paulo Gonçalves <joao.goncalves@toradex.com>
> > Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> > Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
> > ---
> > v3:
> >  - add avdd and dvdd supplies
> >  - add Reviewed-by: Conor Dooley <conor.dooley@microchip.com
> > 
> > v2:
> >  - add diff-channels and single-channel
> >  - add XOR check to make diff/single channel property required
> >  - add interrupts, reset-gpios and vref-supply to the example
> >  - fix missing additionalProperties/unevaluatedProperties warning in channels
> >  - remove ti,gain and ti,datarate as they aren't fixed hw properties
> >  - remove unnecessary |
> > ---
> >  .../bindings/iio/adc/ti,ads1119.yaml          | 155 ++++++++++++++++++
> >  MAINTAINERS                                   |   7 +
> >  2 files changed, 162 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1119.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/iio/adc/ti,ads1119.yaml: single-channel: missing type definition
> 
> doc reference errors (make refcheckdocs):
> 
> See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240617183215.4080-2-francesco@dolcini.it
> 
> The base for the series is generally the latest rc1. A different dependency
> should be noted in *this* patch.

Just for the record (and so I remember when I get to reviewing the driver
patch).

This should note dependency on
dd471a2b7759 ("dt-bindings: iio: adc: Add single-channel property")
but seeing as that is only char-misc.git/char-misc-next
I suspect that won't help the bot much!

> 
> 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.
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-17 20:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-17 18:32 [PATCH v3 0/2] iio: adc: ti-ads1119: Add driver Francesco Dolcini
2024-06-17 18:32 ` [PATCH v3 1/2] dt-bindings: iio: adc: add ti,ads1119 Francesco Dolcini
2024-06-17 19:30   ` Rob Herring (Arm)
2024-06-17 20:02     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox