-
Notifications
You must be signed in to change notification settings - Fork 845
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
Add support for adaq776x-1 series and add missing features #2587
base: main
Are you sure you want to change the base?
Changes from all commits
d0c9d40
f96b03e
8a67013
ae77771
9ea71cc
f05aa91
9821399
9d7bd26
ffb41a0
979d704
5af3802
300cd94
593b88a
a386cf9
fd9c009
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,26 @@ | |
$id: http://devicetree.org/schemas/iio/adc/adi,ad7768-1.yaml# | ||
$schema: http://devicetree.org/meta-schemas/core.yaml# | ||
|
||
title: Analog Devices AD7768-1 ADC device driver | ||
title: Analog Devices AD7768-1 ADC family device driver | ||
|
||
maintainers: | ||
- Michael Hennerich <[email protected]> | ||
|
||
description: | | ||
Datasheet at: | ||
https://www.analog.com/media/en/technical-documentation/data-sheets/ad7768-1.pdf | ||
Analog Devices AD7768-1 24-Bit Single Channel Low Power sigma-delta ADC family | ||
|
||
https://www.analog.com/media/en/technical-documentation/data-sheets/ad7768-1.pdf | ||
https://www.analog.com/media/en/technical-documentation/data-sheets/adaq7767-1.pdf | ||
https://www.analog.com/media/en/technical-documentation/data-sheets/adaq7768-1.pdf | ||
https://www.analog.com/media/en/technical-documentation/data-sheets/adaq7769-1.pdf | ||
|
||
properties: | ||
compatible: | ||
const: adi,ad7768-1 | ||
enum: | ||
- adi,ad7768-1 | ||
- adi,adaq7767-1 | ||
- adi,adaq7768-1 | ||
- adi,adaq7769-1 | ||
|
||
reg: | ||
maxItems: 1 | ||
|
@@ -39,6 +47,23 @@ properties: | |
description: | ||
ADC reference voltage supply | ||
|
||
adi,aaf-gain: | ||
description: | | ||
Specifies the gain of the Analog Anti-Aliasing Filter (AAF) applied to the | ||
ADC input, measured in milli-units. The AAF provides additional signal | ||
rejection within the frequency range of fs ± f3dB, where fs is the sampling | ||
frequency, and f3dB is the -3dB cutoff frequency. The specific values of | ||
fs and f3dB, as well as the rejection intensity, depend on the digital | ||
filter configuration. | ||
|
||
This parameter is required for the ADAQ7767-1 and ADAQ7769-1 devices. | ||
The gain is determined by the selected input pin: | ||
* For the ADAQ7767-1: The input selection of IN1±, IN2± or IN3±. | ||
* For the ADAQ7769-1: The connections of OUT_PGA to IN1_AAF+, IN2_AAF+, | ||
or IN3_AAF+. | ||
$ref: /schemas/types.yaml#/definitions/uint16 | ||
enum: [143, 364, 1000] | ||
|
||
adi,sync-in-gpios: | ||
maxItems: 1 | ||
description: | ||
|
@@ -47,6 +72,14 @@ properties: | |
in any way, for example if the filter decimation rate changes. | ||
As the line is active low, it should be marked GPIO_ACTIVE_LOW. | ||
|
||
adi,sync-in-spi: | ||
description: | ||
Enables synchronization of multiple devices over SPI. This property is | ||
used when a signal synchronous to the base MCLK signal cannot be provided | ||
via GPIO. It requires the SYNC_OUT pin to be connected to the SYNC_IN pin | ||
on the ADC. In the case of multiple devices, the SYNC_OUT pin of one device | ||
should be routed to the SYNC_IN pins of the other devices. | ||
|
||
reset-gpios: | ||
maxItems: 1 | ||
|
||
|
@@ -65,7 +98,6 @@ required: | |
- vref-supply | ||
- spi-cpol | ||
- spi-cpha | ||
- adi,sync-in-gpios | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't do it all together. One patch for the new parts, another one for the updates to sync pins. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. noted There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put the gain property and related checks in the same patch that adds the new parts and put the changes related to |
||
|
||
patternProperties: | ||
"^channel@([0-9]|1[0-5])$": | ||
|
@@ -89,6 +121,33 @@ patternProperties: | |
allOf: | ||
- $ref: /schemas/spi/spi-peripheral-props.yaml# | ||
|
||
# AAF Gain property only applies to ADAQ7767-1 and ADAQ7769-1 devices | ||
- if: | ||
properties: | ||
compatible: | ||
not: | ||
contains: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not if the contains is needed... |
||
enum: | ||
- adi,adaq7767-1 | ||
- adi,adaq7769-1 | ||
then: | ||
properties: | ||
adi,aaf-gain: false | ||
|
||
# adi,sync-in-gpios and adi,sync-in-spi are mutually exclusive (neither is also valid) | ||
- if: | ||
required: | ||
- adi,sync-in-gpios | ||
then: | ||
properties: | ||
adi,sync-in-spi: false | ||
- if: | ||
required: | ||
- adi,sync-in-spi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would this be something that we could assume in the absence of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's what we have decided for the synchronization:
If you believe the third option doesn’t need support, we could consider the absence of adi,sync-in-gpios as indicative of the SPI command synchronization. I think it’s good to include the adi,sync-in-spi option, because it clarifies the need to route SYNC_OUT to SYNC_IN for proper operation. |
||
then: | ||
properties: | ||
adi,sync-in-gpios: false | ||
|
||
unevaluatedProperties: false | ||
|
||
examples: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* | ||
* Analog Devices ADAQ7767-1 | ||
* https://wiki.analog.com/resources/eval/user-guides/ad7768-1 | ||
* | ||
* hdl_project: <ad77681evb/zed> | ||
* board_revision: <B> | ||
* | ||
* Copyright (C) 2024 Analog Devices Inc. | ||
*/ | ||
/dts-v1/; | ||
|
||
#include "zynq-zed.dtsi" | ||
#include "zynq-zed-adv7511.dtsi" | ||
#include <dt-bindings/interrupt-controller/irq.h> | ||
#include <dt-bindings/gpio/gpio.h> | ||
|
||
/ { | ||
vref: regulator-vref { | ||
compatible = "regulator-fixed"; | ||
regulator-name = "fixed-supply"; | ||
regulator-min-microvolt = <4096000>; | ||
regulator-max-microvolt = <4096000>; | ||
regulator-always-on; | ||
}; | ||
|
||
clocks { | ||
ad7768_1_mclk: clock@0 { | ||
#clock-cells = <0>; | ||
compatible = "fixed-clock"; | ||
clock-frequency = <16384000>; | ||
}; | ||
}; | ||
}; | ||
|
||
&fpga_axi { | ||
rx_dma: rx-dmac@0x44a30000 { | ||
compatible = "adi,axi-dmac-1.00.a"; | ||
reg = <0x44a30000 0x1000>; | ||
#dma-cells = <1>; | ||
interrupt-parent = <&intc>; | ||
interrupts = <0 57 IRQ_TYPE_LEVEL_HIGH>; | ||
clocks = <&clkc 16>; | ||
|
||
adi,channels { | ||
#size-cells = <0>; | ||
#address-cells = <1>; | ||
|
||
dma-channel@0 { | ||
reg = <0>; | ||
adi,source-bus-width = <32>; | ||
adi,source-bus-type = <1>; | ||
adi,destination-bus-width = <64>; | ||
adi,destination-bus-type = <0>; | ||
}; | ||
}; | ||
}; | ||
|
||
spi_clock: spieng-axi-clkgen@44a70000 { | ||
compatible = "adi,axi-clkgen-2.00.a"; | ||
reg = <0x44a70000 0x10000>; | ||
#clock-cells = <0>; | ||
clocks = <&clkc 15>, <&clkc 16>; | ||
clock-names = "s_axi_aclk", "clkin1"; | ||
}; | ||
|
||
axi_spi_engine_0: spi@0x44a00000 { | ||
compatible = "adi-ex,axi-spi-engine-1.00.a"; | ||
reg = <0x44a00000 0x1000>; | ||
interrupt-parent = <&intc>; | ||
interrupts = <0 56 IRQ_TYPE_LEVEL_HIGH>; | ||
clocks = <&clkc 15 &spi_clock>; | ||
clock-names = "s_axi_aclk", "spi_clk"; | ||
num-cs = <1>; | ||
|
||
#address-cells = <0x1>; | ||
#size-cells = <0x0>; | ||
|
||
adaq7767_1: adc@0 { | ||
compatible = "adi,adaq7767-1"; | ||
reg = <0>; | ||
spi-max-frequency = <40000000>; | ||
spi-cpol; | ||
spi-cpha; | ||
vref-supply = <&vref>; | ||
adi,sync-in-spi; | ||
adi,aaf-gain = <143>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may have missed it but, where is the documentation for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, At some point I changed from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It depends on how the gain is applied. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFE_gain is the combination of Anti-Aliasing Filter (AAF) gain and PGA gain. AAF is an analogic filter with three inputs, each one lead to a specific gain and bandwidth rejection. The user must connect the output of the first filter (PGA), for the case of adaq7769-1, to one of these AAF inputs by inserting a resistor in the corresponding pin: Only the ADAQ7769-1 and ADAQ7767-1 have variable AAF gain. The second one does not have PGIA, so the AAF input is directly connected to the signal input and AFE gain is the AAF gain. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, that's a bit different than Edit: just recall linux is not the only user of device tree docs. Other systems may export different properties to users. Better to fully describe the analog gain and bandwidth rejection with a specific property name for it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. About the device that doesn't have variable AAF gain, I think it may be nice to add a check for it. e.g.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
reset-gpios = <&gpio0 86 GPIO_ACTIVE_LOW>; | ||
clocks = <&ad7768_1_mclk>; | ||
clock-names = "mclk"; | ||
dmas = <&rx_dma 0>; | ||
dma-names = "rx"; | ||
#io-channel-cells = <1>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add
as documented in |
||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
channel@0 { | ||
reg = <0>; | ||
label = "channel_0"; | ||
}; | ||
}; | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* | ||
* Analog Devices ADAQ7768-1 | ||
* https://wiki.analog.com/resources/eval/user-guides/ad7768-1 | ||
* | ||
* hdl_project: <ad77681evb/zed> | ||
* board_revision: <B> | ||
* | ||
* Copyright (C) 2024 Analog Devices Inc. | ||
*/ | ||
/dts-v1/; | ||
|
||
#include "zynq-zed.dtsi" | ||
#include "zynq-zed-adv7511.dtsi" | ||
#include <dt-bindings/interrupt-controller/irq.h> | ||
#include <dt-bindings/gpio/gpio.h> | ||
|
||
/ { | ||
vref: regulator-vref { | ||
compatible = "regulator-fixed"; | ||
regulator-name = "fixed-supply"; | ||
regulator-min-microvolt = <4096000>; | ||
regulator-max-microvolt = <4096000>; | ||
regulator-always-on; | ||
}; | ||
|
||
clocks { | ||
ad7768_1_mclk: clock@0 { | ||
#clock-cells = <0>; | ||
compatible = "fixed-clock"; | ||
clock-frequency = <16384000>; | ||
}; | ||
}; | ||
}; | ||
|
||
&fpga_axi { | ||
rx_dma: rx-dmac@0x44a30000 { | ||
compatible = "adi,axi-dmac-1.00.a"; | ||
reg = <0x44a30000 0x1000>; | ||
#dma-cells = <1>; | ||
interrupt-parent = <&intc>; | ||
interrupts = <0 57 IRQ_TYPE_LEVEL_HIGH>; | ||
clocks = <&clkc 16>; | ||
|
||
adi,channels { | ||
#size-cells = <0>; | ||
#address-cells = <1>; | ||
|
||
dma-channel@0 { | ||
reg = <0>; | ||
adi,source-bus-width = <32>; | ||
adi,source-bus-type = <1>; | ||
adi,destination-bus-width = <64>; | ||
adi,destination-bus-type = <0>; | ||
}; | ||
}; | ||
}; | ||
|
||
spi_clock: spieng-axi-clkgen@44a70000 { | ||
compatible = "adi,axi-clkgen-2.00.a"; | ||
reg = <0x44a70000 0x10000>; | ||
#clock-cells = <0>; | ||
clocks = <&clkc 15>, <&clkc 16>; | ||
clock-names = "s_axi_aclk", "clkin1"; | ||
}; | ||
|
||
axi_spi_engine_0: spi@0x44a00000 { | ||
compatible = "adi-ex,axi-spi-engine-1.00.a"; | ||
reg = <0x44a00000 0x1000>; | ||
interrupt-parent = <&intc>; | ||
interrupts = <0 56 IRQ_TYPE_LEVEL_HIGH>; | ||
clocks = <&clkc 15 &spi_clock>; | ||
clock-names = "s_axi_aclk", "spi_clk"; | ||
num-cs = <1>; | ||
|
||
#address-cells = <0x1>; | ||
#size-cells = <0x0>; | ||
|
||
adaq7768_1: adc@0 { | ||
compatible = "adi,adaq7768-1"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't really checked but can we have a common dtsi and then dedicated dts files just for different pieces? |
||
reg = <0>; | ||
spi-max-frequency = <40000000>; | ||
spi-cpol; | ||
spi-cpha; | ||
vref-supply = <&vref>; | ||
adi,sync-in-spi; | ||
reset-gpios = <&gpio0 86 GPIO_ACTIVE_LOW>; | ||
clocks = <&ad7768_1_mclk>; | ||
clock-names = "mclk"; | ||
dmas = <&rx_dma 0>; | ||
dma-names = "rx"; | ||
#io-channel-cells = <1>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, add channel subnode. |
||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
channel@0 { | ||
reg = <0>; | ||
label = "channel_0"; | ||
}; | ||
}; | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good to also have a dt check for the gain property.