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