1# Copyright (c) 2023 Michal Morsisko
2# SPDX-License-Identifier: Apache-2.0
3
4description: Texas Instruments TMAG5170 high-precision, linear 3D Hall-effect sensor.
5
6compatible: "ti,tmag5170"
7
8include: [sensor-device.yaml, spi-device.yaml]
9
10properties:
11  int-gpios:
12    type: phandle-array
13    description: |
14      This property specifies the connection to ALERT sensor pin.
15      It will be used by the driver to notify the application about
16      data ready event. For this property to take effect, the
17      TMAG5170_TRIGGER must be set in project configuration
18  operating-mode:
19    type: int
20    required: true
21    description: |
22      Operating mode of the device.
23      1 - stand-by mode - in this mode the device waits for application to trigger
24      the measurement.
25      2 - active measure mode - continuous sampling on all enabled channels
26      as fast as possible. Recommended for devices that haven't got
27      strict power requirements and need frequent sampling.
28      3 - active trigger mode - in this mode, similar to stand-by mode, the device
29      wait for application to trigger the measurement, but the time needed to finish
30      the conversion is shorter than in stand-by mode, on the cost of increased power
31      consumption.
32      4 - duty-cycled - after each sample the device goes to sleep and then
33      automatically wakes up to take another sample. The sleep time is determined
34      by `sleep-time` property. Recommended for low-power devices that don't need
35      high frequency sampling.
36    enum:
37      - 1
38      - 2
39      - 3
40      - 4
41  magnetic-channels:
42    type: string
43    default: "XYZ"
44    description: |
45      Enables data acquisition of the magnetic axis channel(s)
46      If axis is enabled more than once, sensor will do pseudo-simultaneous
47      sampling. Refer to datasheet for more information, By default all axes
48      are enabled (XYZ) to allow the user to check if the sensor work as expected.
49      Following options are allowed:
50      None (chip reset value)
51      X
52      Y
53      XY
54      Z
55      ZX
56      YZ
57      XYZ (default)
58      XYX
59      YXY
60      YZY
61      ZYZ
62      ZXZ
63      XZX
64      XYZYX
65      XYZZYX
66    enum:
67      - "None"
68      - "X"
69      - "Y"
70      - "XY"
71      - "Z"
72      - "ZX"
73      - "YZ"
74      - "XYZ"
75      - "XYX"
76      - "YXY"
77      - "YZY"
78      - "ZYZ"
79      - "ZXZ"
80      - "XZX"
81      - "XYZYX"
82      - "XYZZYX"
83  x-range:
84    type: int
85    default: 0
86    description: |
87      The maximum and minimum values that can be measured on X axis.
88      The wider the range, the worse the resolution.
89      0 = ±50mT (TMAG5170A1)/ ±150mT(TMAG5170A2) - (default; chip reset value)
90      1 = ±25mT (TMAG5170A1)/ ±75mT(TMAG5170A2)
91      2 = ±100mT (TMAG5170A1)/ ±300mT(TMAG5170A2)
92    enum:
93      - 0
94      - 1
95      - 2
96  y-range:
97    type: int
98    default: 0
99    description: |
100      The maximum and minimum values that can be measured on Y axis.
101      The wider the range, the worse the resolution.
102      0 = ±50mT (TMAG5170A1)/ ±150mT(TMAG5170A2) - (default; chip reset value)
103      1 = ±25mT (TMAG5170A1)/ ±75mT(TMAG5170A2)
104      2 = ±100mT (TMAG5170A1)/ ±300mT(TMAG5170A2)
105    enum:
106      - 0
107      - 1
108      - 2
109  z-range:
110    type: int
111    default: 0
112    description: |
113      The maximum and minimum values that can be measured on Z axis.
114      The wider the range, the worse the resolution.
115      0 = ±50mT (TMAG5170A1)/ ±150mT(TMAG5170A2) - (default; chip reset value)
116      1 = ±25mT (TMAG5170A1)/ ±75mT(TMAG5170A2)
117      2 = ±100mT (TMAG5170A1)/ ±300mT(TMAG5170A2)
118    enum:
119      - 0
120      - 1
121      - 2
122  oversampling:
123    type: int
124    default: 1
125    description: |
126      Enables additional sampling of the sensor data to reduce the noise
127      effect. If temperature channel is enabled, temperature will be oversampled
128      too, unless `disable-temperature-oversampling` property is present.
129      Following options are allowed:
130      1 (default; chip reset value)
131      2
132      4
133      8
134      16
135      32
136    enum:
137      - 1
138      - 2
139      - 4
140      - 8
141      - 16
142      - 32
143  enable-temperature-channel:
144    type: boolean
145    description: |
146      Enables temperature measurement
147  magnet-type:
148    type: string
149    default: "None"
150    description: |
151      Enables temperature compensation basing on the type of magnet.
152      Following options are allowed:
153      None (default; chip reset value)
154      NdBFe = 0.12%/deg C
155      SmCo = 0.03%/deg C
156      Ceramic = 0.2%/deg C
157    enum:
158      - "None"
159      - "NdBFe"
160      - "SmCo"
161      - "Ceramic"
162  angle-measurement:
163    type: string
164    default: "None"
165    description: |
166      Enable angle calculation using two axis data:
167      None (default; chip reset value)
168      XY
169      YZ
170      XZ
171    enum:
172      - "None"
173      - "XY"
174      - "YZ"
175      - "XZ"
176  disable-temperature-oversampling:
177    type: boolean
178    description: |
179      If true, temperature is always sampled once per conversion set
180      If false, temperature is oversampled according to `oversampling`
181      property.
182  sleep-time:
183    type: int
184    default: 1
185    description: |
186      The time in milliseconds the sensor will be in sleep during conversions.
187      For this property to take effect sensor must be in `duty-cycled` mode.
188      Note that to calculate total time between conversions, the conversion time
189      itself must be taken into account. The conversion time is dependent
190      on the values of `oversampling`, `magnetic-channels`, `temperature-channel-enabled`
191      and `disable-temperature-oversampling` properties.
192      Following value are allowed:
193      1 (default; chip reset value)
194      5
195      10
196      15
197      20
198      30
199      50
200      100
201      500
202      1000
203    enum:
204      - 1
205      - 5
206      - 10
207      - 15
208      - 20
209      - 30
210      - 50
211      - 100
212      - 500
213      - 1000
214