xref: /OK3568_Linux_fs/kernel/Documentation/devicetree/bindings/iio/iio-bindings.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunThis binding is derived from clock bindings, and based on suggestions
2*4882a593Smuzhiyunfrom Lars-Peter Clausen [1].
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunSources of IIO channels can be represented by any node in the device
5*4882a593Smuzhiyuntree. Those nodes are designated as IIO providers. IIO consumer
6*4882a593Smuzhiyunnodes use a phandle and IIO specifier pair to connect IIO provider
7*4882a593Smuzhiyunoutputs to IIO inputs. Similar to the gpio specifiers, an IIO
8*4882a593Smuzhiyunspecifier is an array of one or more cells identifying the IIO
9*4882a593Smuzhiyunoutput on a device. The length of an IIO specifier is defined by the
10*4882a593Smuzhiyunvalue of a #io-channel-cells property in the IIO provider node.
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun[1] https://marc.info/?l=linux-iio&m=135902119507483&w=2
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun==IIO providers==
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunRequired properties:
17*4882a593Smuzhiyun#io-channel-cells: Number of cells in an IIO specifier; Typically 0 for nodes
18*4882a593Smuzhiyun		   with a single IIO output and 1 for nodes with multiple
19*4882a593Smuzhiyun		   IIO outputs.
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunOptional properties:
22*4882a593Smuzhiyunlabel:		   A symbolic name for the device.
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunExample for a simple configuration with no trigger:
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun	adc: voltage-sensor@35 {
28*4882a593Smuzhiyun		compatible = "maxim,max1139";
29*4882a593Smuzhiyun		reg = <0x35>;
30*4882a593Smuzhiyun		#io-channel-cells = <1>;
31*4882a593Smuzhiyun		label = "voltage_feedback_group1";
32*4882a593Smuzhiyun	};
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunExample for a configuration with trigger:
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun	adc@35 {
37*4882a593Smuzhiyun		compatible = "some-vendor,some-adc";
38*4882a593Smuzhiyun		reg = <0x35>;
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun		adc1: iio-device@0 {
41*4882a593Smuzhiyun			#io-channel-cells = <1>;
42*4882a593Smuzhiyun			/* other properties */
43*4882a593Smuzhiyun		};
44*4882a593Smuzhiyun		adc2: iio-device@1 {
45*4882a593Smuzhiyun			#io-channel-cells = <1>;
46*4882a593Smuzhiyun			/* other properties */
47*4882a593Smuzhiyun		};
48*4882a593Smuzhiyun	};
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun==IIO consumers==
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunRequired properties:
53*4882a593Smuzhiyunio-channels:	List of phandle and IIO specifier pairs, one pair
54*4882a593Smuzhiyun		for each IIO input to the device. Note: if the
55*4882a593Smuzhiyun		IIO provider specifies '0' for #io-channel-cells,
56*4882a593Smuzhiyun		then only the phandle portion of the pair will appear.
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunOptional properties:
59*4882a593Smuzhiyunio-channel-names:
60*4882a593Smuzhiyun		List of IIO input name strings sorted in the same
61*4882a593Smuzhiyun		order as the io-channels property. Consumers drivers
62*4882a593Smuzhiyun		will use io-channel-names to match IIO input names
63*4882a593Smuzhiyun		with IIO specifiers.
64*4882a593Smuzhiyunio-channel-ranges:
65*4882a593Smuzhiyun		Empty property indicating that child nodes can inherit named
66*4882a593Smuzhiyun		IIO channels from this node. Useful for bus nodes to provide
67*4882a593Smuzhiyun		and IIO channel to their children.
68*4882a593Smuzhiyun
69*4882a593SmuzhiyunFor example:
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun	device {
72*4882a593Smuzhiyun		io-channels = <&adc 1>, <&ref 0>;
73*4882a593Smuzhiyun		io-channel-names = "vcc", "vdd";
74*4882a593Smuzhiyun	};
75*4882a593Smuzhiyun
76*4882a593SmuzhiyunThis represents a device with two IIO inputs, named "vcc" and "vdd".
77*4882a593SmuzhiyunThe vcc channel is connected to output 1 of the &adc device, and the
78*4882a593Smuzhiyunvdd channel is connected to output 0 of the &ref device.
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun==Example==
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun	adc: max1139@35 {
83*4882a593Smuzhiyun		compatible = "maxim,max1139";
84*4882a593Smuzhiyun		reg = <0x35>;
85*4882a593Smuzhiyun		#io-channel-cells = <1>;
86*4882a593Smuzhiyun	};
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun	...
89*4882a593Smuzhiyun
90*4882a593Smuzhiyun	iio-hwmon {
91*4882a593Smuzhiyun		compatible = "iio-hwmon";
92*4882a593Smuzhiyun		io-channels = <&adc 0>, <&adc 1>, <&adc 2>,
93*4882a593Smuzhiyun			<&adc 3>, <&adc 4>, <&adc 5>,
94*4882a593Smuzhiyun			<&adc 6>, <&adc 7>, <&adc 8>,
95*4882a593Smuzhiyun			<&adc 9>;
96*4882a593Smuzhiyun	};
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun	some_consumer {
99*4882a593Smuzhiyun		compatible = "some-consumer";
100*4882a593Smuzhiyun		io-channels = <&adc 10>, <&adc 11>;
101*4882a593Smuzhiyun		io-channel-names = "adc1", "adc2";
102*4882a593Smuzhiyun	};
103