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

[GSoC 2024] Add support for AD7294 #2578

Open
wants to merge 21 commits into
base: rpi-6.1.y
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8a90c0c
iio: addac: ad7294: add basic DAC support
ArchUsr64 Jun 27, 2024
c6f1f25
iio: addac: ad7294: add basic ADC support
ArchUsr64 Jun 27, 2024
fb46b7f
arch: dts: overlays: add ad7294 overlay
ArchUsr64 Jun 30, 2024
acd6a57
iio: addac: ad7294: add regulator support
ArchUsr64 Jun 30, 2024
595d123
iio: addac: ad7294: code refactor
ArchUsr64 Jun 30, 2024
1ddcfa3
iio: addac: ad7294: add temperature sensing
ArchUsr64 Jun 30, 2024
6757d47
iio: addac: ad7294: code refactor
ArchUsr64 Jul 4, 2024
e3ae35e
dt-bindings: iio: addac: add support for AD7294
ArchUsr64 Jul 4, 2024
a8bd7c3
iio: addac: ad7294: use regmap for 8-bit registers
ArchUsr64 Jul 11, 2024
d75120e
iio: addac: ad7294: use reg_[read/write] in regmap
ArchUsr64 Aug 8, 2024
72f8894
iio: addac: ad7294: temperature sensing refactor
ArchUsr64 Aug 8, 2024
cd38a5b
iio: addac: ad7294: add events for handling alerts
ArchUsr64 Aug 8, 2024
a62a9d8
arch: dts: overlays: add interrupts for ad7294
ArchUsr64 Aug 8, 2024
6904726
iio: addac: ad7294: add current scale
ArchUsr64 Aug 8, 2024
d771574
dt-bindings: iio: addac: add `shunt-resistor-ohms`
ArchUsr64 Aug 8, 2024
f23d91e
iio: addac: ad7294: code refactor
ArchUsr64 Aug 8, 2024
1196a46
iio: addac: ad7294: differential channel support
ArchUsr64 Aug 16, 2024
8905a7f
iio: addac: ad7294: addressed reviewer comments
ArchUsr64 Aug 29, 2024
e1316fc
iio: addac: Kconfig: remove mention of AD7294-2
ArchUsr64 Aug 29, 2024
aa7ad79
arch: dts: overlay: update overlay for AD7294-2
ArchUsr64 Aug 29, 2024
6d2cb94
iio: addac: ad7294: add events
ArchUsr64 Nov 14, 2024
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
79 changes: 79 additions & 0 deletions Documentation/devicetree/bindings/iio/addac/adi,ad7294.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/addac/adi,ad7294.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Analog Device AD7294/AD7294-2 device

maintainers:
- Anshul Dalal <[email protected]>

description: |
The AD7294/AD7294-2 is a monitor and control system with multichannel
ADC, DAC, temperature and current sensor. The device features a 12-bit ADC
and DAC with an i2c interface.

Datasheet:
AD7294: https://www.analog.com/media/en/technical-documentation/data-sheets/AD7294.pdf
AD7294-2: https://www.analog.com/media/en/technical-documentation/data-sheets/AD7294-2.pdf

properties:
compatible:
enum:
- adi,ad7294
- adi,ad7294-2

reg:
maxItems: 1

interrupts:
maxItems: 1
description: Alert interrupt
Copy link
Contributor

Choose a reason for hiding this comment

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

improve the description with:
Interrupt for signaling when conversion results (either voltage, current, or temperature) exceed their high limit or fall below the low limit on a channel basis configuration. The interrupt source must be attached to the ALERT/BUSY pin.


adc-vref-supply:
description: The regulator supply for ADC reference voltage (0.1V to 4.1V).

dac-vref-supply:
description: |
The regulator supply for DAC reference voltage (0V to AVDD - 2V).

avdd-supply:
description: Fixed regulator supply for analog circuitry (4.5V to 5.5V).

