Skip to contentSkip to conversation

Add support for LTC2688

PATCH In review Nuno Sá 3 participants 8 messages Feb 25, 2022 – Mar 2, 2022

Subsystems (4)
lore
Share & tools
lore

Nuno Sá

author maintainer
#0 lore raw

v4 cover Add support for LTC2688

The ABI defined for this driver has some subtleties that were previously discussed in this RFC [1]. This might not be the final state but, hopefully, we are close to it:

toggle mode channels:

* out_voltageY_toggle_en
* out_voltageY_raw0
* out_voltageY_raw1
* out_voltageY_symbol

dither mode channels:

* out_voltageY_dither_en
* out_voltageY_dither_raw
* out_voltageY_dither_raw_available
* out_voltageY_dither_offset
* out_voltageY_dither_frequency
* out_voltageY_dither_frequency_available
* out_voltageY_dither_phase
* out_voltageY_dither_phase_available

Default channels won't have any of the above ABIs. A channel is toggle capable if the devicetree 'adi,toggle-mode' flag is set. For dither, the assumption is more silent. If 'adi,toggle-mode' is not given and a channel is associated with a TGPx pin through 'adi,toggle-dither-input', then the channel is assumed to be dither capable (there's no point in having a dither capable channel without an input clock).

changes in v2:

ltc2688:
* Use local buffer for regmap read. Do not assume that reg is part of
larger buffer;
* Renamed GPIO to "clr" so that is consistent with the datasheet;
* Renamed 'mask' and 'm' to info. 'mask' is a thing from the past;
* Removed 'LTC2688_CHAN_TOGGLE()' and defined to static ext_info arrays;
* Use 'regmap_set_bits' to set external ref;
* Use FIELD_{PREP|GET} for dither amplitude and channel calibbias where
only 13bits are used;
* Use 'regmap_write()' instead of update_bits for channels settings;
* Init 'val' at the beginning of the channel configuration loop
(and drop mask);
* Comment 'ltc2688_reg_writable()' to account for the special condition;
* Kmemdup default channels so that it can be safely changed per probed
device;
* Replace extended info multiplexer functions by individual functions;
* Use raw0 ABI for toggle channels;
* Use dedicated offset ABI for dither channels;
* Misc changes (spell fixes, blank lines...);
* Have a clock property per channel. Note that we this I moved to OF
since we now have to use 'devm_get_clk_from_child()' which is using device_node. Note that I could use 'to_of_node()' but mixing of.h and property.h does not feel like a good idea.

ABI:
* Added out_voltageY_raw0 ABI for toggle mode;
* Added out_voltageY_dither_offset.

Bindings:
* Use standard microvolt unit;
* Added constrains for adi,output-range-microvolt and removed negative
values from the dts example;
* Moved clocks to the channel object;
* Dropped clock-names;
* Add a dependency between 'adi,toggle-dither-input' and 'clocks'.

Changes in v3:

ltc2688:
* Fix mismatch between functions and function pointers detected by kernel
test bot;
* Always use if (ret) when ret > 0 has no meaning;
* Rename ltc2688_bulk_disable -> ltc2688_disable_regulators;
* Report dither phase in radians rather than degrees.

ABI:
* Specify units for dither_phase and dither_freqency;
* Say why its useful to have dither_en and toggle_en;
* Combine out_voltageY_raw0 and out_voltageY_raw1;
* Fix some description issues in out_voltageY_raw{0|1} and
out_voltageY_symbol.

Bindings:
* Remove mentions to ABI (linux specifix);
* Slightly rephrased VREF and adi,toggle-dither-input properties and
suggested.

changes in v4:

ltc2688:
* Use reg_size + val_size instead of plain 3 in regmap;
* Use out_unlock instead of unlock in goto labels;
* Add comma to LTC2688_CHANNEL(), ltc2688_regmap_bus and
ltc2688_regmap_bus;
* Use __clear_bit() instead of clear_bit();
* Flip the logic in vref regulator so that error condition is handled
first;
* Change to device API. With this, we need to_of_node()
for devm_get_clk_from_child().

ABI:
* Update kernel version.

Bindings:
* Add Rob's Rb tag.

[1]: https://marc.info/?l=linux-iio&m=163662843603265&w=2

