2020-02-06 10:45:32

by Alexandru Tachici

[permalink] [raw]
Subject: [PATCH 0/2] iio: dac: AD5770R: Add support

This series of patches adds support for the AD5570R
14-bit current DAC.

It contains changes discussed in:
https://patchwork.kernel.org/patch/10549129/

Alexandru Tachici (2):
iio: dac: ad5770r: Add AD5770R support
dt-bindings: iio: dac: Add docs for AD5770R DAC

.../bindings/iio/dac/adi,ad5770r.yaml | 176 +++++
drivers/iio/dac/Kconfig | 10 +
drivers/iio/dac/Makefile | 1 +
drivers/iio/dac/ad5770r.c | 662 ++++++++++++++++++
include/linux/iio/common/adi_spi_regs.h | 44 ++
5 files changed, 893 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
create mode 100644 drivers/iio/dac/ad5770r.c
create mode 100644 include/linux/iio/common/adi_spi_regs.h

--
2.20.1


2020-02-06 10:45:34

by Alexandru Tachici

[permalink] [raw]
Subject: [PATCH 2/2] dt-bindings: iio: dac: Add docs for AD5770R DAC

Adding dt-bindings documentation for AD5770R DAC.

Signed-off-by: Mircea Caprioru <[email protected]>
Signed-off-by: Alexandru Tachici <[email protected]>
---
.../bindings/iio/dac/adi,ad5770r.yaml | 176 ++++++++++++++++++
1 file changed, 176 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml

diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
new file mode 100644
index 000000000000..02b2f6e67583
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
@@ -0,0 +1,176 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2020 Analog Devices Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bindings/iio/adc/adi,ad5770r.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices AD5770R DAC device driver
+
+maintainers:
+ - Mircea Caprioru <[email protected]>
+
+description: |
+ Bindings for the Analog Devices AD5770R current DAC device. Datasheet can be
+ found here:
+ https://www.analog.com/media/en/technical-documentation/data-sheets/AD5770R.pdf
+
+properties:
+ compatible:
+ enum:
+ - adi,ad5770r
+
+ reg:
+ maxItems: 1
+
+ vref-supply:
+ description: Specify the voltage of the external reference used.
+ Available reference options are 1.25 V or 2.5 V. If no
+ external reference declared then the device will use the
+ internal reference of 1.25 V.
+
+ adi,external-resistor:
+ description: Specify if an external 2.5k ohm resistor is used. If not
+ specified the device will use and internal 2.5k ohm resistor.
+ The precision resistor is used for reference current generation.
+ type: boolean
+
+ reset-gpios:
+ description: GPIO spec for the RESET pin. If specified, it will be
+ asserted during driver probe.
+ maxItems: 1
+
+ channel0:
+ description: Represents an external channel which are
+ connected to the DAC. Channel 0 can act both as a current
+ source and sink.
+ type: object
+
+ properties:
+ num:
+ description: This represents the channel number.
+ items:
+ const: 0
+
+ adi,range-microamp:
+ description: Output range of the channel.
+ oneOf:
+ - $ref: /schemas/types.yaml#/definitions/int32-array
+ - items:
+ - enum: [0 300000]
+ - enum: [-60000 0]
+ - enum: [-60000 300000]
+
+ channel1:
+ description: Represents an external channel which are
+ connected to the DAC.
+ type: object
+
+ properties:
+ num:
+ description: This represents the channel number.
+ items:
+ const: 1
+
+ adi,range-microamp:
+ description: Output range of the channel.
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/uint32-array
+ - items:
+ - enum: [0 140000]
+ - enum: [0 250000]
+
+ channel2:
+ description: Represents an external channel which are
+ connected to the DAC.
+ type: object
+
+ properties:
+ num:
+ description: This represents the channel number.
+ items:
+ const: 2
+
+ adi,range-microamp:
+ description: Output range of the channel.
+ allOf:
+ - $ref: /schemas/types.yaml#/definitions/uint32-array
+ - items:
+ - enum: [0 140000]
+ - enum: [0 250000]
+
+patternProperties:
+ "^channel@([3-5])$":
+ type: object
+ description: Represents the external channels which are connected to the DAC.
+ properties:
+ num:
+ description: This represents the channel number.
+ items:
+ minimum: 3
+ maximum: 5
+
+ adi,range-microamp:
+ description: Output range of the channel.
+ oneOf:
+ - $ref: /schemas/types.yaml#/definitions/uint32-array
+ - items:
+ - enum: [0 45000]
+ - enum: [0 100000]
+
+required:
+- reg
+- diff-channels
+- channel0
+- channel1
+- channel2
+- channel3
+- channel4
+- channel5
+
+examples:
+ - |
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ad5770r@0 {
+ compatible = "ad5770r";
+ reg = <0>;
+ spi-max-frequency = <1000000>;
+ vref-supply = <&vref>;
+ adi,external-resistor;
+ reset-gpios = <&gpio 22 0>;
+
+ channel@0 {
+ num = <0>;
+ adi,range-microamp = <(-60000) 300000>;
+ };
+
+ channel@1 {
+ num = <1>;
+ adi,range-microamp = <0 140000>;
+ };
+
+ channel@2 {
+ num = <2>;
+ adi,range-microamp = <0 55000>;
+ };
+
+ channel@3 {
+ num = <3>;
+ adi,range-microamp = <0 45000>;
+ };
+
+ channel@4 {
+ num = <4>;
+ adi,range-microamp = <0 45000>;
+ };
+
+ channel@5 {
+ num = <5>;
+ adi,range-microamp = <0 45000>;
+ };
+ };
+ };
+...
\ No newline at end of file
--
2.20.1

