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