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