Skip to contentSkip to conversation

iio: adc: Add AD4134 minimum I/O support

PATCH Superseded Marcelo Schmitt 3 participants 5 messages Jan 7 – Jan 11

Subsystems (5)

v4 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Marcelo Schmitt

author maintainer
#0 lore raw

v4 cover iio: adc: Add AD4134 minimum I/O support

This patch series adds basic support for ad4134. AD4134 is a very flexible device that can be configured in many different ways. This series aims to support the simplest way of interfacing with AD4134 which is called minimum I/O mode in data sheet. This is essentially usual SPI with the addition of an ODR (Output Data Rate) GPIO which functions as conversion start signal in minimum I/O mode.

This set provides just one feature:
- Single-shot ADC sample read.

[PATCH 1] Device tree documentation for AD4134.
[PATCH 2] IIO Linux driver for AD4134.

Change log v3 -> v4:
[device tree]
- Renamed clock option "xtal1-xtal2" to "xtal" (making it similar to other bindings).
- Use oneOf for ldoin-supply choice.
- Dropped properties set to their defaults from the example.
[IIO]
- Added comment about minimum ODR high time.
- Split array of regulator names
- Updated to check for "xtal" clock name.
- Simplified voltage regulator initialization logic.
- Use reset framework to get and deassert device reset.
- Dropped ad4134 IIO documentation.

Link to v3: https://lore.kernel.org/linux-iio/[email protected]/
Link to v2: https://lore.kernel.org/linux-iio/[email protected]/
Link to v1: https://lore.kernel.org/linux-iio/[email protected]/

Marcelo Schmitt (2):
dt-bindings: iio: adc: Add AD4134
iio: adc: Initial support for AD4134

 .../bindings/iio/adc/adi,ad4134.yaml          | 191 +++++++
 MAINTAINERS                                   |   8 +
 drivers/iio/adc/Kconfig                       |  11 +
 drivers/iio/adc/Makefile                      |   1 +
 drivers/iio/adc/ad4134.c                      | 501 ++++++++++++++++++
 5 files changed, 712 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml
 create mode 100644 drivers/iio/adc/ad4134.c

base-commit: fb2f4eb29a258145b0336601f00509cab6e93e7c

Signature · 1 line
2.51.0
author maintainer
#1 lore raw

PATCH v4 1/2 dt-bindings: iio: adc: Add AD4134

Add device tree documentation for AD4134 24-Bit, 4-channel simultaneous sampling, precision ADC.

---
Change log v3 -> v4:
- Renamed clock option "xtal1-xtal2" to "xtal" (making it similar to other bindings).
- Use oneOf for ldoin-supply choice.
- Dropped properties set to their defaults from the example.

