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
7title: STMicroelectronics MEMS sensors
8
9description: 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
18maintainers:
19  - Denis Ciocca <denis.ciocca@st.com>
20  - Linus Walleij <linus.walleij@linaro.org>
21
22properties:
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,lis302dl
33          - st,lis331dl-accel
34          - st,lis331dlh-accel
35          - st,lis3de
36          - st,lis3dh-accel
37          - st,lis3dhh
38          - st,lis3l02dq
39          - st,lis3lv02dl-accel
40          - st,lng2dm-accel
41          - st,lsm303agr-accel
42          - st,lsm303dl-accel
43          - st,lsm303dlh-accel
44          - st,lsm303dlhc-accel
45          - st,lsm303dlm-accel
46          - st,lsm330-accel
47          - st,lsm330d-accel
48          - st,lsm330dl-accel
49          - st,lsm330dlc-accel
50      - description: Silan Accelerometers
51        enum:
52          - silan,sc7a20
53      - description: STMicroelectronics Gyroscopes
54        enum:
55          - st,l3g4200d-gyro
56          - st,l3g4is-gyro
57          - st,l3gd20-gyro
58          - st,l3gd20h-gyro
59          - st,lsm330-gyro
60          - st,lsm330d-gyro
61          - st,lsm330dl-gyro
62          - st,lsm330dlc-gyro
63          - st,lsm9ds0-gyro
64      - description: STMicroelectronics Magnetometers
65        enum:
66          - st,lis2mdl
67          - st,lis3mdl-magn
68          - st,lsm303agr-magn
69          - st,lsm303dlh-magn
70          - st,lsm303dlhc-magn
71          - st,lsm303dlm-magn
72          - st,lsm9ds1-magn
73      - description: STMicroelectronics Pressure Sensors
74        enum:
75          - st,lps001wp-press
76          - st,lps22hb-press
77          - st,lps22hh
78          - st,lps25h-press
79          - st,lps331ap-press
80          - st,lps33hw
81          - st,lps35hw
82      - description: IMUs
83        enum:
84          - st,lsm9ds0-imu
85      - description: Deprecated bindings
86        enum:
87          - st,lis302dl-spi
88          - st,lis3lv02d
89        deprecated: true
90
91  reg:
92    maxItems: 1
93
94  interrupts:
95    description: interrupt line(s) connected to the DRDY line(s) and/or the
96      Intertial interrupt lines INT1 and INT2 if these exist. This means up to
97      three interrupts, and the DRDY must be the first one if it exists on
98      the package. The trigger edge of the interrupts is sometimes software
99      configurable in the hardware so the operating system should parse this
100      flag and set up the trigger edge as indicated in the device tree.
101    minItems: 1
102    maxItems: 2
103
104  vdd-supply: true
105  vddio-supply: true
106
107  st,drdy-int-pin:
108    description: the pin on the package that will be used to signal
109      "data ready" (valid values 1 or 2). This property is not configurable
110      on all sensors.
111    $ref: /schemas/types.yaml#/definitions/uint32
112    enum: [1, 2]
113
114  drive-open-drain:
115    $ref: /schemas/types.yaml#/definitions/flag
116    description: the interrupt/data ready line will be configured
117      as open drain, which is useful if several sensors share the same
118      interrupt line. (This binding is taken from pinctrl.)
119
120  mount-matrix:
121    description: an optional 3x3 mounting rotation matrix.
122
123allOf:
124  - if:
125      properties:
126        compatible:
127          enum:
128            # These have no interrupts
129            - st,lps001wp
130    then:
131      properties:
132        interrupts: false
133        st,drdy-int-pin: false
134        drive-open-drain: false
135
136  - if:
137      properties:
138        compatible:
139          enum:
140            # These have only DRDY
141            - st,lis2mdl
142            - st,lis3l02dq
143            - st,lis3lv02dl-accel
144            - st,lps22hb-press
145            - st,lps22hh
146            - st,lps25h-press
147            - st,lps33hw
148            - st,lps35hw
149            - st,lsm303agr-magn
150            - st,lsm303dlh-magn
151            - st,lsm303dlhc-magn
152            - st,lsm303dlm-magn
153    then:
154      properties:
155        interrupts:
156          maxItems: 1
157        st,drdy-int-pin: false
158
159required:
160  - compatible
161  - reg
162
163additionalProperties: false
164
165examples:
166  - |
167    #include <dt-bindings/interrupt-controller/irq.h>
168    i2c {
169      #address-cells = <1>;
170      #size-cells = <0>;
171
172      accelerometer@1c {
173        compatible = "st,lis331dl-accel";
174        reg = <0x1c>;
175        st,drdy-int-pin = <1>;
176        vdd-supply = <&ldo1>;
177        vddio-supply = <&ldo2>;
178        interrupt-parent = <&gpio>;
179        interrupts = <18 IRQ_TYPE_EDGE_RISING>, <19 IRQ_TYPE_EDGE_RISING>;
180      };
181    };
182    spi {
183      #address-cells = <1>;
184      #size-cells = <0>;
185      num-cs = <1>;
186
187      l3g4200d: gyroscope@0 {
188        compatible = "st,l3g4200d-gyro";
189        st,drdy-int-pin = <2>;
190        reg = <0>;
191        vdd-supply = <&vcc_io>;
192        vddio-supply = <&vcc_io>;
193      };
194    };
195...
196