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