vdrive-supply:
description: Logic power supply (2.7V to 5.5V).

shunt-resistor-ohms:
$ref: /schemas/types.yaml#/definitions/int32-array
maxItems: 2
description: Resistance for RS1 and RS2 in ohms
Comment on lines +48 to +50
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: usually we see the description coming before maxItems.

    description: Resistance for RS1 and RS2 in ohms.
    maxItems: 2

would look more natural.


required:
- compatible
- reg
- avdd-supply
- vdrive-supply

Copy link
Contributor

Choose a reason for hiding this comment

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

This would be added here to the device tree doc for documenting the channels if/when implementing support for differential channels

patternProperties:
  "^channel@[0-3]$":
    type: object
    $ref: adc.yaml
    unevaluatedProperties: false

    properties:
      reg:
        minimum: 0
        maximum: 3

      diff-channels: true
      single-channel: true
      common-mode-channel: true

    required:
      - reg

    additionalProperties: false


additionalProperties: false

examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>

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

ad7294: addac@7b {
compatible = "adi,ad7294";
reg = <0x7b>;
interrupt-parent = <&gpio>;
interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
adc-vref-supply = <&adc_vref>;
dac-vref-supply = <&dac_vref>;
avdd-supply = <&avdd>;
vdrive-supply = <&vdrive>;
shunt-resistor-ohms = <1000 1000>;
Copy link
Contributor

Choose a reason for hiding this comment

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

This would come in the example

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

};
};
1 change: 1 addition & 0 deletions arch/arm/boot/dts/overlays/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
rpi-ad7173.dtbo \
rpi-ad7190.dtbo \
rpi-ad7293.dtbo \
rpi-ad7294.dtbo \
rpi-ad738x.dtbo \
rpi-ad7746.dtbo \
rpi-ad7768-1.dtbo \
Expand Down
64 changes: 64 additions & 0 deletions arch/arm/boot/dts/overlays/rpi-ad7294-overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>

/ {
compatible = "brcm,bcm2835";

fragment@0 {
target-path = "/";
__overlay__ {
avdd: fixedregulator@0 {
compatible = "regulator-fixed";
regulator-name = "avdd";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-boot-on;
};
vdrive: fixedregulator@1 {
compatible = "regulator-fixed";
regulator-name = "vdrive";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
};
adc_vref: fixedregulator@2 {
compatible = "regulator-fixed";
regulator-name = "adc-vref";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
regulator-boot-on;
};
dac_vref: fixedregulator@3 {
compatible = "regulator-fixed";
regulator-name = "dac-vref";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
regulator-boot-on;
};
};
};

fragment@1 {
target = <&i2c_arm>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
ad7294: ad7294@62 {
compatible = "adi,ad7294-2";
reg = <0x62>;
interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
interrupt-parent = <&gpio>;
shunt-resistor-ohms = <1000 1000>;
adc-vref-supply = <&adc_vref>;
dac-vref-supply = <&dac_vref>;
avdd-supply = <&avdd>;
vdrive-supply = <&vdrive>;
};
};
};
};
10 changes: 10 additions & 0 deletions drivers/iio/addac/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ config AD74115
To compile this driver as a module, choose M here: the
module will be called ad74115.

config AD7294
tristate "Analog Devices AD7294 driver"
depends on I2C
select REGMAP_I2C
help
Say yes here to build support for Analog Devices AD7294/AD7294-2.

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

config AD74413R
tristate "Analog Devices AD74412R/AD74413R driver"
depends on GPIOLIB && SPI
Expand Down
1 change: 1 addition & 0 deletions drivers/iio/addac/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#

# When adding new entries keep the list in alphabetical order
obj-$(CONFIG_AD7294) += ad7294.o
obj-$(CONFIG_AD74115) += ad74115.o
obj-$(CONFIG_AD74413R) += ad74413r.o
obj-$(CONFIG_STX104) += stx104.o
Expand Down
Loading
Loading