Thomas Gleixner | fda8d26 | 2019-05-28 09:57:06 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Denis Ciocca | d625116 | 2013-01-25 23:44:00 +0000 | [diff] [blame] | 2 | /* |
| 3 | * STMicroelectronics accelerometers driver |
| 4 | * |
| 5 | * Copyright 2012-2013 STMicroelectronics Inc. |
| 6 | * |
| 7 | * Denis Ciocca <denis.ciocca@st.com> |
| 8 | * v. 1.0.0 |
Denis Ciocca | d625116 | 2013-01-25 23:44:00 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #ifndef ST_ACCEL_H |
| 12 | #define ST_ACCEL_H |
| 13 | |
| 14 | #include <linux/types.h> |
| 15 | #include <linux/iio/common/st_sensors.h> |
| 16 | |
Shrirang Bagul | 89a2a93f | 2016-11-24 13:33:44 +0800 | [diff] [blame] | 17 | enum st_accel_type { |
| 18 | LSM303DLH, |
| 19 | LSM303DLHC, |
| 20 | LIS3DH, |
| 21 | LSM330D, |
| 22 | LSM330DL, |
| 23 | LSM330DLC, |
| 24 | LIS331DLH, |
| 25 | LSM303DL, |
| 26 | LSM303DLM, |
| 27 | LSM330, |
| 28 | LSM303AGR, |
| 29 | LIS2DH12, |
| 30 | LIS3L02DQ, |
| 31 | LNG2DM, |
Lorenzo Bianconi | 6011208 | 2017-07-08 13:00:16 +0200 | [diff] [blame] | 32 | H3LIS331DL, |
| 33 | LIS331DL, |
| 34 | LIS3LV02DL, |
Lorenzo Bianconi | f94124f | 2017-08-30 13:50:42 +0200 | [diff] [blame] | 35 | LIS2DW12, |
Lorenzo Bianconi | fea4d48 | 2017-09-17 18:17:11 +0200 | [diff] [blame] | 36 | LIS3DHH, |
Robert Jones | 63440a6 | 2019-04-10 17:12:09 -0700 | [diff] [blame] | 37 | LIS2DE12, |
Shrirang Bagul | 89a2a93f | 2016-11-24 13:33:44 +0800 | [diff] [blame] | 38 | ST_ACCEL_MAX, |
| 39 | }; |
| 40 | |
Lorenzo Bianconi | b30f159 | 2017-07-08 13:00:18 +0200 | [diff] [blame] | 41 | #define H3LIS331DL_ACCEL_DEV_NAME "h3lis331dl_accel" |
Linus Walleij | 3acddf7 | 2015-03-18 10:52:06 +0100 | [diff] [blame] | 42 | #define LIS3LV02DL_ACCEL_DEV_NAME "lis3lv02dl_accel" |
Denis Ciocca | d625116 | 2013-01-25 23:44:00 +0000 | [diff] [blame] | 43 | #define LSM303DLHC_ACCEL_DEV_NAME "lsm303dlhc_accel" |
| 44 | #define LIS3DH_ACCEL_DEV_NAME "lis3dh" |
| 45 | #define LSM330D_ACCEL_DEV_NAME "lsm330d_accel" |
| 46 | #define LSM330DL_ACCEL_DEV_NAME "lsm330dl_accel" |
| 47 | #define LSM330DLC_ACCEL_DEV_NAME "lsm330dlc_accel" |
Linus Walleij | bbf5f03 | 2015-05-19 15:37:18 +0200 | [diff] [blame] | 48 | #define LIS331DL_ACCEL_DEV_NAME "lis331dl_accel" |
Denis Ciocca | d625116 | 2013-01-25 23:44:00 +0000 | [diff] [blame] | 49 | #define LIS331DLH_ACCEL_DEV_NAME "lis331dlh" |
| 50 | #define LSM303DL_ACCEL_DEV_NAME "lsm303dl_accel" |
| 51 | #define LSM303DLH_ACCEL_DEV_NAME "lsm303dlh_accel" |
| 52 | #define LSM303DLM_ACCEL_DEV_NAME "lsm303dlm_accel" |
| 53 | #define LSM330_ACCEL_DEV_NAME "lsm330_accel" |
Giuseppe Barba | ddc05fa | 2015-07-21 10:35:44 +0200 | [diff] [blame] | 54 | #define LSM303AGR_ACCEL_DEV_NAME "lsm303agr_accel" |
Giuseppe Barba | 34dc578 | 2015-11-12 08:36:49 +0100 | [diff] [blame] | 55 | #define LIS2DH12_ACCEL_DEV_NAME "lis2dh12_accel" |
Jonathan Cameron | 4e68cfb | 2016-05-22 20:39:29 +0100 | [diff] [blame] | 56 | #define LIS3L02DQ_ACCEL_DEV_NAME "lis3l02dq" |
Lorenzo Bianconi | dcdb0a7 | 2016-10-25 23:09:03 +0200 | [diff] [blame] | 57 | #define LNG2DM_ACCEL_DEV_NAME "lng2dm" |
Lorenzo Bianconi | f94124f | 2017-08-30 13:50:42 +0200 | [diff] [blame] | 58 | #define LIS2DW12_ACCEL_DEV_NAME "lis2dw12" |
Lorenzo Bianconi | fea4d48 | 2017-09-17 18:17:11 +0200 | [diff] [blame] | 59 | #define LIS3DHH_ACCEL_DEV_NAME "lis3dhh" |
Heiko Stuebner | 49b6237 | 2018-11-07 16:45:21 +0100 | [diff] [blame] | 60 | #define LIS3DE_ACCEL_DEV_NAME "lis3de" |
Robert Jones | 63440a6 | 2019-04-10 17:12:09 -0700 | [diff] [blame] | 61 | #define LIS2DE12_ACCEL_DEV_NAME "lis2de12" |
Denis Ciocca | d625116 | 2013-01-25 23:44:00 +0000 | [diff] [blame] | 62 | |
Denis CIOCCA | 23cde4d | 2013-06-19 09:28:00 +0100 | [diff] [blame] | 63 | /** |
| 64 | * struct st_sensors_platform_data - default accel platform data |
| 65 | * @drdy_int_pin: default accel DRDY is available on INT1 pin. |
| 66 | */ |
Andy Shevchenko | 2e8bd34 | 2019-12-16 19:38:49 +0200 | [diff] [blame] | 67 | static __maybe_unused const struct st_sensors_platform_data default_accel_pdata = { |
Denis CIOCCA | 23cde4d | 2013-06-19 09:28:00 +0100 | [diff] [blame] | 68 | .drdy_int_pin = 1, |
| 69 | }; |
| 70 | |
Denis Ciocca | 823a7ad | 2019-07-18 15:53:44 -0700 | [diff] [blame] | 71 | const struct st_sensor_settings *st_accel_get_settings(const char *name); |
Denis CIOCCA | b6e6bda6 | 2014-10-03 17:35:36 +0200 | [diff] [blame] | 72 | int st_accel_common_probe(struct iio_dev *indio_dev); |
Denis Ciocca | d625116 | 2013-01-25 23:44:00 +0000 | [diff] [blame] | 73 | void st_accel_common_remove(struct iio_dev *indio_dev); |
| 74 | |
| 75 | #ifdef CONFIG_IIO_BUFFER |
| 76 | int st_accel_allocate_ring(struct iio_dev *indio_dev); |
| 77 | void st_accel_deallocate_ring(struct iio_dev *indio_dev); |
| 78 | int st_accel_trig_set_state(struct iio_trigger *trig, bool state); |
| 79 | #define ST_ACCEL_TRIGGER_SET_STATE (&st_accel_trig_set_state) |
| 80 | #else /* CONFIG_IIO_BUFFER */ |
| 81 | static inline int st_accel_allocate_ring(struct iio_dev *indio_dev) |
| 82 | { |
| 83 | return 0; |
| 84 | } |
| 85 | static inline void st_accel_deallocate_ring(struct iio_dev *indio_dev) |
| 86 | { |
| 87 | } |
| 88 | #define ST_ACCEL_TRIGGER_SET_STATE NULL |
| 89 | #endif /* CONFIG_IIO_BUFFER */ |
| 90 | |
| 91 | #endif /* ST_ACCEL_H */ |