1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * STMicroelectronics st_lsm6dsx sensor driver
4 *
5 * Copyright 2016 STMicroelectronics Inc.
6 *
7 * Lorenzo Bianconi <lorenzo.bianconi@st.com>
8 * Denis Ciocca <denis.ciocca@st.com>
9 */
10
11 #ifndef ST_LSM6DSX_H
12 #define ST_LSM6DSX_H
13
14 #include <linux/device.h>
15 #include <linux/iio/iio.h>
16 #include <linux/regulator/consumer.h>
17
18 #define ST_LSM6DS3_DEV_NAME "lsm6ds3"
19 #define ST_LSM6DS3H_DEV_NAME "lsm6ds3h"
20 #define ST_LSM6DSL_DEV_NAME "lsm6dsl"
21 #define ST_LSM6DSM_DEV_NAME "lsm6dsm"
22 #define ST_ISM330DLC_DEV_NAME "ism330dlc"
23 #define ST_LSM6DSO_DEV_NAME "lsm6dso"
24 #define ST_ASM330LHH_DEV_NAME "asm330lhh"
25 #define ST_LSM6DSOX_DEV_NAME "lsm6dsox"
26 #define ST_LSM6DSR_DEV_NAME "lsm6dsr"
27 #define ST_LSM6DS3TRC_DEV_NAME "lsm6ds3tr-c"
28 #define ST_ISM330DHCX_DEV_NAME "ism330dhcx"
29 #define ST_LSM9DS1_DEV_NAME "lsm9ds1-imu"
30 #define ST_LSM6DS0_DEV_NAME "lsm6ds0"
31 #define ST_LSM6DSRX_DEV_NAME "lsm6dsrx"
32 #define ST_LSM6DST_DEV_NAME "lsm6dst"
33 #define ST_LSM6DSOP_DEV_NAME "lsm6dsop"
34 #define ST_ASM330LHHX_DEV_NAME "asm330lhhx"
35 #define ST_LSM6DSTX_DEV_NAME "lsm6dstx"
36 #define ST_LSM6DSV_DEV_NAME "lsm6dsv"
37 #define ST_LSM6DSV16X_DEV_NAME "lsm6dsv16x"
38 #define ST_LSM6DSO16IS_DEV_NAME "lsm6dso16is"
39 #define ST_ISM330IS_DEV_NAME "ism330is"
40 #define ST_ASM330LHB_DEV_NAME "asm330lhb"
41 #define ST_ASM330LHHXG1_DEV_NAME "asm330lhhxg1"
42
43 enum st_lsm6dsx_hw_id {
44 ST_LSM6DS3_ID = 1,
45 ST_LSM6DS3H_ID,
46 ST_LSM6DSL_ID,
47 ST_LSM6DSM_ID,
48 ST_ISM330DLC_ID,
49 ST_LSM6DSO_ID,
50 ST_ASM330LHH_ID,
51 ST_LSM6DSOX_ID,
52 ST_LSM6DSR_ID,
53 ST_LSM6DS3TRC_ID,
54 ST_ISM330DHCX_ID,
55 ST_LSM9DS1_ID,
56 ST_LSM6DS0_ID,
57 ST_LSM6DSRX_ID,
58 ST_LSM6DST_ID,
59 ST_LSM6DSOP_ID,
60 ST_ASM330LHHX_ID,
61 ST_LSM6DSTX_ID,
62 ST_LSM6DSV_ID,
63 ST_LSM6DSV16X_ID,
64 ST_LSM6DSO16IS_ID,
65 ST_ISM330IS_ID,
66 ST_ASM330LHB_ID,
67 ST_ASM330LHHXG1_ID,
68 ST_LSM6DSX_MAX_ID,
69 };
70
71 #define ST_LSM6DSX_BUFF_SIZE 512
72 #define ST_LSM6DSX_CHAN_SIZE 2
73 #define ST_LSM6DSX_SAMPLE_SIZE 6
74 #define ST_LSM6DSX_TAG_SIZE 1
75 #define ST_LSM6DSX_TAGGED_SAMPLE_SIZE (ST_LSM6DSX_SAMPLE_SIZE + \
76 ST_LSM6DSX_TAG_SIZE)
77 #define ST_LSM6DSX_MAX_WORD_LEN ((32 / ST_LSM6DSX_SAMPLE_SIZE) * \
78 ST_LSM6DSX_SAMPLE_SIZE)
79 #define ST_LSM6DSX_MAX_TAGGED_WORD_LEN ((32 / ST_LSM6DSX_TAGGED_SAMPLE_SIZE) \
80 * ST_LSM6DSX_TAGGED_SAMPLE_SIZE)
81 #define ST_LSM6DSX_SHIFT_VAL(val, mask) (((val) << __ffs(mask)) & (mask))
82
83 #define ST_LSM6DSX_CHANNEL_ACC(chan_type, addr, mod, scan_idx) \
84 { \
85 .type = chan_type, \
86 .address = addr, \
87 .modified = 1, \
88 .channel2 = mod, \
89 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
90 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
91 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \
92 .scan_index = scan_idx, \
93 .scan_type = { \
94 .sign = 's', \
95 .realbits = 16, \
96 .storagebits = 16, \
97 .endianness = IIO_LE, \
98 }, \
99 .event_spec = &st_lsm6dsx_event, \
100 .ext_info = st_lsm6dsx_ext_info, \
101 .num_event_specs = 1, \
102 }
103
104 #define ST_LSM6DSX_CHANNEL(chan_type, addr, mod, scan_idx) \
105 { \
106 .type = chan_type, \
107 .address = addr, \
108 .modified = 1, \
109 .channel2 = mod, \
110 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
111 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
112 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \
113 .scan_index = scan_idx, \
114 .scan_type = { \
115 .sign = 's', \
116 .realbits = 16, \
117 .storagebits = 16, \
118 .endianness = IIO_LE, \
119 }, \
120 .ext_info = st_lsm6dsx_ext_info, \
121 }
122
123 struct st_lsm6dsx_reg {
124 u8 addr;
125 u8 mask;
126 };
127
128 struct st_lsm6dsx_sensor;
129 struct st_lsm6dsx_hw;
130
131 struct st_lsm6dsx_odr {
132 u32 milli_hz;
133 u8 val;
134 };
135
136 #define ST_LSM6DSX_ODR_LIST_SIZE 8
137 struct st_lsm6dsx_odr_table_entry {
138 struct st_lsm6dsx_reg reg;
139
140 struct st_lsm6dsx_odr odr_avl[ST_LSM6DSX_ODR_LIST_SIZE];
141 int odr_len;
142 };
143
144 struct st_lsm6dsx_samples_to_discard {
145 struct {
146 u32 milli_hz;
147 u16 samples;
148 } val[ST_LSM6DSX_ODR_LIST_SIZE];
149 };
150
151 struct st_lsm6dsx_fs {
152 u32 gain;
153 u8 val;
154 };
155
156 #define ST_LSM6DSX_FS_LIST_SIZE 4
157 struct st_lsm6dsx_fs_table_entry {
158 struct st_lsm6dsx_reg reg;
159
160 struct st_lsm6dsx_fs fs_avl[ST_LSM6DSX_FS_LIST_SIZE];
161 int fs_len;
162 };
163
164 /**
165 * struct st_lsm6dsx_fifo_ops - ST IMU FIFO settings
166 * @update_fifo: Update FIFO configuration callback.
167 * @read_fifo: Read FIFO callback.
168 * @fifo_th: FIFO threshold register info (addr + mask).
169 * @fifo_diff: FIFO diff status register info (addr + mask).
170 * @max_size: Sensor max fifo length in FIFO words.
171 * @th_wl: FIFO threshold word length.
172 */
173 struct st_lsm6dsx_fifo_ops {
174 int (*update_fifo)(struct st_lsm6dsx_sensor *sensor, bool enable);
175 int (*read_fifo)(struct st_lsm6dsx_hw *hw);
176 struct {
177 u8 addr;
178 u16 mask;
179 } fifo_th;
180 struct {
181 u8 addr;
182 u16 mask;
183 } fifo_diff;
184 u16 max_size;
185 u8 th_wl;
186 };
187
188 /**
189 * struct st_lsm6dsx_hw_ts_settings - ST IMU hw timer settings
190 * @timer_en: Hw timer enable register info (addr + mask).
191 * @hr_timer: Hw timer resolution register info (addr + mask).
192 * @fifo_en: Hw timer FIFO enable register info (addr + mask).
193 * @decimator: Hw timer FIFO decimator register info (addr + mask).
194 * @freq_fine: Difference in % of ODR with respect to the typical.
195 * @ts_sensitivity: Nominal timestamp sensitivity.
196 * @ts_trim_coeff: Coefficient for calculating the calibrated timestamp gain.
197 * This coefficient comes into play when linearizing the formula
198 * used to calculate the calibrated timestamp (please see the
199 * relevant formula in the AN for the specific IMU).
200 * For example, in the case of LSM6DSO we have:
201 *
202 * 1 / (1 + x) ~= 1 - x (Taylor’s Series)
203 * ttrim[s] = 1 / (40000 * (1 + 0.0015 * val)) (from AN5192)
204 * ttrim[ns] ~= 25000 - 37.5 * val
205 * ttrim[ns] ~= 25000 - (37500 * val) / 1000
206 *
207 * so, replacing ts_sensitivity = 25000 and
208 * ts_trim_coeff = 37500
209 *
210 * ttrim[ns] ~= ts_sensitivity - (ts_trim_coeff * val) / 1000
211 */
212 struct st_lsm6dsx_hw_ts_settings {
213 struct st_lsm6dsx_reg timer_en;
214 struct st_lsm6dsx_reg hr_timer;
215 struct st_lsm6dsx_reg fifo_en;
216 struct st_lsm6dsx_reg decimator;
217 u8 freq_fine;
218 u16 ts_sensitivity;
219 u16 ts_trim_coeff;
220 };
221
222 /**
223 * struct st_lsm6dsx_shub_settings - ST IMU hw i2c controller settings
224 * @page_mux: register page mux info (addr + mask).
225 * @master_en: master config register info (addr + mask).
226 * @pullup_en: i2c controller pull-up register info (addr + mask).
227 * @aux_sens: aux sensor register info (addr + mask).
228 * @wr_once: write_once register info (addr + mask).
229 * @emb_func: embedded function register info (addr + mask).
230 * @num_ext_dev: max number of slave devices.
231 * @shub_out: sensor hub first output register info.
232 * @slv0_addr: slave0 address in secondary page.
233 * @dw_slv0_addr: slave0 write register address in secondary page.
234 * @batch_en: Enable/disable FIFO batching.
235 * @pause: controller pause value.
236 */
237 struct st_lsm6dsx_shub_settings {
238 struct st_lsm6dsx_reg page_mux;
239 struct {
240 bool sec_page;
241 u8 addr;
242 u8 mask;
243 } master_en;
244 struct {
245 bool sec_page;
246 u8 addr;
247 u8 mask;
248 } pullup_en;
249 struct st_lsm6dsx_reg aux_sens;
250 struct st_lsm6dsx_reg wr_once;
251 struct st_lsm6dsx_reg emb_func;
252 u8 num_ext_dev;
253 struct {
254 bool sec_page;
255 u8 addr;
256 } shub_out;
257 u8 slv0_addr;
258 u8 dw_slv0_addr;
259 u8 batch_en;
260 u8 pause;
261 };
262
263 struct st_lsm6dsx_event_settings {
264 struct st_lsm6dsx_reg enable_reg;
265 struct st_lsm6dsx_reg wakeup_reg;
266 u8 wakeup_src_reg;
267 u8 wakeup_src_status_mask;
268 u8 wakeup_src_z_mask;
269 u8 wakeup_src_y_mask;
270 u8 wakeup_src_x_mask;
271 };
272
273 enum st_lsm6dsx_sensor_id {
274 ST_LSM6DSX_ID_GYRO,
275 ST_LSM6DSX_ID_ACC,
276 ST_LSM6DSX_ID_EXT0,
277 ST_LSM6DSX_ID_EXT1,
278 ST_LSM6DSX_ID_EXT2,
279 ST_LSM6DSX_ID_MAX
280 };
281
282 enum st_lsm6dsx_ext_sensor_id {
283 ST_LSM6DSX_ID_MAGN,
284 };
285
286 /**
287 * struct st_lsm6dsx_ext_dev_settings - i2c controller slave settings
288 * @i2c_addr: I2c slave address list.
289 * @wai: Wai address info.
290 * @id: external sensor id.
291 * @odr_table: Output data rate of the sensor [Hz].
292 * @fs_table: Configured sensor sensitivity table depending on full scale.
293 * @temp_comp: Temperature compensation register info (addr + mask).
294 * @pwr_table: Power on register info (addr + mask).
295 * @off_canc: Offset cancellation register info (addr + mask).
296 * @bdu: Block data update register info (addr + mask).
297 * @out: Output register info.
298 */
299 struct st_lsm6dsx_ext_dev_settings {
300 u8 i2c_addr[2];
301 struct {
302 u8 addr;
303 u8 val;
304 } wai;
305 enum st_lsm6dsx_ext_sensor_id id;
306 struct st_lsm6dsx_odr_table_entry odr_table;
307 struct st_lsm6dsx_fs_table_entry fs_table;
308 struct st_lsm6dsx_reg temp_comp;
309 struct {
310 struct st_lsm6dsx_reg reg;
311 u8 off_val;
312 u8 on_val;
313 } pwr_table;
314 struct st_lsm6dsx_reg off_canc;
315 struct st_lsm6dsx_reg bdu;
316 struct {
317 u8 addr;
318 u8 len;
319 } out;
320 };
321
322 /**
323 * struct st_lsm6dsx_settings - ST IMU sensor settings
324 * @reset: register address for reset.
325 * @boot: register address for boot.
326 * @bdu: register address for Block Data Update.
327 * @id: List of hw id/device name supported by the driver configuration.
328 * @channels: IIO channels supported by the device.
329 * @irq_config: interrupts related registers.
330 * @drdy_mask: register info for data-ready mask (addr + mask).
331 * @odr_table: Hw sensors odr table (Hz + val).
332 * @samples_to_discard: Number of samples to discard for filters settling time.
333 * @fs_table: Hw sensors gain table (gain + val).
334 * @decimator: List of decimator register info (addr + mask).
335 * @batch: List of FIFO batching register info (addr + mask).
336 * @fifo_ops: Sensor hw FIFO parameters.
337 * @ts_settings: Hw timer related settings.
338 * @shub_settings: i2c controller related settings.
339 */
340 struct st_lsm6dsx_settings {
341 struct st_lsm6dsx_reg reset;
342 struct st_lsm6dsx_reg boot;
343 struct st_lsm6dsx_reg bdu;
344 struct {
345 enum st_lsm6dsx_hw_id hw_id;
346 const char *name;
347 u8 wai;
348 } id[ST_LSM6DSX_MAX_ID];
349 struct {
350 const struct iio_chan_spec *chan;
351 int len;
352 } channels[2];
353 struct {
354 struct st_lsm6dsx_reg irq1;
355 struct st_lsm6dsx_reg irq2;
356 struct st_lsm6dsx_reg irq1_func;
357 struct st_lsm6dsx_reg irq2_func;
358 struct st_lsm6dsx_reg lir;
359 struct st_lsm6dsx_reg clear_on_read;
360 struct st_lsm6dsx_reg hla;
361 struct st_lsm6dsx_reg od;
362 } irq_config;
363 struct st_lsm6dsx_reg drdy_mask;
364 struct st_lsm6dsx_odr_table_entry odr_table[2];
365 struct st_lsm6dsx_samples_to_discard samples_to_discard[2];
366 struct st_lsm6dsx_fs_table_entry fs_table[2];
367 struct st_lsm6dsx_reg decimator[ST_LSM6DSX_ID_MAX];
368 struct st_lsm6dsx_reg batch[2];
369 struct st_lsm6dsx_fifo_ops fifo_ops;
370 struct st_lsm6dsx_hw_ts_settings ts_settings;
371 struct st_lsm6dsx_shub_settings shub_settings;
372 struct st_lsm6dsx_event_settings event_settings;
373 };
374
375 enum st_lsm6dsx_fifo_mode {
376 ST_LSM6DSX_FIFO_BYPASS = 0x0,
377 ST_LSM6DSX_FIFO_CONT = 0x6,
378 };
379
380 /**
381 * struct st_lsm6dsx_sensor - ST IMU sensor instance
382 * @name: Sensor name.
383 * @id: Sensor identifier.
384 * @hw: Pointer to instance of struct st_lsm6dsx_hw.
385 * @gain: Configured sensor sensitivity.
386 * @odr: Output data rate of the sensor [Hz].
387 * @samples_to_discard: Number of samples to discard for filters settling time.
388 * @watermark: Sensor watermark level.
389 * @decimator: Sensor decimation factor.
390 * @sip: Number of samples in a given pattern.
391 * @ts_ref: Sensor timestamp reference for hw one.
392 * @ext_info: Sensor settings if it is connected to i2c controller
393 */
394 struct st_lsm6dsx_sensor {
395 char name[32];
396 enum st_lsm6dsx_sensor_id id;
397 struct st_lsm6dsx_hw *hw;
398
399 u32 gain;
400 u32 odr;
401
402 u16 samples_to_discard;
403 u16 watermark;
404 u8 decimator;
405 u8 sip;
406 s64 ts_ref;
407
408 struct {
409 const struct st_lsm6dsx_ext_dev_settings *settings;
410 u32 slv_odr;
411 u8 addr;
412 } ext_info;
413 };
414
415 /**
416 * struct st_lsm6dsx_hw - ST IMU MEMS hw instance
417 * @dev: Pointer to instance of struct device (I2C or SPI).
418 * @regmap: Register map of the device.
419 * @irq: Device interrupt line (I2C or SPI).
420 * @fifo_lock: Mutex to prevent concurrent access to the hw FIFO.
421 * @conf_lock: Mutex to prevent concurrent FIFO configuration update.
422 * @page_lock: Mutex to prevent concurrent memory page configuration.
423 * @suspend_mask: Suspended sensor bitmask.
424 * @enable_mask: Enabled sensor bitmask.
425 * @fifo_mask: Enabled hw FIFO bitmask.
426 * @ts_gain: Hw timestamp rate after internal calibration.
427 * @ts_sip: Total number of timestamp samples in a given pattern.
428 * @sip: Total number of samples (acc/gyro/ts) in a given pattern.
429 * @buff: Device read buffer.
430 * @irq_routing: pointer to interrupt routing configuration.
431 * @event_threshold: wakeup event threshold.
432 * @enable_event: enabled event bitmask.
433 * @iio_devs: Pointers to acc/gyro iio_dev instances.
434 * @settings: Pointer to the specific sensor settings in use.
435 * @orientation: sensor chip orientation relative to main hardware.
436 * @scan: Temporary buffers used to align data before iio_push_to_buffers()
437 */
438 struct st_lsm6dsx_hw {
439 struct device *dev;
440 struct regmap *regmap;
441 int irq;
442
443 struct mutex fifo_lock;
444 struct mutex conf_lock;
445 struct mutex page_lock;
446
447 u8 suspend_mask;
448 u8 enable_mask;
449 u8 fifo_mask;
450 s64 ts_gain;
451 u8 ts_sip;
452 u8 sip;
453
454 const struct st_lsm6dsx_reg *irq_routing;
455 u8 event_threshold;
456 u8 enable_event;
457
458 u8 *buff;
459
460 struct iio_dev *iio_devs[ST_LSM6DSX_ID_MAX];
461
462 const struct st_lsm6dsx_settings *settings;
463
464 struct iio_mount_matrix orientation;
465 /* Ensure natural alignment of buffer elements */
466 struct {
467 __le16 channels[3];
468 aligned_s64 ts;
469 } scan[ST_LSM6DSX_ID_MAX];
470 };
471
472 static __maybe_unused const struct iio_event_spec st_lsm6dsx_event = {
473 .type = IIO_EV_TYPE_THRESH,
474 .dir = IIO_EV_DIR_EITHER,
475 .mask_separate = BIT(IIO_EV_INFO_VALUE) |
476 BIT(IIO_EV_INFO_ENABLE)
477 };
478
479 static __maybe_unused const unsigned long st_lsm6dsx_available_scan_masks[] = {
480 0x7, 0x0,
481 };
482
483 extern const struct dev_pm_ops st_lsm6dsx_pm_ops;
484
485 int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
486 struct regmap *regmap);
487 int st_lsm6dsx_sensor_set_enable(struct st_lsm6dsx_sensor *sensor,
488 bool enable);
489 int st_lsm6dsx_fifo_setup(struct st_lsm6dsx_hw *hw);
490 int st_lsm6dsx_set_watermark(struct iio_dev *iio_dev, unsigned int val);
491 int st_lsm6dsx_update_watermark(struct st_lsm6dsx_sensor *sensor,
492 u16 watermark);
493 int st_lsm6dsx_update_fifo(struct st_lsm6dsx_sensor *sensor, bool enable);
494 int st_lsm6dsx_flush_fifo(struct st_lsm6dsx_hw *hw);
495 int st_lsm6dsx_resume_fifo(struct st_lsm6dsx_hw *hw);
496 int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw);
497 int st_lsm6dsx_read_tagged_fifo(struct st_lsm6dsx_hw *hw);
498 int st_lsm6dsx_check_odr(struct st_lsm6dsx_sensor *sensor, u32 odr, u8 *val);
499 int st_lsm6dsx_shub_probe(struct st_lsm6dsx_hw *hw, const char *name);
500 int st_lsm6dsx_shub_set_enable(struct st_lsm6dsx_sensor *sensor, bool enable);
501 int st_lsm6dsx_shub_read_output(struct st_lsm6dsx_hw *hw, u8 *data, int len);
502 int st_lsm6dsx_set_page(struct st_lsm6dsx_hw *hw, bool enable);
503
504 static inline int
st_lsm6dsx_update_bits_locked(struct st_lsm6dsx_hw * hw,unsigned int addr,unsigned int mask,unsigned int val)505 st_lsm6dsx_update_bits_locked(struct st_lsm6dsx_hw *hw, unsigned int addr,
506 unsigned int mask, unsigned int val)
507 {
508 int err;
509
510 mutex_lock(&hw->page_lock);
511 err = regmap_update_bits(hw->regmap, addr, mask, val);
512 mutex_unlock(&hw->page_lock);
513
514 return err;
515 }
516
517 static inline int
st_lsm6dsx_read_locked(struct st_lsm6dsx_hw * hw,unsigned int addr,void * val,unsigned int len)518 st_lsm6dsx_read_locked(struct st_lsm6dsx_hw *hw, unsigned int addr,
519 void *val, unsigned int len)
520 {
521 int err;
522
523 mutex_lock(&hw->page_lock);
524 err = regmap_bulk_read(hw->regmap, addr, val, len);
525 mutex_unlock(&hw->page_lock);
526
527 return err;
528 }
529
530 static inline int
st_lsm6dsx_write_locked(struct st_lsm6dsx_hw * hw,unsigned int addr,unsigned int val)531 st_lsm6dsx_write_locked(struct st_lsm6dsx_hw *hw, unsigned int addr,
532 unsigned int val)
533 {
534 int err;
535
536 mutex_lock(&hw->page_lock);
537 err = regmap_write(hw->regmap, addr, val);
538 mutex_unlock(&hw->page_lock);
539
540 return err;
541 }
542
543 static inline const struct iio_mount_matrix *
st_lsm6dsx_get_mount_matrix(const struct iio_dev * iio_dev,const struct iio_chan_spec * chan)544 st_lsm6dsx_get_mount_matrix(const struct iio_dev *iio_dev,
545 const struct iio_chan_spec *chan)
546 {
547 struct st_lsm6dsx_sensor *sensor = iio_priv(iio_dev);
548 struct st_lsm6dsx_hw *hw = sensor->hw;
549
550 return &hw->orientation;
551 }
552
553 static inline int
st_lsm6dsx_device_set_enable(struct st_lsm6dsx_sensor * sensor,bool enable)554 st_lsm6dsx_device_set_enable(struct st_lsm6dsx_sensor *sensor, bool enable)
555 {
556 if (sensor->id == ST_LSM6DSX_ID_EXT0 ||
557 sensor->id == ST_LSM6DSX_ID_EXT1 ||
558 sensor->id == ST_LSM6DSX_ID_EXT2)
559 return st_lsm6dsx_shub_set_enable(sensor, enable);
560
561 return st_lsm6dsx_sensor_set_enable(sensor, enable);
562 }
563
564 static const
565 struct iio_chan_spec_ext_info __maybe_unused st_lsm6dsx_ext_info[] = {
566 IIO_MOUNT_MATRIX(IIO_SHARED_BY_ALL, st_lsm6dsx_get_mount_matrix),
567 { }
568 };
569
570 #endif /* ST_LSM6DSX_H */
571