Nuno Sá (3):
iio: dac: add support for ltc2688
iio: ABI: add ABI file for the LTC2688 DAC
dt-bindings: iio: Add ltc2688 documentation

 .../ABI/testing/sysfs-bus-iio-dac-ltc2688     |   86 ++
 .../bindings/iio/dac/adi,ltc2688.yaml         |  146 +++
 MAINTAINERS                                   |    9 +
 drivers/iio/dac/Kconfig                       |   11 +
 drivers/iio/dac/Makefile                      |    1 +
 drivers/iio/dac/ltc2688.c                     | 1071 +++++++++++++++++
 6 files changed, 1324 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-dac-ltc2688
 create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ltc2688.yaml
 create mode 100644 drivers/iio/dac/ltc2688.c
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH v4 1/3 iio: dac: add support for ltc2688

The LTC2688 is a 16 channel, 16 bit, +-15V DAC with an integrated precision reference. It is guaranteed monotonic and has built in rail-to-rail output buffers that can source or sink up to 20 mA.

---
 MAINTAINERS               |    7 +
 drivers/iio/dac/Kconfig   |   11 +
 drivers/iio/dac/Makefile  |    1 +
 drivers/iio/dac/ltc2688.c | 1071 +++++++++++++++++++++++++++++++++++++
 4 files changed, 1090 insertions(+)
 create mode 100644 drivers/iio/dac/ltc2688.c
MAINTAINERS +7 -0
index 96e9243f0242..6fc957727094 100644
@@ -11309,6 +11309,13 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/iio/dac/lltc,ltc1660.yaml
 F:	drivers/iio/dac/ltc1660.c
 
+LTC2688 IIO DAC DRIVER
+M:	Nuno Sá <[email protected]>
+L:	[email protected]
+S:	Supported
+W:	http://ez.analog.com/community/linux-device-drivers
+F:	drivers/iio/dac/ltc2688.c
+
 LTC2947 HARDWARE MONITOR DRIVER
 M:	Nuno Sá <[email protected]>
 L:	[email protected]
drivers/iio/dac/Kconfig +11 -0
index bfcf7568de32..c0bf0d84197f 100644
@@ -131,6 +131,17 @@ config AD5624R_SPI
 	  Say yes here to build support for Analog Devices AD5624R, AD5644R and
 	  AD5664R converters (DAC). This driver uses the common SPI interface.
 
+config LTC2688
+	tristate "Analog Devices LTC2688 DAC spi driver"
+	depends on SPI
+	select REGMAP
+	help
+	  Say yes here to build support for Analog Devices
+	  LTC2688 converters (DAC).
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ltc2688.
+
 config AD5686
 	tristate
 
drivers/iio/dac/Makefile +1 -0
index 01a50131572f..ec3e42713f00 100644
@@ -35,6 +35,7 @@ obj-$(CONFIG_DS4424) += ds4424.o
 obj-$(CONFIG_LPC18XX_DAC) += lpc18xx_dac.o
 obj-$(CONFIG_LTC1660) += ltc1660.o
 obj-$(CONFIG_LTC2632) += ltc2632.o
+obj-$(CONFIG_LTC2688) += ltc2688.o
 obj-$(CONFIG_M62332) += m62332.o
 obj-$(CONFIG_MAX517) += max517.o
 obj-$(CONFIG_MAX5821) += max5821.o
drivers/iio/dac/ltc2688.c new file +1071 -0

1,071 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH v4 1/3] iio: dac: add support for ltc2688

Quoted 5 lines · On Fri, 25 Feb 2022 14:01:27 +0100 Nuno Sá <[email protected]> wrote:

The LTC2688 is a 16 channel, 16 bit, +-15V DAC with an integrated precision reference. It is guaranteed monotonic and has built in rail-to-rail output buffers that can source or sink up to 20 mA.

Just one comment below - not a suggestion to change anything at this stage though, just something that might come up in future.

...

drivers/iio/dac/ltc2688.c line 580

Quoted 4 lines
drivers/iio/dac/ltc2688.c new file +4 -0
+static const char * const ltc2688_dither_phase[] = {
+	"0", "1.5708", "3.14159", "4.71239",
+};
+

It if turns out we have in kernel users for this in the long run we may need to change these over to numeric values, but we can do that without changing the userspace ABI, so this is fine for now.

