2 * STMicroelectronics accelerometers driver
4 * Copyright 2012-2013 STMicroelectronics Inc.
6 * Denis Ciocca <denis.ciocca@st.com>
8 * Licensed under the GPL-2.
11 #include <linux/kernel.h>
12 #include <linux/module.h>
13 #include <linux/slab.h>
14 #include <linux/errno.h>
15 #include <linux/types.h>
16 #include <linux/mutex.h>
17 #include <linux/interrupt.h>
18 #include <linux/i2c.h>
19 #include <linux/gpio.h>
20 #include <linux/irq.h>
21 #include <linux/iio/iio.h>
22 #include <linux/iio/sysfs.h>
23 #include <linux/iio/trigger.h>
24 #include <linux/iio/buffer.h>
26 #include <linux/iio/common/st_sensors.h>
29 #define ST_ACCEL_NUMBER_DATA_CHANNELS 3
31 /* DEFAULT VALUE FOR SENSORS */
32 #define ST_ACCEL_DEFAULT_OUT_X_L_ADDR 0x28
33 #define ST_ACCEL_DEFAULT_OUT_Y_L_ADDR 0x2a
34 #define ST_ACCEL_DEFAULT_OUT_Z_L_ADDR 0x2c
37 #define ST_ACCEL_FS_AVL_2G 2
38 #define ST_ACCEL_FS_AVL_4G 4
39 #define ST_ACCEL_FS_AVL_6G 6
40 #define ST_ACCEL_FS_AVL_8G 8
41 #define ST_ACCEL_FS_AVL_16G 16
42 #define ST_ACCEL_FS_AVL_100G 100
43 #define ST_ACCEL_FS_AVL_200G 200
44 #define ST_ACCEL_FS_AVL_400G 400
46 static const struct iio_chan_spec st_accel_8bit_channels
[] = {
47 ST_SENSORS_LSM_CHANNELS(IIO_ACCEL
,
48 BIT(IIO_CHAN_INFO_RAW
) | BIT(IIO_CHAN_INFO_SCALE
),
49 ST_SENSORS_SCAN_X
, 1, IIO_MOD_X
, 's', IIO_LE
, 8, 8,
50 ST_ACCEL_DEFAULT_OUT_X_L_ADDR
+1),
51 ST_SENSORS_LSM_CHANNELS(IIO_ACCEL
,
52 BIT(IIO_CHAN_INFO_RAW
) | BIT(IIO_CHAN_INFO_SCALE
),
53 ST_SENSORS_SCAN_Y
, 1, IIO_MOD_Y
, 's', IIO_LE
, 8, 8,
54 ST_ACCEL_DEFAULT_OUT_Y_L_ADDR
+1),
55 ST_SENSORS_LSM_CHANNELS(IIO_ACCEL
,
56 BIT(IIO_CHAN_INFO_RAW
) | BIT(IIO_CHAN_INFO_SCALE
),
57 ST_SENSORS_SCAN_Z
, 1, IIO_MOD_Z
, 's', IIO_LE
, 8, 8,
58 ST_ACCEL_DEFAULT_OUT_Z_L_ADDR
+1),
59 IIO_CHAN_SOFT_TIMESTAMP(3)
62 static const struct iio_chan_spec st_accel_12bit_channels
[] = {
63 ST_SENSORS_LSM_CHANNELS(IIO_ACCEL
,
64 BIT(IIO_CHAN_INFO_RAW
) | BIT(IIO_CHAN_INFO_SCALE
),
65 ST_SENSORS_SCAN_X
, 1, IIO_MOD_X
, 's', IIO_LE
, 12, 16,
66 ST_ACCEL_DEFAULT_OUT_X_L_ADDR
),
67 ST_SENSORS_LSM_CHANNELS(IIO_ACCEL
,
68 BIT(IIO_CHAN_INFO_RAW
) | BIT(IIO_CHAN_INFO_SCALE
),
69 ST_SENSORS_SCAN_Y
, 1, IIO_MOD_Y
, 's', IIO_LE
, 12, 16,
70 ST_ACCEL_DEFAULT_OUT_Y_L_ADDR
),
71 ST_SENSORS_LSM_CHANNELS(IIO_ACCEL
,
72 BIT(IIO_CHAN_INFO_RAW
) | BIT(IIO_CHAN_INFO_SCALE
),
73 ST_SENSORS_SCAN_Z
, 1, IIO_MOD_Z
, 's', IIO_LE
, 12, 16,
74 ST_ACCEL_DEFAULT_OUT_Z_L_ADDR
),
75 IIO_CHAN_SOFT_TIMESTAMP(3)
78 static const struct iio_chan_spec st_accel_16bit_channels
[] = {
79 ST_SENSORS_LSM_CHANNELS(IIO_ACCEL
,
80 BIT(IIO_CHAN_INFO_RAW
) | BIT(IIO_CHAN_INFO_SCALE
),
81 ST_SENSORS_SCAN_X
, 1, IIO_MOD_X
, 's', IIO_LE
, 16, 16,
82 ST_ACCEL_DEFAULT_OUT_X_L_ADDR
),
83 ST_SENSORS_LSM_CHANNELS(IIO_ACCEL
,
84 BIT(IIO_CHAN_INFO_RAW
) | BIT(IIO_CHAN_INFO_SCALE
),
85 ST_SENSORS_SCAN_Y
, 1, IIO_MOD_Y
, 's', IIO_LE
, 16, 16,
86 ST_ACCEL_DEFAULT_OUT_Y_L_ADDR
),
87 ST_SENSORS_LSM_CHANNELS(IIO_ACCEL
,
88 BIT(IIO_CHAN_INFO_RAW
) | BIT(IIO_CHAN_INFO_SCALE
),
89 ST_SENSORS_SCAN_Z
, 1, IIO_MOD_Z
, 's', IIO_LE
, 16, 16,
90 ST_ACCEL_DEFAULT_OUT_Z_L_ADDR
),
91 IIO_CHAN_SOFT_TIMESTAMP(3)
94 static const struct st_sensor_settings st_accel_sensors_settings
[] = {
97 .wai_addr
= ST_SENSORS_DEFAULT_WAI_ADDRESS
,
98 .sensors_supported
= {
99 [0] = LIS3DH_ACCEL_DEV_NAME
,
100 [1] = LSM303DLHC_ACCEL_DEV_NAME
,
101 [2] = LSM330D_ACCEL_DEV_NAME
,
102 [3] = LSM330DL_ACCEL_DEV_NAME
,
103 [4] = LSM330DLC_ACCEL_DEV_NAME
,
104 [5] = LSM303AGR_ACCEL_DEV_NAME
,
105 [6] = LIS2DH12_ACCEL_DEV_NAME
,
107 .ch
= (struct iio_chan_spec
*)st_accel_12bit_channels
,
112 { .hz
= 1, .value
= 0x01, },
113 { .hz
= 10, .value
= 0x02, },
114 { .hz
= 25, .value
= 0x03, },
115 { .hz
= 50, .value
= 0x04, },
116 { .hz
= 100, .value
= 0x05, },
117 { .hz
= 200, .value
= 0x06, },
118 { .hz
= 400, .value
= 0x07, },
119 { .hz
= 1600, .value
= 0x08, },
125 .value_off
= ST_SENSORS_DEFAULT_POWER_OFF_VALUE
,
128 .addr
= ST_SENSORS_DEFAULT_AXIS_ADDR
,
129 .mask
= ST_SENSORS_DEFAULT_AXIS_MASK
,
136 .num
= ST_ACCEL_FS_AVL_2G
,
138 .gain
= IIO_G_TO_M_S_2(1000),
141 .num
= ST_ACCEL_FS_AVL_4G
,
143 .gain
= IIO_G_TO_M_S_2(2000),
146 .num
= ST_ACCEL_FS_AVL_8G
,
148 .gain
= IIO_G_TO_M_S_2(4000),
151 .num
= ST_ACCEL_FS_AVL_16G
,
153 .gain
= IIO_G_TO_M_S_2(12000),
169 .addr
= ST_SENSORS_DEFAULT_STAT_ADDR
,
177 .multi_read_bit
= true,
182 .wai_addr
= ST_SENSORS_DEFAULT_WAI_ADDRESS
,
183 .sensors_supported
= {
184 [0] = LIS331DLH_ACCEL_DEV_NAME
,
185 [1] = LSM303DL_ACCEL_DEV_NAME
,
186 [2] = LSM303DLH_ACCEL_DEV_NAME
,
187 [3] = LSM303DLM_ACCEL_DEV_NAME
,
189 .ch
= (struct iio_chan_spec
*)st_accel_12bit_channels
,
194 { .hz
= 50, .value
= 0x00, },
195 { .hz
= 100, .value
= 0x01, },
196 { .hz
= 400, .value
= 0x02, },
197 { .hz
= 1000, .value
= 0x03, },
203 .value_on
= ST_SENSORS_DEFAULT_POWER_ON_VALUE
,
204 .value_off
= ST_SENSORS_DEFAULT_POWER_OFF_VALUE
,
207 .addr
= ST_SENSORS_DEFAULT_AXIS_ADDR
,
208 .mask
= ST_SENSORS_DEFAULT_AXIS_MASK
,
215 .num
= ST_ACCEL_FS_AVL_2G
,
217 .gain
= IIO_G_TO_M_S_2(1000),
220 .num
= ST_ACCEL_FS_AVL_4G
,
222 .gain
= IIO_G_TO_M_S_2(2000),
225 .num
= ST_ACCEL_FS_AVL_8G
,
227 .gain
= IIO_G_TO_M_S_2(3900),
251 .addr
= ST_SENSORS_DEFAULT_STAT_ADDR
,
259 .multi_read_bit
= true,
264 .wai_addr
= ST_SENSORS_DEFAULT_WAI_ADDRESS
,
265 .sensors_supported
= {
266 [0] = LSM330_ACCEL_DEV_NAME
,
268 .ch
= (struct iio_chan_spec
*)st_accel_16bit_channels
,
273 { .hz
= 3, .value
= 0x01, },
274 { .hz
= 6, .value
= 0x02, },
275 { .hz
= 12, .value
= 0x03, },
276 { .hz
= 25, .value
= 0x04, },
277 { .hz
= 50, .value
= 0x05, },
278 { .hz
= 100, .value
= 0x06, },
279 { .hz
= 200, .value
= 0x07, },
280 { .hz
= 400, .value
= 0x08, },
281 { .hz
= 800, .value
= 0x09, },
282 { .hz
= 1600, .value
= 0x0a, },
288 .value_off
= ST_SENSORS_DEFAULT_POWER_OFF_VALUE
,
291 .addr
= ST_SENSORS_DEFAULT_AXIS_ADDR
,
292 .mask
= ST_SENSORS_DEFAULT_AXIS_MASK
,
299 .num
= ST_ACCEL_FS_AVL_2G
,
301 .gain
= IIO_G_TO_M_S_2(61),
304 .num
= ST_ACCEL_FS_AVL_4G
,
306 .gain
= IIO_G_TO_M_S_2(122),
309 .num
= ST_ACCEL_FS_AVL_6G
,
311 .gain
= IIO_G_TO_M_S_2(183),
314 .num
= ST_ACCEL_FS_AVL_8G
,
316 .gain
= IIO_G_TO_M_S_2(244),
319 .num
= ST_ACCEL_FS_AVL_16G
,
321 .gain
= IIO_G_TO_M_S_2(732),
337 .addr
= ST_SENSORS_DEFAULT_STAT_ADDR
,
349 .multi_read_bit
= false,
354 .wai_addr
= ST_SENSORS_DEFAULT_WAI_ADDRESS
,
355 .sensors_supported
= {
356 [0] = LIS3LV02DL_ACCEL_DEV_NAME
,
358 .ch
= (struct iio_chan_spec
*)st_accel_12bit_channels
,
361 .mask
= 0x30, /* DF1 and DF0 */
363 { .hz
= 40, .value
= 0x00, },
364 { .hz
= 160, .value
= 0x01, },
365 { .hz
= 640, .value
= 0x02, },
366 { .hz
= 2560, .value
= 0x03, },
372 .value_on
= ST_SENSORS_DEFAULT_POWER_ON_VALUE
,
373 .value_off
= ST_SENSORS_DEFAULT_POWER_OFF_VALUE
,
376 .addr
= ST_SENSORS_DEFAULT_AXIS_ADDR
,
377 .mask
= ST_SENSORS_DEFAULT_AXIS_MASK
,
384 .num
= ST_ACCEL_FS_AVL_2G
,
386 .gain
= IIO_G_TO_M_S_2(1000),
389 .num
= ST_ACCEL_FS_AVL_6G
,
391 .gain
= IIO_G_TO_M_S_2(3000),
400 * Data Alignment Setting - needs to be set to get
401 * left-justified data like all other sensors.
413 .addr
= ST_SENSORS_DEFAULT_STAT_ADDR
,
421 .multi_read_bit
= true,
422 .bootime
= 2, /* guess */
426 .wai_addr
= ST_SENSORS_DEFAULT_WAI_ADDRESS
,
427 .sensors_supported
= {
428 [0] = LIS331DL_ACCEL_DEV_NAME
,
430 .ch
= (struct iio_chan_spec
*)st_accel_8bit_channels
,
435 { .hz
= 100, .value
= 0x00, },
436 { .hz
= 400, .value
= 0x01, },
442 .value_on
= ST_SENSORS_DEFAULT_POWER_ON_VALUE
,
443 .value_off
= ST_SENSORS_DEFAULT_POWER_OFF_VALUE
,
446 .addr
= ST_SENSORS_DEFAULT_AXIS_ADDR
,
447 .mask
= ST_SENSORS_DEFAULT_AXIS_MASK
,
453 * TODO: check these resulting gain settings, these are
454 * not in the datsheet
458 .num
= ST_ACCEL_FS_AVL_2G
,
460 .gain
= IIO_G_TO_M_S_2(18000),
463 .num
= ST_ACCEL_FS_AVL_8G
,
465 .gain
= IIO_G_TO_M_S_2(72000),
485 .addr
= ST_SENSORS_DEFAULT_STAT_ADDR
,
493 .multi_read_bit
= false,
494 .bootime
= 2, /* guess */
498 .wai_addr
= ST_SENSORS_DEFAULT_WAI_ADDRESS
,
499 .sensors_supported
= {
500 [0] = H3LIS331DL_ACCEL_DEV_NAME
,
502 .ch
= (struct iio_chan_spec
*)st_accel_12bit_channels
,
507 { .hz
= 50, .value
= 0x00, },
508 { .hz
= 100, .value
= 0x01, },
509 { .hz
= 400, .value
= 0x02, },
510 { .hz
= 1000, .value
= 0x03, },
516 .value_on
= ST_SENSORS_DEFAULT_POWER_ON_VALUE
,
517 .value_off
= ST_SENSORS_DEFAULT_POWER_OFF_VALUE
,
520 .addr
= ST_SENSORS_DEFAULT_AXIS_ADDR
,
521 .mask
= ST_SENSORS_DEFAULT_AXIS_MASK
,
528 .num
= ST_ACCEL_FS_AVL_100G
,
530 .gain
= IIO_G_TO_M_S_2(49000),
533 .num
= ST_ACCEL_FS_AVL_200G
,
535 .gain
= IIO_G_TO_M_S_2(98000),
538 .num
= ST_ACCEL_FS_AVL_400G
,
540 .gain
= IIO_G_TO_M_S_2(195000),
564 .multi_read_bit
= true,
568 /* No WAI register present */
569 .sensors_supported
= {
570 [0] = LIS3L02DQ_ACCEL_DEV_NAME
,
572 .ch
= (struct iio_chan_spec
*)st_accel_12bit_channels
,
577 { .hz
= 280, .value
= 0x00, },
578 { .hz
= 560, .value
= 0x01, },
579 { .hz
= 1120, .value
= 0x02, },
580 { .hz
= 4480, .value
= 0x03, },
586 .value_on
= ST_SENSORS_DEFAULT_POWER_ON_VALUE
,
587 .value_off
= ST_SENSORS_DEFAULT_POWER_OFF_VALUE
,
590 .addr
= ST_SENSORS_DEFAULT_AXIS_ADDR
,
591 .mask
= ST_SENSORS_DEFAULT_AXIS_MASK
,
596 .num
= ST_ACCEL_FS_AVL_2G
,
597 .gain
= IIO_G_TO_M_S_2(488),
602 * The part has a BDU bit but if set the data is never
603 * updated so don't set it.
613 .addr
= ST_SENSORS_DEFAULT_STAT_ADDR
,
621 .multi_read_bit
= false,
626 .wai_addr
= ST_SENSORS_DEFAULT_WAI_ADDRESS
,
627 .sensors_supported
= {
628 [0] = LNG2DM_ACCEL_DEV_NAME
,
630 .ch
= (struct iio_chan_spec
*)st_accel_8bit_channels
,
635 { .hz
= 1, .value
= 0x01, },
636 { .hz
= 10, .value
= 0x02, },
637 { .hz
= 25, .value
= 0x03, },
638 { .hz
= 50, .value
= 0x04, },
639 { .hz
= 100, .value
= 0x05, },
640 { .hz
= 200, .value
= 0x06, },
641 { .hz
= 400, .value
= 0x07, },
642 { .hz
= 1600, .value
= 0x08, },
648 .value_off
= ST_SENSORS_DEFAULT_POWER_OFF_VALUE
,
651 .addr
= ST_SENSORS_DEFAULT_AXIS_ADDR
,
652 .mask
= ST_SENSORS_DEFAULT_AXIS_MASK
,
659 .num
= ST_ACCEL_FS_AVL_2G
,
661 .gain
= IIO_G_TO_M_S_2(15600),
664 .num
= ST_ACCEL_FS_AVL_4G
,
666 .gain
= IIO_G_TO_M_S_2(31200),
669 .num
= ST_ACCEL_FS_AVL_8G
,
671 .gain
= IIO_G_TO_M_S_2(62500),
674 .num
= ST_ACCEL_FS_AVL_16G
,
676 .gain
= IIO_G_TO_M_S_2(187500),
688 .addr
= ST_SENSORS_DEFAULT_STAT_ADDR
,
696 .multi_read_bit
= true,
701 .wai_addr
= ST_SENSORS_DEFAULT_WAI_ADDRESS
,
702 .sensors_supported
= {
703 [0] = LIS2DW12_ACCEL_DEV_NAME
,
705 .ch
= (struct iio_chan_spec
*)st_accel_12bit_channels
,
710 { .hz
= 1, .value
= 0x01, },
711 { .hz
= 12, .value
= 0x02, },
712 { .hz
= 25, .value
= 0x03, },
713 { .hz
= 50, .value
= 0x04, },
714 { .hz
= 100, .value
= 0x05, },
715 { .hz
= 200, .value
= 0x06, },
721 .value_off
= ST_SENSORS_DEFAULT_POWER_OFF_VALUE
,
728 .num
= ST_ACCEL_FS_AVL_2G
,
730 .gain
= IIO_G_TO_M_S_2(976),
733 .num
= ST_ACCEL_FS_AVL_4G
,
735 .gain
= IIO_G_TO_M_S_2(1952),
738 .num
= ST_ACCEL_FS_AVL_8G
,
740 .gain
= IIO_G_TO_M_S_2(3904),
743 .num
= ST_ACCEL_FS_AVL_16G
,
745 .gain
= IIO_G_TO_M_S_2(7808),
769 .addr
= ST_SENSORS_DEFAULT_STAT_ADDR
,
777 .multi_read_bit
= false,
782 .wai_addr
= ST_SENSORS_DEFAULT_WAI_ADDRESS
,
783 .sensors_supported
= {
784 [0] = LIS3DHH_ACCEL_DEV_NAME
,
786 .ch
= (struct iio_chan_spec
*)st_accel_16bit_channels
,
788 /* just ODR = 1100Hz available */
790 { .hz
= 1100, .value
= 0x00, },
796 .value_on
= ST_SENSORS_DEFAULT_POWER_ON_VALUE
,
797 .value_off
= ST_SENSORS_DEFAULT_POWER_OFF_VALUE
,
802 .num
= ST_ACCEL_FS_AVL_2G
,
803 .gain
= IIO_G_TO_M_S_2(76),
825 .addr
= ST_SENSORS_DEFAULT_STAT_ADDR
,
829 .multi_read_bit
= false,
834 static int st_accel_read_raw(struct iio_dev
*indio_dev
,
835 struct iio_chan_spec
const *ch
, int *val
,
836 int *val2
, long mask
)
839 struct st_sensor_data
*adata
= iio_priv(indio_dev
);
842 case IIO_CHAN_INFO_RAW
:
843 err
= st_sensors_read_info_raw(indio_dev
, ch
, val
);
848 case IIO_CHAN_INFO_SCALE
:
849 *val
= adata
->current_fullscale
->gain
/ 1000000;
850 *val2
= adata
->current_fullscale
->gain
% 1000000;
851 return IIO_VAL_INT_PLUS_MICRO
;
852 case IIO_CHAN_INFO_SAMP_FREQ
:
863 static int st_accel_write_raw(struct iio_dev
*indio_dev
,
864 struct iio_chan_spec
const *chan
, int val
, int val2
, long mask
)
869 case IIO_CHAN_INFO_SCALE
: {
872 gain
= val
* 1000000 + val2
;
873 err
= st_sensors_set_fullscale_by_gain(indio_dev
, gain
);
876 case IIO_CHAN_INFO_SAMP_FREQ
:
879 mutex_lock(&indio_dev
->mlock
);
880 err
= st_sensors_set_odr(indio_dev
, val
);
881 mutex_unlock(&indio_dev
->mlock
);
890 static ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL();
891 static ST_SENSORS_DEV_ATTR_SCALE_AVAIL(in_accel_scale_available
);
893 static struct attribute
*st_accel_attributes
[] = {
894 &iio_dev_attr_sampling_frequency_available
.dev_attr
.attr
,
895 &iio_dev_attr_in_accel_scale_available
.dev_attr
.attr
,
899 static const struct attribute_group st_accel_attribute_group
= {
900 .attrs
= st_accel_attributes
,
903 static const struct iio_info accel_info
= {
904 .attrs
= &st_accel_attribute_group
,
905 .read_raw
= &st_accel_read_raw
,
906 .write_raw
= &st_accel_write_raw
,
907 .debugfs_reg_access
= &st_sensors_debugfs_reg_access
,
910 #ifdef CONFIG_IIO_TRIGGER
911 static const struct iio_trigger_ops st_accel_trigger_ops
= {
912 .set_trigger_state
= ST_ACCEL_TRIGGER_SET_STATE
,
913 .validate_device
= st_sensors_validate_device
,
915 #define ST_ACCEL_TRIGGER_OPS (&st_accel_trigger_ops)
917 #define ST_ACCEL_TRIGGER_OPS NULL
920 int st_accel_common_probe(struct iio_dev
*indio_dev
)
922 struct st_sensor_data
*adata
= iio_priv(indio_dev
);
923 struct st_sensors_platform_data
*pdata
=
924 (struct st_sensors_platform_data
*)adata
->dev
->platform_data
;
925 int irq
= adata
->get_irq_data_ready(indio_dev
);
928 indio_dev
->modes
= INDIO_DIRECT_MODE
;
929 indio_dev
->info
= &accel_info
;
930 mutex_init(&adata
->tb
.buf_lock
);
932 err
= st_sensors_power_enable(indio_dev
);
936 err
= st_sensors_check_device_support(indio_dev
,
937 ARRAY_SIZE(st_accel_sensors_settings
),
938 st_accel_sensors_settings
);
940 goto st_accel_power_off
;
942 adata
->num_data_channels
= ST_ACCEL_NUMBER_DATA_CHANNELS
;
943 adata
->multiread_bit
= adata
->sensor_settings
->multi_read_bit
;
944 indio_dev
->channels
= adata
->sensor_settings
->ch
;
945 indio_dev
->num_channels
= ST_SENSORS_NUMBER_ALL_CHANNELS
;
947 adata
->current_fullscale
= (struct st_sensor_fullscale_avl
*)
948 &adata
->sensor_settings
->fs
.fs_avl
[0];
949 adata
->odr
= adata
->sensor_settings
->odr
.odr_avl
[0].hz
;
952 pdata
= (struct st_sensors_platform_data
*)&default_accel_pdata
;
954 err
= st_sensors_init_sensor(indio_dev
, pdata
);
956 goto st_accel_power_off
;
958 err
= st_accel_allocate_ring(indio_dev
);
960 goto st_accel_power_off
;
963 err
= st_sensors_allocate_trigger(indio_dev
,
964 ST_ACCEL_TRIGGER_OPS
);
966 goto st_accel_probe_trigger_error
;
969 err
= iio_device_register(indio_dev
);
971 goto st_accel_device_register_error
;
973 dev_info(&indio_dev
->dev
, "registered accelerometer %s\n",
978 st_accel_device_register_error
:
980 st_sensors_deallocate_trigger(indio_dev
);
981 st_accel_probe_trigger_error
:
982 st_accel_deallocate_ring(indio_dev
);
984 st_sensors_power_disable(indio_dev
);
988 EXPORT_SYMBOL(st_accel_common_probe
);
990 void st_accel_common_remove(struct iio_dev
*indio_dev
)
992 struct st_sensor_data
*adata
= iio_priv(indio_dev
);
994 st_sensors_power_disable(indio_dev
);
996 iio_device_unregister(indio_dev
);
997 if (adata
->get_irq_data_ready(indio_dev
) > 0)
998 st_sensors_deallocate_trigger(indio_dev
);
1000 st_accel_deallocate_ring(indio_dev
);
1002 EXPORT_SYMBOL(st_accel_common_remove
);
1004 MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
1005 MODULE_DESCRIPTION("STMicroelectronics accelerometers driver");
1006 MODULE_LICENSE("GPL v2");