I believe the changes were not disruptive so I kept Conor's review tag.

 .../bindings/iio/adc/adi,ad4134.yaml          | 191 ++++++++++++++++++
 MAINTAINERS                                   |   7 +
 2 files changed, 198 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml
Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml new file +191 -0
new file mode 100644
index 000000000000..ea6d7e026419
@@ -0,0 +1,191 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/adi,ad4134.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices AD4134 ADC
+
+maintainers:
+  - Marcelo Schmitt <[email protected]>
+
+description: |
+  The AD4134 is a quad channel, low noise, simultaneous sampling, precision
+  analog-to-digital converter (ADC).
+  Specifications can be found at:
+    https://www.analog.com/media/en/technical-documentation/data-sheets/ad4134.pdf
+
+$ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    enum:
+      - adi,ad4134
+
+  reg:
+    maxItems: 1
+
+  spi-max-frequency:
+    maximum: 50000000
+
+  avdd5-supply:
+    description: A 5V supply that powers the chip's analog circuitry.
+
+  dvdd5-supply:
+    description: A 5V supply that powers the chip's digital circuitry.
+
+  iovdd-supply:
+    description:
+      A 1.8V supply that sets the logic levels for the digital interface pins.
+
+  refin-supply:
+    description:
+      A 4.096V or 5V supply that serves as reference for ADC conversions.
+
+  avdd1v8-supply:
+    description: A 1.8V supply used by the analog circuitry.
+
+  dvdd1v8-supply:
+    description: A 1.8V supply used by the digital circuitry.
+
+  clkvdd-supply:
+    description: A 1.8V supply for the chip's clock management circuit.
+
+  ldoin-supply:
+    description:
+      A 2.6V to 5.5V supply that generates 1.8V for AVDD1V8, DVDD1V8, and CLKVDD
+      pins.
+
+  clocks:
+    maxItems: 1
+    description:
+      Required external clock source. Can specify either a crystal or CMOS clock
+      source. If an external crystal is set, connect the CLKSEL pin to IOVDD.
+      Otherwise, connect the CLKSEL pin to IOGND and the external CMOS clock
+      signal to the XTAL2/CLKIN pin.
+
+  clock-names:
+    enum:
+      - xtal
+      - clkin
+    default: clkin
+
+  '#clock-cells':
+    const: 0
+
+  clock-output-names:
+    maxItems: 1
+
+  regulators:
+    type: object
+    description:
+      list of regulators provided by this controller.
+
+    properties:
+      vcm-output:
+        $ref: /schemas/regulator/regulator.yaml#
+        type: object
+        unevaluatedProperties: false
+
+    additionalProperties: false
+
+  reset-gpios:
+    maxItems: 1
+
+  powerdown-gpios:
+    description:
+      Active low GPIO connected to the /PDN pin. Forces the device into full
+      power-down mode when brought low. Pull this input to IOVDD for normal
+      operation.
+    maxItems: 1
+
+  odr-gpios:
+    description:
+      GPIO connected to ODR pin. Used to sample ADC data in minimum I/O mode.
+    maxItems: 1
+
+  adi,asrc-mode:
+    $ref: /schemas/types.yaml#/definitions/string
+    description:
+      Asynchronous Sample Rate Converter (ASRC) operation mode control input.
+      Describes whether the MODE pin is set to a high level (for master mode
+      operation) or to a low level (for slave mode operation).
+    enum: [ high, low ]
+    default: low
+
+  adi,dclkio:
+    description:
+      DCLK pin I/O direction control for when the device operates in Pin Control
+      Slave Mode or in SPI Control Mode. Describes if DEC0/DCLKIO pin is at a
+      high level (which configures DCLK as an output) or to set to a low level
+      (configuring DCLK for input).
+    enum: [ out, in ]
+    default: in
+
+  adi,dclkmode:
+    description:
+      DCLK mode control for when the device operates in Pin Control Slave Mode
+      or in SPI Control Mode. Describes whether the DEC1/DCLKMODE pin is set to
+      a high level (configuring the DCLK to operate in free running mode) or
+      to a low level (to configure DCLK to operate in gated mode).
+    enum: [ free-running, gated ]
+    default: gated
+
+required:
+  - compatible
+  - reg
+  - avdd5-supply
+  - dvdd5-supply
+  - iovdd-supply
+  - refin-supply
+  - clocks
+  - clock-names
+
+oneOf:
+  - required:
+      - ldoin-supply
+  - required:
+      - avdd1v8-supply
+      - dvdd1v8-supply
+      - clkvdd-supply
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        adc@0 {
+            compatible = "adi,ad4134";
+            reg = <0>;
+
+            spi-max-frequency = <1000000>;
+
+            reset-gpios = <&gpio0 86 GPIO_ACTIVE_LOW>;
+            odr-gpios = <&gpio0 87 GPIO_ACTIVE_HIGH>;
+            powerdown-gpios = <&gpio0 88 GPIO_ACTIVE_LOW>;
+
+            clocks = <&sys_clk>;
+            clock-names = "clkin";
+
+            avdd5-supply = <&avdd5>;
+            dvdd5-supply = <&dvdd5>;
+            iovdd-supply = <&iovdd>;
+            refin-supply = <&refin>;
+            avdd1v8-supply = <&avdd1v8>;
+            dvdd1v8-supply = <&dvdd1v8>;
+            clkvdd-supply = <&clkvdd>;
+
+            regulators {
+                vcm_reg: vcm-output {
+                    regulator-name = "ad4134-vcm";
+                };
+            };
+
+        };
+    };
+...
MAINTAINERS +7 -0
index 2e8825b8ccef..3f9f6dd96ae4 100644
@@ -1458,6 +1458,13 @@ F:	Documentation/ABI/testing/sysfs-bus-iio-adc-ad4130
 F:	Documentation/devicetree/bindings/iio/adc/adi,ad4130.yaml
 F:	drivers/iio/adc/ad4130.c
 