...

Thanks,

Jonathan

author maintainer
#3 lore raw

PATCH v4 2/3 iio: ABI: add ABI file for the LTC2688 DAC

In reply to Nuno Sá

Define the sysfs interface for toggle or dither capable channels. Dither capable channels will have the extended interface:

* out_voltageY_dither_en
* out_voltageY_dither_raw
* out_voltageY_dither_offset
* out_voltageY_dither_raw_available
* out_voltageY_dither_frequency
* out_voltageY_dither_frequency_available
* out_voltageY_dither_phase
* out_voltageY_dither_phase_available

Toggle enabled channels will have:

* out_voltageY_toggle_en
* out_voltageY_raw0
* out_voltageY_raw1
* out_voltageY_symbol

The common interface present in all channels is:

* out_voltageY_raw (not present in toggle enabled channels)
* out_voltageY_raw_available
* out_voltageY_powerdown
* out_voltageY_scale
* out_voltageY_offset
* out_voltageY_calibbias
* out_voltageY_calibscale

---
 .../ABI/testing/sysfs-bus-iio-dac-ltc2688     | 86 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 87 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-dac-ltc2688
Documentation/ABI/testing/sysfs-bus-iio-dac-ltc2688 new file +86 -0
new file mode 100644
index 000000000000..1c35971277ba
@@ -0,0 +1,86 @@
+What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_dither_en
+KernelVersion:	5.18
+Contact:	[email protected]
+Description:
+		Dither enable. Write 1 to enable dither or 0 to disable it. This is useful
+		for changing the dither parameters. They way it should be done is:
+
+		- disable dither operation;
+		- change dither parameters (eg: frequency, phase...);
+		- enabled dither operation
+
+What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_dither_raw
+KernelVersion:	5.18
+Contact:	[email protected]
+Description:
+		This raw, unscaled value refers to the dither signal amplitude.
+		The same scale as in out_voltageY_raw applies. However, the
+		offset might be different as it's always 0 for this attribute.
+
+What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_dither_raw_available
+KernelVersion:	5.18
+Contact:	[email protected]
+Description:
+		Available range for dither raw amplitude values.
+
+What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_dither_offset
+KernelVersion:	5.18
+Contact:	[email protected]
+Description:
+		Offset applied to out_voltageY_dither_raw. Read only attribute
+		always set to 0.
+
+What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_dither_frequency
+KernelVersion:	5.18
+Contact:	[email protected]
+Description:
+		Sets the dither signal frequency. Units are in Hz.
+
+What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_dither_frequency_available
+KernelVersion:	5.18
+Contact:	[email protected]
+Description:
+		Returns the available values for the dither frequency.
+
+What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_dither_phase
+KernelVersion:	5.18
+Contact:	[email protected]
+Description:
+		Sets the dither signal phase. Units are in Radians.
+
+What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_dither_phase_available
+KernelVersion:	5.18
+Contact:	[email protected]
+Description:
+		Returns the available values for the dither phase.
+
+What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_toggle_en
+KernelVersion:	5.18
+Contact:	[email protected]
+Description:
+		Toggle enable. Write 1 to enable toggle or 0 to disable it. This is
+		useful when one wants to change the DAC output codes. The way it should
+		be done is:
+
+		- disable toggle operation;
+		- change out_voltageY_raw0 and out_voltageY_raw1;
+		- enable toggle operation.
+
+What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_raw0
+What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_raw1
+KernelVersion:	5.18
+Contact:	[email protected]
+Description:
+		It has the same meaning as out_voltageY_raw. This attribute is
+		specific to toggle enabled channels and refers to the DAC output
+		code in INPUT_A (_raw0) and INPUT_B (_raw1). The same scale and offset
+		as in out_voltageY_raw applies.
+
+What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_symbol
+KernelVersion:	5.18
+Contact:	[email protected]
+Description:
+		Performs a SW toggle. This attribute is specific to toggle
+		enabled channels and allows to toggle between out_voltageY_raw0
+		and out_voltageY_raw1 through software. Writing 0 will select
+		out_voltageY_raw0 while 1 selects out_voltageY_raw1.
MAINTAINERS +1 -0
index 6fc957727094..fd22f126dc01 100644
@@ -11314,6 +11314,7 @@ M:	Nuno Sá <[email protected]>
 L:	[email protected]
 S:	Supported
 W:	http://ez.analog.com/community/linux-device-drivers