2020-02-08 14:25:00

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 0/2] iio: dac: AD5770R: Add support

On Thu, 6 Feb 2020 11:23:11 +0200
Alexandru Tachici <[email protected]> wrote:

> This series of patches adds support for the AD5570R
> 14-bit current DAC.
>
> It contains changes discussed in:
> https://patchwork.kernel.org/patch/10549129/

Should have been marked as v2 in the patch titles.

Jonathan

>
> Alexandru Tachici (2):
> iio: dac: ad5770r: Add AD5770R support
> dt-bindings: iio: dac: Add docs for AD5770R DAC
>
> .../bindings/iio/dac/adi,ad5770r.yaml | 176 +++++
> drivers/iio/dac/Kconfig | 10 +
> drivers/iio/dac/Makefile | 1 +
> drivers/iio/dac/ad5770r.c | 662 ++++++++++++++++++
> include/linux/iio/common/adi_spi_regs.h | 44 ++
> 5 files changed, 893 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
> create mode 100644 drivers/iio/dac/ad5770r.c
> create mode 100644 include/linux/iio/common/adi_spi_regs.h
>

2020-02-08 14:37:16

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH 2/2] dt-bindings: iio: dac: Add docs for AD5770R DAC

On Thu, 6 Feb 2020 11:23:13 +0200
Alexandru Tachici <[email protected]> wrote:

> Adding dt-bindings documentation for AD5770R DAC.
>
> Signed-off-by: Mircea Caprioru <[email protected]>
> Signed-off-by: Alexandru Tachici <[email protected]>

A few minor bits inline.

> ---
> .../bindings/iio/dac/adi,ad5770r.yaml | 176 ++++++++++++++++++
> 1 file changed, 176 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
>
> diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
> new file mode 100644
> index 000000000000..02b2f6e67583
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
> @@ -0,0 +1,176 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +# Copyright 2020 Analog Devices Inc.
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/bindings/iio/adc/adi,ad5770r.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Analog Devices AD5770R DAC device driver
> +
> +maintainers:
> + - Mircea Caprioru <[email protected]>
> +
> +description: |
> + Bindings for the Analog Devices AD5770R current DAC device. Datasheet can be
> + found here:
> + https://www.analog.com/media/en/technical-documentation/data-sheets/AD5770R.pdf
> +
> +properties:
> + compatible:
> + enum:
> + - adi,ad5770r
> +
> + reg:
> + maxItems: 1
> +
> + vref-supply:

