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