+F:	Documentation/ABI/testing/sysfs-bus-iio-dac-ltc2688
 F:	drivers/iio/dac/ltc2688.c
 
 LTC2947 HARDWARE MONITOR DRIVER
Signature · 1 line
2.34.1
author maintainer
#4 lore raw

PATCH v4 3/3 dt-bindings: iio: Add ltc2688 documentation

In reply to Nuno Sá

Document the LTC2688 devicetree properties.

---
 .../bindings/iio/dac/adi,ltc2688.yaml         | 146 ++++++++++++++++++
 MAINTAINERS                                   |   1 +
 2 files changed, 147 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ltc2688.yaml
Documentation/devicetree/bindings/iio/dac/adi,ltc2688.yaml new file +146 -0
new file mode 100644
index 000000000000..48f9e7d29423
@@ -0,0 +1,146 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/dac/adi,ltc2688.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices LTC2688 DAC
+
+maintainers:
+  - Nuno Sá <[email protected]>
+
+description: |
+  Analog Devices LTC2688 16 channel, 16 bit, +-15V DAC
+  https://www.analog.com/media/en/technical-documentation/data-sheets/ltc2688.pdf
+
+properties:
+  compatible:
+    enum:
+      - adi,ltc2688
+
+  reg:
+    maxItems: 1
+
+  vcc-supply:
+    description: Analog Supply Voltage Input.
+
+  iovcc-supply:
+    description: Digital Input/Output Supply Voltage.
+
+  vref-supply:
+    description:
+      Reference Input/Output. The voltage at the REF pin sets the full-scale
+      range of all channels. If not provided the internal reference is used and
+      also provided on the VREF pin".
+
+  clr-gpios:
+    description:
+      If specified, it will be asserted during driver probe. As the line is
+      active low, it should be marked GPIO_ACTIVE_LOW.
+    maxItems: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+patternProperties:
+  "^channel@([0-9]|1[0-5])$":
+    type: object
+
+    properties:
+      reg:
+        description: The channel number representing the DAC output channel.
+        maximum: 15
+
+      adi,toggle-mode:
+        description:
+          Set the channel as a toggle enabled channel. Toggle operation enables
+          fast switching of a DAC output between two different DAC codes without
+          any SPI transaction.
+        type: boolean
+
+      adi,output-range-microvolt:
+        description: Specify the channel output full scale range.
+        oneOf:
+          - items:
+              - const: 0
+              - enum: [5000000, 10000000]
+          - items:
+              - const: -5000000
+              - const: 5000000
+          - items:
+              - const: -10000000
+              - const: 10000000
+          - items:
+              - const: -15000000
+              - const: 15000000
+
+      adi,overrange:
+        description: Enable 5% overrange over the selected full scale range.
+        type: boolean
+
+      clocks:
+        maxItems: 1
+
+      adi,toggle-dither-input:
+        description:
+          Selects the TGPx pin to be associated with this channel. This setting
+          only makes sense for toggle or dither enabled channels. If
+          @adi,toggle-mode is not set and this property is given, the channel is
+          assumed to be a dither capable channel. Note that multiple channels
+          can be mapped to the same pin. If this setting is given, the
+          respective @clock must also be provided. Mappings between this and
+          input pins
+            0 - TGP1
+            1 - TGP2
+            2 - TGP3
+        $ref: /schemas/types.yaml#/definitions/uint32
+        enum: [0, 1, 2]
+
+    dependencies:
+      adi,toggle-dither-input: [ clocks ]
+
+    required:
+      - reg
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+
+    spi {
+          #address-cells = <1>;
+          #size-cells = <0>;
+          ltc2688: ltc2688@0 {
+                  compatible = "adi,ltc2688";
+                  reg = <0>;
+
+                  vcc-supply = <&vcc>;
+                  iovcc-supply = <&vcc>;
+                  vref-supply = <&vref>;
+
+                  #address-cells = <1>;
+                  #size-cells = <0>;
+                  channel@0 {
+                          reg = <0>;
+                          adi,toggle-mode;
+                          adi,overrange;
+                  };
+
+                  channel@1 {
+                          reg = <1>;
+                          adi,output-range-microvolt = <0 10000000>;
+
+                          clocks = <&clock_tgp3>;
+                          adi,toggle-dither-input = <2>;
+                  };
+          };
+    };
+
+...
MAINTAINERS +1 -0
index fd22f126dc01..cd81378f5081 100644
@@ -11315,6 +11315,7 @@ L:	[email protected]
 S:	Supported
 W:	http://ez.analog.com/community/linux-device-drivers
 F:	Documentation/ABI/testing/sysfs-bus-iio-dac-ltc2688
