Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AD7192 driver new features and devicetrees #2554

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 124 additions & 5 deletions Documentation/devicetree/bindings/iio/adc/adi,ad7192.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ properties:
- adi,ad7190
- adi,ad7192
- adi,ad7193
- adi,ad7194
- adi,ad7195

"#address-cells":
const: 1

"#size-cells":
const: 0

reg:
maxItems: 1

Expand All @@ -32,21 +39,39 @@ properties:

clocks:
maxItems: 1
description: phandle to the master clock (mclk)
description:
Optionally, either a crystal can be attached externally between MCLK1 and
MCLK2 pins, or an external CMOS-compatible clock can drive the MCLK2
pin. If absent, internal 4.92MHz clock is used, which can be made
available on MCLK2 pin.

clock-names:
items:
- const: mclk
enum:
- xtal
- mclk

"#clock-cells":
const: 0
description:
If present when internal clock is used, configured as clock provider.

interrupts:
maxItems: 1

aincom-supply:
description: |
AINCOM voltage supply. Analog inputs AINx are referenced to this input
when configured for pseudo-differential operation.

dvdd-supply:
description: DVdd voltage supply

avdd-supply:
description: AVdd voltage supply

vref-supply:
description: VRef voltage supply

adi,rejection-60-Hz-enable:
description: |
This bit enables a notch at 60 Hz when the first notch of the sinc
Expand Down Expand Up @@ -81,19 +106,77 @@ properties:
description: see Documentation/devicetree/bindings/iio/adc/adc.yaml
type: boolean

patternProperties:
"^channel@[0-9a-f]+$":
type: object
$ref: adc.yaml
unevaluatedProperties: false

properties:
reg:
description: The channel index.
minimum: 0
maximum: 271

diff-channels:
description:
Both inputs can be connected to pins AIN1 to AIN16 by choosing the
appropriate value from 1 to 16.
items:
minimum: 1
maximum: 16

single-channel:
description:
Positive input can be connected to pins AIN1 to AIN16 by choosing the
appropriate value from 1 to 16. Negative input is connected to AINCOM.
items:
minimum: 1
maximum: 16

oneOf:
- required:
- reg
- diff-channels
- required:
- reg
- single-channel

required:
- compatible
- reg
- clocks
- clock-names
- interrupts
- dvdd-supply
- avdd-supply
- vref-supply
- spi-cpol
- spi-cpha

allOf:
- $ref: /schemas/spi/spi-peripheral-props.yaml#
- if:
properties:
compatible:
enum:
- adi,ad7190
- adi,ad7192
- adi,ad7193
- adi,ad7195
then:
patternProperties:
"^channel@[0-9a-f]+$": false
- if:
anyOf:
- required:
- clocks
- required:
- clock-names
then:
properties:
"#clock-cells": false
required:
- clocks
- clock-names

unevaluatedProperties: false

Expand All @@ -113,12 +196,48 @@ examples:
clock-names = "mclk";
interrupts = <25 0x2>;
interrupt-parent = <&gpio>;
aincom-supply = <&aincom>;
dvdd-supply = <&dvdd>;
avdd-supply = <&avdd>;
vref-supply = <&vref>;

adi,refin2-pins-enable;
adi,rejection-60-Hz-enable;
adi,buffer-enable;
adi,burnout-currents-enable;
};
};
- |
spi {
#address-cells = <1>;
#size-cells = <0>;

adc@0 {
compatible = "adi,ad7194";
reg = <0>;

#address-cells = <1>;
#size-cells = <0>;

spi-max-frequency = <1000000>;
spi-cpol;
spi-cpha;
#clock-cells = <0>;
interrupts = <25 0x2>;
interrupt-parent = <&gpio>;
aincom-supply = <&aincom>;
dvdd-supply = <&dvdd>;
avdd-supply = <&avdd>;
vref-supply = <&vref>;

channel@0 {
reg = <0>;
diff-channels = <1 6>;
};

channel@1 {
reg = <1>;
single-channel = <1>;
};
};
};
64 changes: 64 additions & 0 deletions arch/arm/boot/dts/zynq-coraz7s-ad7190.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Analog Devices AD719x
* https://wiki.analog.com/resources/tools-software/linux-drivers/iio-adc/ad7192
*
* hdl_project: <ad719x_asdz/coraz7s>
*
* Copyright (C) 2024 Analog Devices, Inc.
*/
/dts-v1/;
#include "zynq-coraz7s.dtsi"

/ {
aincom: fixedregulator@0 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply0";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
regulator-boot-on;
};

avdd: fixedregulator@1 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply1";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-boot-on;
};

dvdd: fixedregulator@2 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply2";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
};

vref: fixedregulator@3 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply3";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
regulator-boot-on;
};
};

&spi0 {
status = "okay";
ad7190: adc@0 {
compatible = "adi,ad7190";
reg = <0>;
spi-max-frequency = <1000000>;
spi-cpol;
spi-cpha;

interrupts = <86 0x2>;
interrupt-parent = <&gpio0>;

aincom-supply = <&aincom>;
avdd-supply = <&avdd>;
dvdd-supply = <&dvdd>;
vref-supply = <&vref>;
};
};
64 changes: 64 additions & 0 deletions arch/arm/boot/dts/zynq-coraz7s-ad7192.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Analog Devices AD719x
* https://wiki.analog.com/resources/tools-software/linux-drivers/iio-adc/ad7192
*
* hdl_project: <ad719x_asdz/coraz7s>
*
* Copyright (C) 2024 Analog Devices, Inc.
*/
/dts-v1/;
#include "zynq-coraz7s.dtsi"

/ {
aincom: fixedregulator@0 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply0";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
regulator-boot-on;
};

avdd: fixedregulator@1 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply1";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-boot-on;
};

dvdd: fixedregulator@2 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply2";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
};

vref: fixedregulator@3 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply3";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
regulator-boot-on;
};
};

&spi0 {
status = "okay";
ad7192: adc@0 {
compatible = "adi,ad7192";
reg = <0>;
spi-max-frequency = <1000000>;
spi-cpol;
spi-cpha;

interrupts = <86 0x2>;
interrupt-parent = <&gpio0>;

aincom-supply = <&aincom>;
avdd-supply = <&avdd>;
dvdd-supply = <&dvdd>;
vref-supply = <&vref>;
};
};
64 changes: 64 additions & 0 deletions arch/arm/boot/dts/zynq-coraz7s-ad7193.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Analog Devices AD719x
* https://wiki.analog.com/resources/tools-software/linux-drivers/iio-adc/ad7192
*
* hdl_project: <ad719x_asdz/coraz7s>
*
* Copyright (C) 2024 Analog Devices, Inc.
*/
/dts-v1/;
#include "zynq-coraz7s.dtsi"

/ {
aincom: fixedregulator@0 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply0";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
regulator-boot-on;
};

avdd: fixedregulator@1 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply1";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
};

dvdd: fixedregulator@2 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply2";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
};

vref: fixedregulator@3 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply3";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
regulator-boot-on;
};
};

&spi0 {
status = "okay";
ad7193: adc@0 {
compatible = "adi,ad7193";
reg = <0>;
spi-max-frequency = <1000000>;
spi-cpol;
spi-cpha;

interrupts = <86 0x2>;
interrupt-parent = <&gpio0>;

aincom-supply = <&aincom>;
avdd-supply = <&avdd>;
dvdd-supply = <&dvdd>;
vref-supply = <&vref>;
};
};
Loading