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