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,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
119allOf:
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
155required:
156  - compatible
157  - reg
158
159additionalProperties: false
160
161examples:
162  - |
163    #include <dt-bindings/interrupt-controller/irq.h>
164    i2c {
165      #address-cells = <1>;
166      #size-cells = <0>;
167
168      accelerometer@1c {
169        compatible = "st,lis331dl-accel";
170        reg = <0x1c>;
171        st,drdy-int-pin = <1>;
172        vdd-supply = <&ldo1>;
173        vddio-supply = <&ldo2>;
174        interrupt-parent = <&gpio>;
175        interrupts = <18 IRQ_TYPE_EDGE_RISING>, <19 IRQ_TYPE_EDGE_RISING>;
176      };
177    };
178    spi {
179      #address-cells = <1>;
180      #size-cells = <0>;
181      num-cs = <1>;
182
183      l3g4200d: gyroscope@0 {
184        compatible = "st,l3g4200d-gyro";
185        st,drdy-int-pin = <2>;
186        reg = <0>;
187        vdd-supply = <&vcc_io>;
188        vddio-supply = <&vcc_io>;
189      };
190    };
191...
192