+F:	Documentation/devicetree/bindings/iio/dac/adi,ltc2688.yaml
 F:	drivers/iio/dac/ltc2688.c
 
 LTC2947 HARDWARE MONITOR DRIVER
Signature · 1 line
2.34.1
maintainer
#5 lore raw
In reply to Nuno Sá

On Fri, 25 Feb 2022 14:01:26 +0100
Nuno Sá <[email protected]> wrote:

Hi Nuno,

Given we are close to the end of this cycle and Andy has been heavily involved in review of this one so I want to give more time for Andy to potentially take another look..

Hence, I'm going to do something unusual and push out an extra-testing branch with this on so we can get through the autobuilder tests in parallel with that extra time.

So, applied to the new extra-testing branch of iio.git with the intent to apply it to togreg later in a day or two subject to any last minute feedback.

Thanks,

Jonathan

Quoted 125 lines

The ABI defined for this driver has some subtleties that were previously discussed in this RFC [1]. This might not be the final state but, hopefully, we are close to it:

toggle mode channels:

* out_voltageY_toggle_en
* out_voltageY_raw0
* out_voltageY_raw1
* out_voltageY_symbol

dither mode channels:

* out_voltageY_dither_en
* out_voltageY_dither_raw
* out_voltageY_dither_raw_available
* out_voltageY_dither_offset
* out_voltageY_dither_frequency
* out_voltageY_dither_frequency_available
* out_voltageY_dither_phase
* out_voltageY_dither_phase_available

Default channels won't have any of the above ABIs. A channel is toggle capable if the devicetree 'adi,toggle-mode' flag is set. For dither, the assumption is more silent. If 'adi,toggle-mode' is not given and a channel is associated with a TGPx pin through 'adi,toggle-dither-input', then the channel is assumed to be dither capable (there's no point in having a dither capable channel without an input clock).

changes in v2:

ltc2688:
* Use local buffer for regmap read. Do not assume that reg is part of
larger buffer;
* Renamed GPIO to "clr" so that is consistent with the datasheet;
* Renamed 'mask' and 'm' to info. 'mask' is a thing from the past;
* Removed 'LTC2688_CHAN_TOGGLE()' and defined to static ext_info arrays;
* Use 'regmap_set_bits' to set external ref;
* Use FIELD_{PREP|GET} for dither amplitude and channel calibbias where
only 13bits are used;
* Use 'regmap_write()' instead of update_bits for channels settings;
* Init 'val' at the beginning of the channel configuration loop
(and drop mask);
* Comment 'ltc2688_reg_writable()' to account for the special condition;
* Kmemdup default channels so that it can be safely changed per probed
device;
* Replace extended info multiplexer functions by individual functions;
* Use raw0 ABI for toggle channels;
* Use dedicated offset ABI for dither channels;
* Misc changes (spell fixes, blank lines...);
* Have a clock property per channel. Note that we this I moved to OF
since we now have to use 'devm_get_clk_from_child()' which is using device_node. Note that I could use 'to_of_node()' but mixing of.h and property.h does not feel like a good idea.

ABI:
* Added out_voltageY_raw0 ABI for toggle mode;
* Added out_voltageY_dither_offset.

Bindings:
* Use standard microvolt unit;
* Added constrains for adi,output-range-microvolt and removed negative
values from the dts example;
* Moved clocks to the channel object;
* Dropped clock-names;
* Add a dependency between 'adi,toggle-dither-input' and 'clocks'.

Changes in v3:

ltc2688:
* Fix mismatch between functions and function pointers detected by kernel
test bot;
* Always use if (ret) when ret > 0 has no meaning;
* Rename ltc2688_bulk_disable -> ltc2688_disable_regulators;
* Report dither phase in radians rather than degrees.