+ANALOG DEVICES INC AD4134 DRIVER
+M:	Marcelo Schmitt <[email protected]>
+L:	[email protected]
+S:	Supported
+W:	https://ez.analog.com/linux-software-drivers
+F:	Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml
+
 ANALOG DEVICES INC AD4170-4 DRIVER
 M:	Marcelo Schmitt <[email protected]>
 L:	[email protected]
Signature · 1 line
2.51.0
author maintainer
#2 lore raw

PATCH v4 2/2 iio: adc: Initial support for AD4134

In reply to Marcelo Schmitt

AD4134 is a 24-bit, 4-channel, simultaneous sampling, precision analog-to-digital converter (ADC). The device can be managed through SPI or direct control of pin logical levels (pin control mode). The AD4134 design also features a dedicated bus for ADC sample data output. Though, this initial driver for AD4134 only supports usual SPI connections.

Add basic support for AD4134 that enables single-shot ADC sample read.

---
Change log v3 -> v4:
- Added comment about minimum ODR high time.
- Split array of regulator names
- Updated to check for "xtal" clock name.
- Simplified voltage regulator initialization logic.
- Use reset framework to get and deassert device reset.
- Dropped ad4134 IIO documentation.

 MAINTAINERS              |   1 +
 drivers/iio/adc/Kconfig  |  11 +
 drivers/iio/adc/Makefile |   1 +
 drivers/iio/adc/ad4134.c | 501 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 514 insertions(+)
 create mode 100644 drivers/iio/adc/ad4134.c
MAINTAINERS +1 -0
index 3f9f6dd96ae4..4dd9f758a871 100644
@@ -1464,6 +1464,7 @@ L:	[email protected]
 S:	Supported
 W:	https://ez.analog.com/linux-software-drivers
 F:	Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml
+F:	drivers/iio/adc/ad4134.c
 
 ANALOG DEVICES INC AD4170-4 DRIVER
 M:	Marcelo Schmitt <[email protected]>
drivers/iio/adc/Kconfig +11 -0
index 89a6486135f6..b4295aa415bf 100644
@@ -112,6 +112,17 @@ config AD4130
 	  To compile this driver as a module, choose M here: the module will be
 	  called ad4130.
 
+config AD4134
+	tristate "Analog Device AD4134 ADC Driver"
+	depends on SPI
+	select REGMAP_SPI
+	select CRC8
+	help
+	  Say yes here to build support for Analog Devices AD4134 SPI analog to
+	  digital converters (ADC).
+
+	  To compile this driver as a module, choose M here: the module will be
+	  called ad4134_spi.
 
 config AD4170_4
 	tristate "Analog Device AD4170-4 ADC Driver"
drivers/iio/adc/Makefile +1 -0
index 0a199630c081..c76550415ff1 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_AD4030) += ad4030.o
 obj-$(CONFIG_AD4062) += ad4062.o
 obj-$(CONFIG_AD4080) += ad4080.o
 obj-$(CONFIG_AD4130) += ad4130.o
