18c2ecf20Sopenharmony_ciAnalog Devices AD5592R/AD5593R DAC/ADC device driver
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciRequired properties for the AD5592R:
48c2ecf20Sopenharmony_ci	- compatible: Must be "adi,ad5592r"
58c2ecf20Sopenharmony_ci	- reg: SPI chip select number for the device
68c2ecf20Sopenharmony_ci	- spi-max-frequency: Max SPI frequency to use (< 30000000)
78c2ecf20Sopenharmony_ci	- spi-cpol: The AD5592R requires inverse clock polarity (CPOL) mode
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciRequired properties for the AD5593R:
108c2ecf20Sopenharmony_ci	- compatible: Must be "adi,ad5593r"
118c2ecf20Sopenharmony_ci	- reg: I2C address of the device
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciRequired properties for all supported chips:
148c2ecf20Sopenharmony_ci	- #address-cells: Should be 1.
158c2ecf20Sopenharmony_ci	- #size-cells: Should be 0.
168c2ecf20Sopenharmony_ci	- channel nodes:
178c2ecf20Sopenharmony_ci	  Each child node represents one channel and has the following
188c2ecf20Sopenharmony_ci	  Required properties:
198c2ecf20Sopenharmony_ci		* reg: Pin on which this channel is connected to.
208c2ecf20Sopenharmony_ci		* adi,mode: Mode or function of this channel.
218c2ecf20Sopenharmony_ci			    Macros specifying the valid values
228c2ecf20Sopenharmony_ci			    can be found in <dt-bindings/iio/adi,ad5592r.h>.
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci			    The following values are currently supported:
258c2ecf20Sopenharmony_ci				* CH_MODE_UNUSED (the pin is unused)
268c2ecf20Sopenharmony_ci				* CH_MODE_ADC (the pin is ADC input)
278c2ecf20Sopenharmony_ci				* CH_MODE_DAC (the pin is DAC output)
288c2ecf20Sopenharmony_ci				* CH_MODE_DAC_AND_ADC (the pin is DAC output
298c2ecf20Sopenharmony_ci					but can be monitored by an ADC, since
308c2ecf20Sopenharmony_ci					there is no disadvantage this
318c2ecf20Sopenharmony_ci					this should be considered as the
328c2ecf20Sopenharmony_ci					preferred DAC mode)
338c2ecf20Sopenharmony_ci				* CH_MODE_GPIO (the pin is registered
348c2ecf20Sopenharmony_ci					with GPIOLIB)
358c2ecf20Sopenharmony_ci	 Optional properties:
368c2ecf20Sopenharmony_ci		* adi,off-state: State of this channel when unused or the
378c2ecf20Sopenharmony_ci				 device gets removed. Macros specifying the
388c2ecf20Sopenharmony_ci				 valid values can be found in
398c2ecf20Sopenharmony_ci				 <dt-bindings/iio/adi,ad5592r.h>.
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci				* CH_OFFSTATE_PULLDOWN (the pin is pulled down)
428c2ecf20Sopenharmony_ci				* CH_OFFSTATE_OUT_LOW  (the pin is output low)
438c2ecf20Sopenharmony_ci				* CH_OFFSTATE_OUT_HIGH (the pin is output high)
448c2ecf20Sopenharmony_ci				* CH_OFFSTATE_OUT_TRISTATE (the pin is
458c2ecf20Sopenharmony_ci					tristated output)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ciOptional properties:
498c2ecf20Sopenharmony_ci	- vref-supply: Phandle to the external reference voltage supply. This should
508c2ecf20Sopenharmony_ci	  only be set if there is an external reference voltage connected to the VREF
518c2ecf20Sopenharmony_ci	  pin. If the property is not set the internal 2.5V reference is used.
528c2ecf20Sopenharmony_ci	- reset-gpios : GPIO spec for the RESET pin. If specified, it will be
538c2ecf20Sopenharmony_ci	  asserted during driver probe.
548c2ecf20Sopenharmony_ci	- gpio-controller: Marks the device node as a GPIO controller.
558c2ecf20Sopenharmony_ci	- #gpio-cells: Should be 2. The first cell is the GPIO number and the second
568c2ecf20Sopenharmony_ci	  cell specifies GPIO flags, as defined in <dt-bindings/gpio/gpio.h>.
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ciAD5592R Example:
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci	#include <dt-bindings/iio/adi,ad5592r.h>
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci	vref: regulator-vref {
638c2ecf20Sopenharmony_ci		compatible = "regulator-fixed";
648c2ecf20Sopenharmony_ci		regulator-name = "vref-ad559x";
658c2ecf20Sopenharmony_ci		regulator-min-microvolt = <3300000>;
668c2ecf20Sopenharmony_ci		regulator-max-microvolt = <3300000>;
678c2ecf20Sopenharmony_ci		regulator-always-on;
688c2ecf20Sopenharmony_ci	};
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	ad5592r@0 {
718c2ecf20Sopenharmony_ci		#size-cells = <0>;
728c2ecf20Sopenharmony_ci		#address-cells = <1>;
738c2ecf20Sopenharmony_ci		#gpio-cells = <2>;
748c2ecf20Sopenharmony_ci		compatible = "adi,ad5592r";
758c2ecf20Sopenharmony_ci		reg = <0>;
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci		spi-max-frequency = <1000000>;
788c2ecf20Sopenharmony_ci		spi-cpol;
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci		vref-supply = <&vref>; /* optional */
818c2ecf20Sopenharmony_ci		reset-gpios = <&gpio0 86 0>;  /* optional */
828c2ecf20Sopenharmony_ci		gpio-controller;
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci		channel@0 {
858c2ecf20Sopenharmony_ci			reg = <0>;
868c2ecf20Sopenharmony_ci			adi,mode = <CH_MODE_DAC>;
878c2ecf20Sopenharmony_ci		};
888c2ecf20Sopenharmony_ci		channel@1 {
898c2ecf20Sopenharmony_ci			reg = <1>;
908c2ecf20Sopenharmony_ci			adi,mode = <CH_MODE_ADC>;
918c2ecf20Sopenharmony_ci		};
928c2ecf20Sopenharmony_ci		channel@2 {
938c2ecf20Sopenharmony_ci			reg = <2>;
948c2ecf20Sopenharmony_ci			adi,mode = <CH_MODE_DAC_AND_ADC>;
958c2ecf20Sopenharmony_ci		};
968c2ecf20Sopenharmony_ci		channel@3 {
978c2ecf20Sopenharmony_ci			reg = <3>;
988c2ecf20Sopenharmony_ci			adi,mode = <CH_MODE_DAC_AND_ADC>;
998c2ecf20Sopenharmony_ci			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
1008c2ecf20Sopenharmony_ci		};
1018c2ecf20Sopenharmony_ci		channel@4 {
1028c2ecf20Sopenharmony_ci			reg = <4>;
1038c2ecf20Sopenharmony_ci			adi,mode = <CH_MODE_UNUSED>;
1048c2ecf20Sopenharmony_ci			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
1058c2ecf20Sopenharmony_ci		};
1068c2ecf20Sopenharmony_ci		channel@5 {
1078c2ecf20Sopenharmony_ci			reg = <5>;
1088c2ecf20Sopenharmony_ci			adi,mode = <CH_MODE_GPIO>;
1098c2ecf20Sopenharmony_ci			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
1108c2ecf20Sopenharmony_ci		};
1118c2ecf20Sopenharmony_ci		channel@6 {
1128c2ecf20Sopenharmony_ci			reg = <6>;
1138c2ecf20Sopenharmony_ci			adi,mode = <CH_MODE_GPIO>;
1148c2ecf20Sopenharmony_ci			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
1158c2ecf20Sopenharmony_ci		};
1168c2ecf20Sopenharmony_ci		channel@7 {
1178c2ecf20Sopenharmony_ci			reg = <7>;
1188c2ecf20Sopenharmony_ci			adi,mode = <CH_MODE_GPIO>;
1198c2ecf20Sopenharmony_ci			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
1208c2ecf20Sopenharmony_ci		};
1218c2ecf20Sopenharmony_ci	};
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ciAD5593R Example:
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci	#include <dt-bindings/iio/adi,ad5592r.h>
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci	ad5593r@10 {
1288c2ecf20Sopenharmony_ci		#size-cells = <0>;
1298c2ecf20Sopenharmony_ci		#address-cells = <1>;
1308c2ecf20Sopenharmony_ci		#gpio-cells = <2>;
1318c2ecf20Sopenharmony_ci		compatible = "adi,ad5593r";
1328c2ecf20Sopenharmony_ci		reg = <0x10>;
1338c2ecf20Sopenharmony_ci		gpio-controller;
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci		channel@0 {
1368c2ecf20Sopenharmony_ci			reg = <0>;
1378c2ecf20Sopenharmony_ci			adi,mode = <CH_MODE_DAC>;
1388c2ecf20Sopenharmony_ci			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
1398c2ecf20Sopenharmony_ci		};
1408c2ecf20Sopenharmony_ci		channel@1 {
1418c2ecf20Sopenharmony_ci			reg = <1>;
1428c2ecf20Sopenharmony_ci			adi,mode = <CH_MODE_ADC>;
1438c2ecf20Sopenharmony_ci			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
1448c2ecf20Sopenharmony_ci		};
1458c2ecf20Sopenharmony_ci		channel@2 {
1468c2ecf20Sopenharmony_ci			reg = <2>;
1478c2ecf20Sopenharmony_ci			adi,mode = <CH_MODE_DAC_AND_ADC>;
1488c2ecf20Sopenharmony_ci			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
1498c2ecf20Sopenharmony_ci		};
1508c2ecf20Sopenharmony_ci		channel@6 {
1518c2ecf20Sopenharmony_ci			reg = <6>;
1528c2ecf20Sopenharmony_ci			adi,mode = <CH_MODE_GPIO>;
1538c2ecf20Sopenharmony_ci			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
1548c2ecf20Sopenharmony_ci		};
1558c2ecf20Sopenharmony_ci	};
156