ABI:
* Specify units for dither_phase and dither_freqency;
* Say why its useful to have dither_en and toggle_en;
* Combine out_voltageY_raw0 and out_voltageY_raw1;
* Fix some description issues in out_voltageY_raw{0|1} and
out_voltageY_symbol.

Bindings:
* Remove mentions to ABI (linux specifix);
* Slightly rephrased VREF and adi,toggle-dither-input properties and
suggested.

changes in v4:

ltc2688:
* Use reg_size + val_size instead of plain 3 in regmap;
* Use out_unlock instead of unlock in goto labels;
* Add comma to LTC2688_CHANNEL(), ltc2688_regmap_bus and
ltc2688_regmap_bus;
* Use __clear_bit() instead of clear_bit();
* Flip the logic in vref regulator so that error condition is handled
first;
* Change to device API. With this, we need to_of_node()
for devm_get_clk_from_child().

ABI:
* Update kernel version.

Bindings:
* Add Rob's Rb tag.

[1]: https://marc.info/?l=linux-iio&m=163662843603265&w=2

Nuno Sá (3):
iio: dac: add support for ltc2688
iio: ABI: add ABI file for the LTC2688 DAC
dt-bindings: iio: Add ltc2688 documentation

 .../ABI/testing/sysfs-bus-iio-dac-ltc2688     |   86 ++
 .../bindings/iio/dac/adi,ltc2688.yaml         |  146 +++
 MAINTAINERS                                   |    9 +
 drivers/iio/dac/Kconfig                       |   11 +
 drivers/iio/dac/Makefile                      |    1 +
 drivers/iio/dac/ltc2688.c                     | 1071 +++++++++++++++++
 6 files changed, 1324 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-dac-ltc2688
 create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ltc2688.yaml
 create mode 100644 drivers/iio/dac/ltc2688.c
maintainer
#6 lore raw
Quoted 9 lines · On Sun, 27 Feb 2022 12:49:53 +0000 Jonathan Cameron <[email protected]> wrote:

On Fri, 25 Feb 2022 14:01:26 +0100
Nuno Sá <[email protected]> wrote:

Hi Nuno,

Given we are close to the end of this cycle and Andy has been heavily involved in review of this one so I want to give more time for Andy to potentially take another look..

Quoted 5 lines

Hence, I'm going to do something unusual and push out an extra-testing branch with this on so we can get through the autobuilder tests in parallel with that extra time.

So, applied to the new extra-testing branch of iio.git with the intent to apply it to togreg later in a day or two subject to any last minute feedback.

Given we may be very near to the cut off for the merge window (I aim to do a pull request after linux-next is out tomorrow), I've applied this to the togreg branch of iio.git and pushed it out to be picked up for linux-next.

Thanks,

Jonathan

Quoted 132 lines

Thanks,

Jonathan

Quoted 125 lines

The ABI defined for this driver has some subtleties that were previously discussed in this RFC [1]. This might not be the final state but, hopefully, we are close to it:

toggle mode channels:

* out_voltageY_toggle_en
* out_voltageY_raw0
* out_voltageY_raw1
* out_voltageY_symbol

dither mode channels:

* out_voltageY_dither_en
* out_voltageY_dither_raw
* out_voltageY_dither_raw_available
* out_voltageY_dither_offset
* out_voltageY_dither_frequency
* out_voltageY_dither_frequency_available
* out_voltageY_dither_phase
* out_voltageY_dither_phase_available

Default channels won't have any of the above ABIs. A channel is toggle capable if the devicetree 'adi,toggle-mode' flag is set. For dither, the assumption is more silent. If 'adi,toggle-mode' is not given and a channel is associated with a TGPx pin through 'adi,toggle-dither-input', then the channel is assumed to be dither capable (there's no point in having a dither capable channel without an input clock).

changes in v2:

ltc2688:
* Use local buffer for regmap read. Do not assume that reg is part of
larger buffer;
* Renamed GPIO to "clr" so that is consistent with the datasheet;
* Renamed 'mask' and 'm' to info. 'mask' is a thing from the past;
* Removed 'LTC2688_CHAN_TOGGLE()' and defined to static ext_info arrays;
* Use 'regmap_set_bits' to set external ref;
* Use FIELD_{PREP|GET} for dither amplitude and channel calibbias where
only 13bits are used;
* Use 'regmap_write()' instead of update_bits for channels settings;
* Init 'val' at the beginning of the channel configuration loop
(and drop mask);
* Comment 'ltc2688_reg_writable()' to account for the special condition;
* Kmemdup default channels so that it can be safely changed per probed
device;
* Replace extended info multiplexer functions by individual functions;
* Use raw0 ABI for toggle channels;
* Use dedicated offset ABI for dither channels;
* Misc changes (spell fixes, blank lines...);
* Have a clock property per channel. Note that we this I moved to OF
since we now have to use 'devm_get_clk_from_child()' which is using device_node. Note that I could use 'to_of_node()' but mixing of.h and property.h does not feel like a good idea.

ABI:
* Added out_voltageY_raw0 ABI for toggle mode;
* Added out_voltageY_dither_offset.

Bindings:
* Use standard microvolt unit;
* Added constrains for adi,output-range-microvolt and removed negative
values from the dts example;
* Moved clocks to the channel object;
* Dropped clock-names;
* Add a dependency between 'adi,toggle-dither-input' and 'clocks'.

Changes in v3:

ltc2688:
* Fix mismatch between functions and function pointers detected by kernel
test bot;
* Always use if (ret) when ret > 0 has no meaning;
* Rename ltc2688_bulk_disable -> ltc2688_disable_regulators;
* Report dither phase in radians rather than degrees.

ABI:
* Specify units for dither_phase and dither_freqency;
* Say why its useful to have dither_en and toggle_en;
* Combine out_voltageY_raw0 and out_voltageY_raw1;
* Fix some description issues in out_voltageY_raw{0|1} and
out_voltageY_symbol.

Bindings:
* Remove mentions to ABI (linux specifix);
* Slightly rephrased VREF and adi,toggle-dither-input properties and
suggested.

changes in v4:

ltc2688:
* Use reg_size + val_size instead of plain 3 in regmap;
* Use out_unlock instead of unlock in goto labels;
* Add comma to LTC2688_CHANNEL(), ltc2688_regmap_bus and
ltc2688_regmap_bus;
* Use __clear_bit() instead of clear_bit();
* Flip the logic in vref regulator so that error condition is handled
first;
* Change to device API. With this, we need to_of_node()
for devm_get_clk_from_child().

ABI:
* Update kernel version.

Bindings:
* Add Rob's Rb tag.

[1]: https://marc.info/?l=linux-iio&m=163662843603265&w=2

Nuno Sá (3):
iio: dac: add support for ltc2688
iio: ABI: add ABI file for the LTC2688 DAC
dt-bindings: iio: Add ltc2688 documentation

 .../ABI/testing/sysfs-bus-iio-dac-ltc2688     |   86 ++
 .../bindings/iio/dac/adi,ltc2688.yaml         |  146 +++
 MAINTAINERS                                   |    9 +
 drivers/iio/dac/Kconfig                       |   11 +
 drivers/iio/dac/Makefile                      |    1 +
 drivers/iio/dac/ltc2688.c                     | 1071 +++++++++++++++++
 6 files changed, 1324 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-dac-ltc2688
 create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ltc2688.yaml
 create mode 100644 drivers/iio/dac/ltc2688.c
#7 lore raw
Quoted 24 lines · Jonathan Cameron
Quoted 16 lines · On Sun, 27 Feb 2022 12:49:53 +0000 Jonathan Cameron <[email protected]> wrote:

On Fri, 25 Feb 2022 14:01:26 +0100
Nuno Sá <[email protected]> wrote:

Hi Nuno,

Given we are close to the end of this cycle and Andy has been heavily involved
in review of this one so I want to give more time for Andy to potentially take
another look..

Hence, I'm going to do something unusual and push out an extra- testing branch with this
on so we can get through the autobuilder tests in parallel with that extra time.

Quoted 4 lines

So, applied to the new extra-testing branch of iio.git with the intent to apply
it to togreg later in a day or two subject to any last minute feedback.

Quoted 6 lines

Given we may be very near to the cut off for the merge window (I aim to do a pull
request after linux-next is out tomorrow), I've applied this to the togreg
branch of iio.git and pushed it out to be picked up for linux-next.

Thanks!

- Nuno Sá