blob: 2f931e4837e5ea2e3f28a55e2937fc42731bc19d [file] [log] [blame]
Denis Cioccad6251162013-01-25 23:44:00 +00001/*
2 * STMicroelectronics accelerometers driver
3 *
4 * Copyright 2012-2013 STMicroelectronics Inc.
5 *
6 * Denis Ciocca <denis.ciocca@st.com>
7 * v. 1.0.0
8 * Licensed under the GPL-2.
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 Bagul89a2a93f2016-11-24 13:33:44 +080017enum 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 Bianconi60112082017-07-08 13:00:16 +020032 H3LIS331DL,
33 LIS331DL,
34 LIS3LV02DL,
Lorenzo Bianconif94124f2017-08-30 13:50:42 +020035 LIS2DW12,
Lorenzo Bianconifea4d482017-09-17 18:17:11 +020036 LIS3DHH,
Shrirang Bagul89a2a93f2016-11-24 13:33:44 +080037 ST_ACCEL_MAX,
38};
39
Lorenzo Bianconib30f1592017-07-08 13:00:18 +020040#define H3LIS331DL_ACCEL_DEV_NAME "h3lis331dl_accel"
Linus Walleij3acddf72015-03-18 10:52:06 +010041#define LIS3LV02DL_ACCEL_DEV_NAME "lis3lv02dl_accel"
Denis Cioccad6251162013-01-25 23:44:00 +000042#define LSM303DLHC_ACCEL_DEV_NAME "lsm303dlhc_accel"
43#define LIS3DH_ACCEL_DEV_NAME "lis3dh"
44#define LSM330D_ACCEL_DEV_NAME "lsm330d_accel"
45#define LSM330DL_ACCEL_DEV_NAME "lsm330dl_accel"
46#define LSM330DLC_ACCEL_DEV_NAME "lsm330dlc_accel"
Linus Walleijbbf5f032015-05-19 15:37:18 +020047#define LIS331DL_ACCEL_DEV_NAME "lis331dl_accel"
Denis Cioccad6251162013-01-25 23:44:00 +000048#define LIS331DLH_ACCEL_DEV_NAME "lis331dlh"
49#define LSM303DL_ACCEL_DEV_NAME "lsm303dl_accel"
50#define LSM303DLH_ACCEL_DEV_NAME "lsm303dlh_accel"
51#define LSM303DLM_ACCEL_DEV_NAME "lsm303dlm_accel"
52#define LSM330_ACCEL_DEV_NAME "lsm330_accel"
Giuseppe Barbaddc05fa2015-07-21 10:35:44 +020053#define LSM303AGR_ACCEL_DEV_NAME "lsm303agr_accel"
Giuseppe Barba34dc5782015-11-12 08:36:49 +010054#define LIS2DH12_ACCEL_DEV_NAME "lis2dh12_accel"
Jonathan Cameron4e68cfb2016-05-22 20:39:29 +010055#define LIS3L02DQ_ACCEL_DEV_NAME "lis3l02dq"
Lorenzo Bianconidcdb0a72016-10-25 23:09:03 +020056#define LNG2DM_ACCEL_DEV_NAME "lng2dm"
Lorenzo Bianconif94124f2017-08-30 13:50:42 +020057#define LIS2DW12_ACCEL_DEV_NAME "lis2dw12"
Lorenzo Bianconifea4d482017-09-17 18:17:11 +020058#define LIS3DHH_ACCEL_DEV_NAME "lis3dhh"
Denis Cioccad6251162013-01-25 23:44:00 +000059
Denis CIOCCA23cde4d2013-06-19 09:28:00 +010060/**
61* struct st_sensors_platform_data - default accel platform data
62* @drdy_int_pin: default accel DRDY is available on INT1 pin.
63*/
64static const struct st_sensors_platform_data default_accel_pdata = {
65 .drdy_int_pin = 1,
66};
67
Denis CIOCCAb6e6bda62014-10-03 17:35:36 +020068int st_accel_common_probe(struct iio_dev *indio_dev);
Denis Cioccad6251162013-01-25 23:44:00 +000069void st_accel_common_remove(struct iio_dev *indio_dev);
70
71#ifdef CONFIG_IIO_BUFFER
72int st_accel_allocate_ring(struct iio_dev *indio_dev);
73void st_accel_deallocate_ring(struct iio_dev *indio_dev);
74int st_accel_trig_set_state(struct iio_trigger *trig, bool state);
75#define ST_ACCEL_TRIGGER_SET_STATE (&st_accel_trig_set_state)
76#else /* CONFIG_IIO_BUFFER */
77static inline int st_accel_allocate_ring(struct iio_dev *indio_dev)
78{
79 return 0;
80}
81static inline void st_accel_deallocate_ring(struct iio_dev *indio_dev)
82{
83}
84#define ST_ACCEL_TRIGGER_SET_STATE NULL
85#endif /* CONFIG_IIO_BUFFER */
86
87#endif /* ST_ACCEL_H */