Skip to content

Wip/bl/ad3552r v1 #2525

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

Closed
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
7 changes: 7 additions & 0 deletions Documentation/ABI/testing/sysfs-bus-iio-dac
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ Description:
multiple predefined symbols. Each symbol corresponds to a different
output, denoted as out_voltageY_rawN, where N is the integer value
of the symbol. Writing an integer value N will select out_voltageY_rawN.

What: /sys/bus/iio/devices/iio:deviceX/out_voltage_synchronous_mode
KernelVersion: 6.13
Contact: [email protected]
Description:
This attribute allows a specific synchronization mode, mainly
intended for DACs where multiple synchronization methods are available.
39 changes: 37 additions & 2 deletions Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,34 @@ properties:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1, 2, 3]

io-backends:
description: The iio backend reference.
An example backend can be found at
https://analogdevicesinc.github.io/hdl/library/axi_ad3552r/index.html
maxItems: 1

'#address-cells':
const: 1

'#size-cells':
const: 0

if:
required:
- reg

then:
$ref: /schemas/spi/spi-peripheral-props.yaml#

properties:
io-backends: false

required: [ spi-max-frequency ]

else:
required:
- io-backends

patternProperties:
"^channel@([0-1])$":
type: object
Expand Down Expand Up @@ -207,8 +229,6 @@ allOf:

required:
- compatible
- reg
- spi-max-frequency

additionalProperties: false

Expand Down Expand Up @@ -238,4 +258,19 @@ examples:
};
};
};

- |
fpga_axi {
ad3552r {
compatible = "adi,ad3552r";
reset-gpios = <&gpio0 92 1>;
io-backends = <&backend>;
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
adi,output-range-microvolt = <(-5000000) (5000000)>;
};
};
};
...
9 changes: 9 additions & 0 deletions Documentation/devicetree/bindings/iio/dac/adi,axi-dac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ properties:
clocks:
maxItems: 1

bus-type:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jonathan always suggests to add a default value for when the property is not present. So we should add that. Otherwise, I think maintainers will say the same as Nuno that this should be a boolean property since it only has one value. I guess parallel makes sense as the default since that is what the existing user of the AXI DAC has?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the code there is no handling for the parallel bus, so not totally sure adding "parallel" here now is appropriate.
Also adding parallel here means roll back again to a switch/case, considering also parallel.

What about, as i initially did, to add AXI_DAC_BUS_TYPE_NONE as 0 ? And setting default 0

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the point of view of the device tree that is describing the wiring, there is always going to be some kind of bus that is connected to the DAC chip, so I don't think "none" makes sense to put in the device tree. I suggested "parallel" as the default since the one already existing user of the AXI DAC (ad9739a) uses a parallel bus connection.

maxItems: 1
description: |
Configure bus type:
- 0: none
- 1: qspi
enum: [0, 1]
default: 0

'#io-backend-cells':
const: 0

Expand Down
80 changes: 80 additions & 0 deletions arch/arm/boot/dts/xilinx/zynq-zed-adv7511-ad3552r-axi.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Analog Devices AXI-AD3551R
*
* hdl_project: <ad3552r_fmc/zed>
* board_revision: <>
*
* Copyright (C) 2024 Analog Devices Inc.
*/
/dts-v1/;

#include "zynq-zed.dts"
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/gpio/gpio.h>

/ {
clocks {
ext_clk: clock@0 {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <100000000>;
};
};
};

&amba {

ref_clk: clk@44B00000 {
compatible = "adi,axi-clkgen-2.00.a";
reg = <0x44B00000 0x10000>;
#clock-cells = <0>;
clocks = <&clkc 15>, <&clkc 15>;
clock-names = "s_axi_aclk", "clkin1";
clock-output-names = "ref_clk";
};

dac_tx_dma: dma-controller@0x44a30000 {
compatible = "adi,axi-dmac-1.00.a";
reg = <0x44a30000 0x10000>;
#dma-cells = <1>;
interrupt-parent = <&intc>;
interrupts = <0 57 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clkc 15>;

adi,channels {
#size-cells = <0>;
#address-cells = <1>;

dma-channel@0 {
reg = <0>;
adi,source-bus-width = <32>;
adi,source-bus-type = <0>;
adi,destination-bus-width = <32>;
adi,destination-bus-type = <1>;
};
};
};

backend: controller@44a70000 {
compatible = "adi,axi-dac-9.1.b";
reg = <0x44a70000 0x1000>;
dmas = <&dac_tx_dma 0>;
dma-names = "tx";
#io-backend-cells = <0>;
clocks = <&ref_clk>;
bus-type = <1>; /* IIO QSPI */
};

axi-ad3552r {
compatible = "adi,ad3552r";
reset-gpios = <&gpio0 92 GPIO_ACTIVE_LOW>;
io-backends = <&backend>;
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
adi,output-range-microvolt = <(-10000000) (10000000)>;
};
};
};
11 changes: 11 additions & 0 deletions drivers/iio/dac/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ config AD3552R
To compile this driver as a module, choose M here: the
module will be called ad3552r.

config AD3552R_AXI
tristate "Analog Devices AD3552R DAC driver, AXI version"
select IIO_BACKEND
help
Say yes here to build support for Analog Devices AD3552R
Digital to Analog Converter, connected through the Xilinx
fpga AXI interface.

To compile this driver as a module, choose M here: the
module will be called ad3552r-axi.

config AD5064
tristate "Analog Devices AD5064 and similar multi-channel DAC driver"
depends on (SPI_MASTER && I2C!=m) || I2C
Expand Down
3 changes: 2 additions & 1 deletion drivers/iio/dac/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#

# When adding new entries keep the list in alphabetical order
obj-$(CONFIG_AD3552R) += ad3552r.o
obj-$(CONFIG_AD3552R) += ad3552r.o ad3552r-common.o
obj-$(CONFIG_AD3552R_AXI) += ad3552r-axi.o ad3552r-common.o
obj-$(CONFIG_AD5360) += ad5360.o
obj-$(CONFIG_AD5380) += ad5380.o
obj-$(CONFIG_AD5421) += ad5421.o
Expand Down
Loading