Probably need to also mention the main power supply?
Ideally enable it in the driver, but if not should still be in the binding.

> + description: Specify the voltage of the external reference used.
> + Available reference options are 1.25 V or 2.5 V. If no
> + external reference declared then the device will use the
> + internal reference of 1.25 V.
> +
> + adi,external-resistor:
> + description: Specify if an external 2.5k ohm resistor is used. If not
> + specified the device will use and internal 2.5k ohm resistor.

use an internal...

> + The precision resistor is used for reference current generation.
> + type: boolean
> +
> + reset-gpios:
> + description: GPIO spec for the RESET pin. If specified, it will be
> + asserted during driver probe.
> + maxItems: 1
> +
> + channel0:
> + description: Represents an external channel which are
> + connected to the DAC. Channel 0 can act both as a current
> + source and sink.
> + type: object
> +
> + properties:
> + num:
> + description: This represents the channel number.
> + items:
> + const: 0
> +
> + adi,range-microamp:
> + description: Output range of the channel.
> + oneOf:
> + - $ref: /schemas/types.yaml#/definitions/int32-array
> + - items:
> + - enum: [0 300000]
> + - enum: [-60000 0]
> + - enum: [-60000 300000]
> +
> + channel1:
> + description: Represents an external channel which are
> + connected to the DAC.
> + type: object
> +
> + properties:
> + num:
> + description: This represents the channel number.
> + items:
> + const: 1
> +
> + adi,range-microamp:
> + description: Output range of the channel.
> + allOf:
> + - $ref: /schemas/types.yaml#/definitions/uint32-array
> + - items:
> + - enum: [0 140000]
> + - enum: [0 250000]
> +
> + channel2:
> + description: Represents an external channel which are
> + connected to the DAC.
> + type: object
> +
> + properties:
> + num:
> + description: This represents the channel number.
> + items:
> + const: 2
> +
> + adi,range-microamp:
> + description: Output range of the channel.
> + allOf:
> + - $ref: /schemas/types.yaml#/definitions/uint32-array
> + - items:
> + - enum: [0 140000]
> + - enum: [0 250000]
> +
> +patternProperties:
> + "^channel@([3-5])$":
> + type: object
> + description: Represents the external channels which are connected to the DAC.
> + properties:
> + num:
> + description: This represents the channel number.
> + items:
> + minimum: 3
> + maximum: 5
> +
> + adi,range-microamp:
> + description: Output range of the channel.
> + oneOf:
> + - $ref: /schemas/types.yaml#/definitions/uint32-array
> + - items:
> + - enum: [0 45000]
> + - enum: [0 100000]
> +
> +required:
> +- reg
> +- diff-channels
> +- channel0
> +- channel1
> +- channel2
> +- channel3
> +- channel4
> +- channel5
> +
> +examples:
> + - |
> + spi {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + ad5770r@0 {
> + compatible = "ad5770r";
> + reg = <0>;
> + spi-max-frequency = <1000000>;
> + vref-supply = <&vref>;
> + adi,external-resistor;
> + reset-gpios = <&gpio 22 0>;
> +
> + channel@0 {
> + num = <0>;
> + adi,range-microamp = <(-60000) 300000>;
> + };
> +
> + channel@1 {
> + num = <1>;
> + adi,range-microamp = <0 140000>;
> + };
> +
> + channel@2 {
> + num = <2>;
> + adi,range-microamp = <0 55000>;
> + };
> +
> + channel@3 {
> + num = <3>;
> + adi,range-microamp = <0 45000>;
> + };
> +
> + channel@4 {
> + num = <4>;
> + adi,range-microamp = <0 45000>;
> + };
> +
> + channel@5 {
> + num = <5>;
> + adi,range-microamp = <0 45000>;
> + };
> + };
> + };
> +...
> \ No newline at end of file
Tidy that up if you are doing a new version.