+obj-$(CONFIG_AD4134) += ad4134.o
 obj-$(CONFIG_AD4170_4) += ad4170-4.o
 obj-$(CONFIG_AD4695) += ad4695.o
 obj-$(CONFIG_AD4851) += ad4851.o
drivers/iio/adc/ad4134.c new file +501 -0

501 lines not on this page · raw message

Signature · 1 line
2.51.0
Reviewed-by on v4 2/2
#3 lore raw

Re: [PATCH v4 2/2] iio: adc: Initial support for AD4134

Quoted 7 lines · Marcelo Schmitt

AD4134 is a 24-bit, 4-channel, simultaneous sampling, precision analog-to-digital converter (ADC). The device can be managed through SPI or direct control of pin logical levels (pin control mode). The AD4134 design also features a dedicated bus for ADC sample data output. Though, this initial driver for AD4134 only supports usual SPI connections.

Add basic support for AD4134 that enables single-shot ADC sample read.

I have been on a few weeks leave and do not remember much, but it looks like this version has all my previous comments being addressed.

...

drivers/iio/adc/ad4134.c line 10

Quoted 6 lines
drivers/iio/adc/ad4134.c new file +4 -0
+#include <linux/array_size.h>
+#include <linux/bitfield.h>
 
+#include <linux/bitops.h>
 
+#include <linux/bits.h>

No need, as bitops.h implies (and guarantees) that BIT()/GENMASK() are provided with it.

Quoted 19 lines
drivers/iio/adc/ad4134.c new file +19 -0
+#include <linux/clk.h>
+#include <linux/crc8.h>
+#include <linux/delay.h>
+#include <linux/dev_printk.h>
+#include <linux/err.h>
+#include <linux/export.h>
+#include <linux/gpio/consumer.h>
+#include <linux/iio/iio.h>
+#include <linux/iio/types.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+#include <linux/reset.h>
+#include <linux/spi/spi.h>
+#include <linux/time.h>
+#include <linux/types.h>
+#include <linux/unaligned.h>
+#include <linux/units.h>
Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#4 lore raw

Re: [PATCH v4 2/2] iio: adc: Initial support for AD4134

Quoted 7 lines · On Wed, 7 Jan 2026 18:22:23 +0200 Andy Shevchenko…
Quoted 6 lines · Marcelo Schmitt

AD4134 is a 24-bit, 4-channel, simultaneous sampling, precision analog-to-digital converter (ADC). The device can be managed through SPI or direct control of pin logical levels (pin control mode). The AD4134 design also features a dedicated bus for ADC sample data output. Though, this initial driver for AD4134 only supports usual SPI connections.

Quoted 6 lines
Quoted 1 line

Add basic support for AD4134 that enables single-shot ADC sample read.

I have been on a few weeks leave and do not remember much, but it looks like this version has all my previous comments being addressed.

I tweaked to drop the explicit bits.h include and applied to the togreg branch of iio.git, initially pushed out as testing.

thanks,

Jonathan

Quoted 33 lines

...

drivers/iio/adc/ad4134.c line 10

Quoted 6 lines
drivers/iio/adc/ad4134.c new file +4 -0
+#include <linux/array_size.h>
+#include <linux/bitfield.h>  
 
+#include <linux/bitops.h>  
 
+#include <linux/bits.h>  

No need, as bitops.h implies (and guarantees) that BIT()/GENMASK() are provided with it.

Quoted 19 lines
drivers/iio/adc/ad4134.c new file +19 -0
+#include <linux/clk.h>
+#include <linux/crc8.h>
+#include <linux/delay.h>
+#include <linux/dev_printk.h>
+#include <linux/err.h>
+#include <linux/export.h>
+#include <linux/gpio/consumer.h>
+#include <linux/iio/iio.h>
+#include <linux/iio/types.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+#include <linux/reset.h>
+#include <linux/spi/spi.h>
+#include <linux/time.h>
+#include <linux/types.h>
+#include <linux/unaligned.h>
+#include <linux/units.h>