xref: /freebsd/sys/contrib/device-tree/Bindings/iio/dac/ad5592r.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel VadotAnalog Devices AD5592R/AD5593R DAC/ADC device driver
2*c66ec88fSEmmanuel Vadot
3*c66ec88fSEmmanuel VadotRequired properties for the AD5592R:
4*c66ec88fSEmmanuel Vadot	- compatible: Must be "adi,ad5592r"
5*c66ec88fSEmmanuel Vadot	- reg: SPI chip select number for the device
6*c66ec88fSEmmanuel Vadot	- spi-max-frequency: Max SPI frequency to use (< 30000000)
7*c66ec88fSEmmanuel Vadot	- spi-cpol: The AD5592R requires inverse clock polarity (CPOL) mode
8*c66ec88fSEmmanuel Vadot
9*c66ec88fSEmmanuel VadotRequired properties for the AD5593R:
10*c66ec88fSEmmanuel Vadot	- compatible: Must be "adi,ad5593r"
11*c66ec88fSEmmanuel Vadot	- reg: I2C address of the device
12*c66ec88fSEmmanuel Vadot
13*c66ec88fSEmmanuel VadotRequired properties for all supported chips:
14*c66ec88fSEmmanuel Vadot	- #address-cells: Should be 1.
15*c66ec88fSEmmanuel Vadot	- #size-cells: Should be 0.
16*c66ec88fSEmmanuel Vadot	- channel nodes:
17*c66ec88fSEmmanuel Vadot	  Each child node represents one channel and has the following
18*c66ec88fSEmmanuel Vadot	  Required properties:
19*c66ec88fSEmmanuel Vadot		* reg: Pin on which this channel is connected to.
20*c66ec88fSEmmanuel Vadot		* adi,mode: Mode or function of this channel.
21*c66ec88fSEmmanuel Vadot			    Macros specifying the valid values
22*c66ec88fSEmmanuel Vadot			    can be found in <dt-bindings/iio/adi,ad5592r.h>.
23*c66ec88fSEmmanuel Vadot
24*c66ec88fSEmmanuel Vadot			    The following values are currently supported:
25*c66ec88fSEmmanuel Vadot				* CH_MODE_UNUSED (the pin is unused)
26*c66ec88fSEmmanuel Vadot				* CH_MODE_ADC (the pin is ADC input)
27*c66ec88fSEmmanuel Vadot				* CH_MODE_DAC (the pin is DAC output)
28*c66ec88fSEmmanuel Vadot				* CH_MODE_DAC_AND_ADC (the pin is DAC output
29*c66ec88fSEmmanuel Vadot					but can be monitored by an ADC, since
30*c66ec88fSEmmanuel Vadot					there is no disadvantage this
31*c66ec88fSEmmanuel Vadot					this should be considered as the
32*c66ec88fSEmmanuel Vadot					preferred DAC mode)
33*c66ec88fSEmmanuel Vadot				* CH_MODE_GPIO (the pin is registered
34*c66ec88fSEmmanuel Vadot					with GPIOLIB)
35*c66ec88fSEmmanuel Vadot	 Optional properties:
36*c66ec88fSEmmanuel Vadot		* adi,off-state: State of this channel when unused or the
37*c66ec88fSEmmanuel Vadot				 device gets removed. Macros specifying the
38*c66ec88fSEmmanuel Vadot				 valid values can be found in
39*c66ec88fSEmmanuel Vadot				 <dt-bindings/iio/adi,ad5592r.h>.
40*c66ec88fSEmmanuel Vadot
41*c66ec88fSEmmanuel Vadot				* CH_OFFSTATE_PULLDOWN (the pin is pulled down)
42*c66ec88fSEmmanuel Vadot				* CH_OFFSTATE_OUT_LOW  (the pin is output low)
43*c66ec88fSEmmanuel Vadot				* CH_OFFSTATE_OUT_HIGH (the pin is output high)
44*c66ec88fSEmmanuel Vadot				* CH_OFFSTATE_OUT_TRISTATE (the pin is
45*c66ec88fSEmmanuel Vadot					tristated output)
46*c66ec88fSEmmanuel Vadot
47*c66ec88fSEmmanuel Vadot
48*c66ec88fSEmmanuel VadotOptional properties:
49*c66ec88fSEmmanuel Vadot	- vref-supply: Phandle to the external reference voltage supply. This should
50*c66ec88fSEmmanuel Vadot	  only be set if there is an external reference voltage connected to the VREF
51*c66ec88fSEmmanuel Vadot	  pin. If the property is not set the internal 2.5V reference is used.
52*c66ec88fSEmmanuel Vadot	- reset-gpios : GPIO spec for the RESET pin. If specified, it will be
53*c66ec88fSEmmanuel Vadot	  asserted during driver probe.
54*c66ec88fSEmmanuel Vadot	- gpio-controller: Marks the device node as a GPIO controller.
55*c66ec88fSEmmanuel Vadot	- #gpio-cells: Should be 2. The first cell is the GPIO number and the second
56*c66ec88fSEmmanuel Vadot	  cell specifies GPIO flags, as defined in <dt-bindings/gpio/gpio.h>.
57*c66ec88fSEmmanuel Vadot
58*c66ec88fSEmmanuel VadotAD5592R Example:
59*c66ec88fSEmmanuel Vadot
60*c66ec88fSEmmanuel Vadot	#include <dt-bindings/iio/adi,ad5592r.h>
61*c66ec88fSEmmanuel Vadot
62*c66ec88fSEmmanuel Vadot	vref: regulator-vref {
63*c66ec88fSEmmanuel Vadot		compatible = "regulator-fixed";
64*c66ec88fSEmmanuel Vadot		regulator-name = "vref-ad559x";
65*c66ec88fSEmmanuel Vadot		regulator-min-microvolt = <3300000>;
66*c66ec88fSEmmanuel Vadot		regulator-max-microvolt = <3300000>;
67*c66ec88fSEmmanuel Vadot		regulator-always-on;
68*c66ec88fSEmmanuel Vadot	};
69*c66ec88fSEmmanuel Vadot
70*c66ec88fSEmmanuel Vadot	ad5592r@0 {
71*c66ec88fSEmmanuel Vadot		#size-cells = <0>;
72*c66ec88fSEmmanuel Vadot		#address-cells = <1>;
73*c66ec88fSEmmanuel Vadot		#gpio-cells = <2>;
74*c66ec88fSEmmanuel Vadot		compatible = "adi,ad5592r";
75*c66ec88fSEmmanuel Vadot		reg = <0>;
76*c66ec88fSEmmanuel Vadot
77*c66ec88fSEmmanuel Vadot		spi-max-frequency = <1000000>;
78*c66ec88fSEmmanuel Vadot		spi-cpol;
79*c66ec88fSEmmanuel Vadot
80*c66ec88fSEmmanuel Vadot		vref-supply = <&vref>; /* optional */
81*c66ec88fSEmmanuel Vadot		reset-gpios = <&gpio0 86 0>;  /* optional */
82*c66ec88fSEmmanuel Vadot		gpio-controller;
83*c66ec88fSEmmanuel Vadot
84*c66ec88fSEmmanuel Vadot		channel@0 {
85*c66ec88fSEmmanuel Vadot			reg = <0>;
86*c66ec88fSEmmanuel Vadot			adi,mode = <CH_MODE_DAC>;
87*c66ec88fSEmmanuel Vadot		};
88*c66ec88fSEmmanuel Vadot		channel@1 {
89*c66ec88fSEmmanuel Vadot			reg = <1>;
90*c66ec88fSEmmanuel Vadot			adi,mode = <CH_MODE_ADC>;
91*c66ec88fSEmmanuel Vadot		};
92*c66ec88fSEmmanuel Vadot		channel@2 {
93*c66ec88fSEmmanuel Vadot			reg = <2>;
94*c66ec88fSEmmanuel Vadot			adi,mode = <CH_MODE_DAC_AND_ADC>;
95*c66ec88fSEmmanuel Vadot		};
96*c66ec88fSEmmanuel Vadot		channel@3 {
97*c66ec88fSEmmanuel Vadot			reg = <3>;
98*c66ec88fSEmmanuel Vadot			adi,mode = <CH_MODE_DAC_AND_ADC>;
99*c66ec88fSEmmanuel Vadot			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
100*c66ec88fSEmmanuel Vadot		};
101*c66ec88fSEmmanuel Vadot		channel@4 {
102*c66ec88fSEmmanuel Vadot			reg = <4>;
103*c66ec88fSEmmanuel Vadot			adi,mode = <CH_MODE_UNUSED>;
104*c66ec88fSEmmanuel Vadot			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
105*c66ec88fSEmmanuel Vadot		};
106*c66ec88fSEmmanuel Vadot		channel@5 {
107*c66ec88fSEmmanuel Vadot			reg = <5>;
108*c66ec88fSEmmanuel Vadot			adi,mode = <CH_MODE_GPIO>;
109*c66ec88fSEmmanuel Vadot			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
110*c66ec88fSEmmanuel Vadot		};
111*c66ec88fSEmmanuel Vadot		channel@6 {
112*c66ec88fSEmmanuel Vadot			reg = <6>;
113*c66ec88fSEmmanuel Vadot			adi,mode = <CH_MODE_GPIO>;
114*c66ec88fSEmmanuel Vadot			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
115*c66ec88fSEmmanuel Vadot		};
116*c66ec88fSEmmanuel Vadot		channel@7 {
117*c66ec88fSEmmanuel Vadot			reg = <7>;
118*c66ec88fSEmmanuel Vadot			adi,mode = <CH_MODE_GPIO>;
119*c66ec88fSEmmanuel Vadot			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
120*c66ec88fSEmmanuel Vadot		};
121*c66ec88fSEmmanuel Vadot	};
122*c66ec88fSEmmanuel Vadot
123*c66ec88fSEmmanuel VadotAD5593R Example:
124*c66ec88fSEmmanuel Vadot
125*c66ec88fSEmmanuel Vadot	#include <dt-bindings/iio/adi,ad5592r.h>
126*c66ec88fSEmmanuel Vadot
127*c66ec88fSEmmanuel Vadot	ad5593r@10 {
128*c66ec88fSEmmanuel Vadot		#size-cells = <0>;
129*c66ec88fSEmmanuel Vadot		#address-cells = <1>;
130*c66ec88fSEmmanuel Vadot		#gpio-cells = <2>;
131*c66ec88fSEmmanuel Vadot		compatible = "adi,ad5593r";
132*c66ec88fSEmmanuel Vadot		reg = <0x10>;
133*c66ec88fSEmmanuel Vadot		gpio-controller;
134*c66ec88fSEmmanuel Vadot
135*c66ec88fSEmmanuel Vadot		channel@0 {
136*c66ec88fSEmmanuel Vadot			reg = <0>;
137*c66ec88fSEmmanuel Vadot			adi,mode = <CH_MODE_DAC>;
138*c66ec88fSEmmanuel Vadot			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
139*c66ec88fSEmmanuel Vadot		};
140*c66ec88fSEmmanuel Vadot		channel@1 {
141*c66ec88fSEmmanuel Vadot			reg = <1>;
142*c66ec88fSEmmanuel Vadot			adi,mode = <CH_MODE_ADC>;
143*c66ec88fSEmmanuel Vadot			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
144*c66ec88fSEmmanuel Vadot		};
145*c66ec88fSEmmanuel Vadot		channel@2 {
146*c66ec88fSEmmanuel Vadot			reg = <2>;
147*c66ec88fSEmmanuel Vadot			adi,mode = <CH_MODE_DAC_AND_ADC>;
148*c66ec88fSEmmanuel Vadot			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
149*c66ec88fSEmmanuel Vadot		};
150*c66ec88fSEmmanuel Vadot		channel@6 {
151*c66ec88fSEmmanuel Vadot			reg = <6>;
152*c66ec88fSEmmanuel Vadot			adi,mode = <CH_MODE_GPIO>;
153*c66ec88fSEmmanuel Vadot			adi,off-state = <CH_OFFSTATE_PULLDOWN>;
154*c66ec88fSEmmanuel Vadot		};
155*c66ec88fSEmmanuel Vadot	};
156