Merge commit '81fd23e2b3ccf71c807e671444e8accaba98ca53' of https://git.pengutronix...
[linux-2.6-microblaze.git] / Documentation / devicetree / bindings / iio / st,st-sensors.yaml
1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 %YAML 1.2
3 ---
4 $id: http://devicetree.org/schemas/iio/st,st-sensors.yaml#
5 $schema: http://devicetree.org/meta-schemas/core.yaml#
6
7 title: STMicroelectronics MEMS sensors
8
9 description: The STMicroelectronics sensor devices are pretty straight-forward
10   I2C or SPI devices, all sharing the same device tree descriptions no matter
11   what type of sensor it is.
12   Note that whilst this covers many STMicro MEMs sensors, some more complex
13   IMUs need their own bindings.
14   The STMicroelectronics sensor devices are pretty straight-forward I2C or
15   SPI devices, all sharing the same device tree descriptions no matter what
16   type of sensor it is.
17
18 maintainers:
19   - Denis Ciocca <denis.ciocca@st.com>
20   - Linus Walleij <linus.walleij@linaro.org>
21
22 properties:
23   compatible:
24     oneOf:
25       - description: STMicroelectronics Accelerometers
26         enum:
27           - st,h3lis331dl-accel
28           - st,lis2de12
29           - st,lis2dw12
30           - st,lis2hh12
31           - st,lis2dh12-accel
32           - st,lis331dl-accel
33           - st,lis331dlh-accel
34           - st,lis3de
35           - st,lis3dh-accel
36           - st,lis3dhh
37           - st,lis3l02dq
38           - st,lis3lv02dl-accel
39           - st,lng2dm-accel
40           - st,lsm303agr-accel
41           - st,lsm303dl-accel
42           - st,lsm303dlh-accel
43           - st,lsm303dlhc-accel
44           - st,lsm303dlm-accel
45           - st,lsm330-accel
46           - st,lsm330d-accel
47           - st,lsm330dl-accel
48           - st,lsm330dlc-accel
49       - description: STMicroelectronics Gyroscopes
50         enum:
51           - st,l3g4200d-gyro
52           - st,l3g4is-gyro
53           - st,l3gd20-gyro
54           - st,l3gd20h-gyro
55           - st,lsm330-gyro
56           - st,lsm330d-gyro
57           - st,lsm330dl-gyro
58           - st,lsm330dlc-gyro
59           - st,lsm9ds0-gyro
60       - description: STMicroelectronics Magnetometers
61         enum:
62           - st,lis2mdl
63           - st,lis3mdl-magn
64           - st,lsm303agr-magn
65           - st,lsm303dlh-magn
66           - st,lsm303dlhc-magn
67           - st,lsm303dlm-magn
68           - st,lsm9ds1-magn
69       - description: STMicroelectronics Pressure Sensors
70         enum:
71           - st,lps001wp-press
72           - st,lps22hb-press
73           - st,lps22hh
74           - st,lps25h-press
75           - st,lps331ap-press
76           - st,lps33hw
77           - st,lps35hw
78       - description: IMUs
79         enum:
80           - st,lsm9ds0-imu
81       - description: Deprecated bindings
82         enum:
83           - st,lis302dl-spi
84           - st,lis3lv02d
85         deprecated: true
86
87   reg:
88     maxItems: 1
89
90   interrupts:
91     description: interrupt line(s) connected to the DRDY line(s) and/or the
92       Intertial interrupt lines INT1 and INT2 if these exist. This means up to
93       three interrupts, and the DRDY must be the first one if it exists on
94       the package. The trigger edge of the interrupts is sometimes software
95       configurable in the hardware so the operating system should parse this
96       flag and set up the trigger edge as indicated in the device tree.
97     minItems: 1
98     maxItems: 2
99
100   vdd-supply: true
101   vddio-supply: true
102
103   st,drdy-int-pin:
104     description: the pin on the package that will be used to signal
105       "data ready" (valid values 1 or 2). This property is not configurable
106       on all sensors.
107     $ref: /schemas/types.yaml#/definitions/uint32
108     enum: [1, 2]
109
110   drive-open-drain:
111     $ref: /schemas/types.yaml#/definitions/flag
112     description: the interrupt/data ready line will be configured
113       as open drain, which is useful if several sensors share the same
114       interrupt line. (This binding is taken from pinctrl.)
115
116   mount-matrix:
117     description: an optional 3x3 mounting rotation matrix.
118
119 allOf:
120   - if:
121       properties:
122         compatible:
123           enum:
124             # These have no interrupts
125             - st,lps001wp
126     then:
127       properties:
128         interrupts: false
129         st,drdy-int-pin: false
130         drive-open-drain: false
131
132   - if:
133       properties:
134         compatible:
135           enum:
136             # These have only DRDY
137             - st,lis2mdl
138             - st,lis3l02dq
139             - st,lis3lv02dl-accel
140             - st,lps22hb-press
141             - st,lps22hh
142             - st,lps25h-press
143             - st,lps33hw
144             - st,lps35hw
145             - st,lsm303agr-magn
146             - st,lsm303dlh-magn
147             - st,lsm303dlhc-magn
148             - st,lsm303dlm-magn
149     then:
150       properties:
151         interrupts:
152           maxItems: 1
153         st,drdy-int-pin: false
154
155   - if:
156       properties:
157         compatible:
158           enum:
159             # Two intertial interrupts i.e. accelerometer/gyro interrupts
160             - st,h3lis331dl-accel
161             - st,l3g4200d-gyro
162             - st,l3g4is-gyro
163             - st,l3gd20-gyro
164             - st,l3gd20h-gyro
165             - st,lis2de12
166             - st,lis2dw12
167             - st,lis2hh12
168             - st,lis2dh12-accel
169             - st,lis331dl-accel
170             - st,lis331dlh-accel
171             - st,lis3de
172             - st,lis3dh-accel
173             - st,lis3dhh
174             - st,lis3mdl-magn
175             - st,lng2dm-accel
176             - st,lps331ap-press
177             - st,lsm303agr-accel
178             - st,lsm303dlh-accel
179             - st,lsm303dlhc-accel
180             - st,lsm303dlm-accel
181             - st,lsm330-accel
182             - st,lsm330-gyro
183             - st,lsm330d-accel
184             - st,lsm330d-gyro
185             - st,lsm330dl-accel
186             - st,lsm330dl-gyro
187             - st,lsm330dlc-accel
188             - st,lsm330dlc-gyro
189             - st,lsm9ds0-gyro
190             - st,lsm9ds1-magn
191     then:
192       properties:
193         interrupts:
194           maxItems: 2
195
196 required:
197   - compatible
198   - reg
199
200 additionalProperties: false
201
202 examples:
203   - |
204     #include <dt-bindings/interrupt-controller/irq.h>
205     i2c {
206       #address-cells = <1>;
207       #size-cells = <0>;
208
209       accelerometer@1c {
210         compatible = "st,lis331dl-accel";
211         reg = <0x1c>;
212         st,drdy-int-pin = <1>;
213         vdd-supply = <&ldo1>;
214         vddio-supply = <&ldo2>;
215         interrupt-parent = <&gpio>;
216         interrupts = <18 IRQ_TYPE_EDGE_RISING>, <19 IRQ_TYPE_EDGE_RISING>;
217       };
218     };
219     spi {
220       #address-cells = <1>;
221       #size-cells = <0>;
222       num-cs = <1>;
223
224       l3g4200d: gyroscope@0 {
225         compatible = "st,l3g4200d-gyro";
226         st,drdy-int-pin = <2>;
227         reg = <0>;
228         vdd-supply = <&vcc_io>;
229         vddio-supply = <&vcc_io>;
230       };
231     };
232 ...