xref: /openbmc/linux/drivers/iio/accel/st_accel.h (revision 6011208d)
1d6251168SDenis Ciocca /*
2d6251168SDenis Ciocca  * STMicroelectronics accelerometers driver
3d6251168SDenis Ciocca  *
4d6251168SDenis Ciocca  * Copyright 2012-2013 STMicroelectronics Inc.
5d6251168SDenis Ciocca  *
6d6251168SDenis Ciocca  * Denis Ciocca <denis.ciocca@st.com>
7d6251168SDenis Ciocca  * v. 1.0.0
8d6251168SDenis Ciocca  * Licensed under the GPL-2.
9d6251168SDenis Ciocca  */
10d6251168SDenis Ciocca 
11d6251168SDenis Ciocca #ifndef ST_ACCEL_H
12d6251168SDenis Ciocca #define ST_ACCEL_H
13d6251168SDenis Ciocca 
14d6251168SDenis Ciocca #include <linux/types.h>
15d6251168SDenis Ciocca #include <linux/iio/common/st_sensors.h>
16d6251168SDenis Ciocca 
1789a2a93fSShrirang Bagul enum st_accel_type {
1889a2a93fSShrirang Bagul 	LSM303DLH,
1989a2a93fSShrirang Bagul 	LSM303DLHC,
2089a2a93fSShrirang Bagul 	LIS3DH,
2189a2a93fSShrirang Bagul 	LSM330D,
2289a2a93fSShrirang Bagul 	LSM330DL,
2389a2a93fSShrirang Bagul 	LSM330DLC,
2489a2a93fSShrirang Bagul 	LIS331DLH,
2589a2a93fSShrirang Bagul 	LSM303DL,
2689a2a93fSShrirang Bagul 	LSM303DLM,
2789a2a93fSShrirang Bagul 	LSM330,
2889a2a93fSShrirang Bagul 	LSM303AGR,
2989a2a93fSShrirang Bagul 	LIS2DH12,
3089a2a93fSShrirang Bagul 	LIS3L02DQ,
3189a2a93fSShrirang Bagul 	LNG2DM,
326011208dSLorenzo Bianconi 	H3LIS331DL,
336011208dSLorenzo Bianconi 	LIS331DL,
346011208dSLorenzo Bianconi 	LIS3LV02DL,
3589a2a93fSShrirang Bagul 	ST_ACCEL_MAX,
3689a2a93fSShrirang Bagul };
3789a2a93fSShrirang Bagul 
381e52fefcSTiberiu Breana #define H3LIS331DL_DRIVER_NAME		"h3lis331dl_accel"
393acddf74SLinus Walleij #define LIS3LV02DL_ACCEL_DEV_NAME	"lis3lv02dl_accel"
40d6251168SDenis Ciocca #define LSM303DLHC_ACCEL_DEV_NAME	"lsm303dlhc_accel"
41d6251168SDenis Ciocca #define LIS3DH_ACCEL_DEV_NAME		"lis3dh"
42d6251168SDenis Ciocca #define LSM330D_ACCEL_DEV_NAME		"lsm330d_accel"
43d6251168SDenis Ciocca #define LSM330DL_ACCEL_DEV_NAME		"lsm330dl_accel"
44d6251168SDenis Ciocca #define LSM330DLC_ACCEL_DEV_NAME	"lsm330dlc_accel"
45bbf5f037SLinus Walleij #define LIS331DL_ACCEL_DEV_NAME		"lis331dl_accel"
46d6251168SDenis Ciocca #define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh"
47d6251168SDenis Ciocca #define LSM303DL_ACCEL_DEV_NAME		"lsm303dl_accel"
48d6251168SDenis Ciocca #define LSM303DLH_ACCEL_DEV_NAME	"lsm303dlh_accel"
49d6251168SDenis Ciocca #define LSM303DLM_ACCEL_DEV_NAME	"lsm303dlm_accel"
50d6251168SDenis Ciocca #define LSM330_ACCEL_DEV_NAME		"lsm330_accel"
51ddc05fa2SGiuseppe Barba #define LSM303AGR_ACCEL_DEV_NAME	"lsm303agr_accel"
5234dc578dSGiuseppe Barba #define LIS2DH12_ACCEL_DEV_NAME		"lis2dh12_accel"
534e68cfbfSJonathan Cameron #define LIS3L02DQ_ACCEL_DEV_NAME	"lis3l02dq"
54dcdb0a78SLorenzo Bianconi #define LNG2DM_ACCEL_DEV_NAME		"lng2dm"
55d6251168SDenis Ciocca 
5623cde4d6SDenis CIOCCA /**
5723cde4d6SDenis CIOCCA * struct st_sensors_platform_data - default accel platform data
5823cde4d6SDenis CIOCCA * @drdy_int_pin: default accel DRDY is available on INT1 pin.
5923cde4d6SDenis CIOCCA */
6023cde4d6SDenis CIOCCA static const struct st_sensors_platform_data default_accel_pdata = {
6123cde4d6SDenis CIOCCA 	.drdy_int_pin = 1,
6223cde4d6SDenis CIOCCA };
6323cde4d6SDenis CIOCCA 
64b6e6bda6SDenis CIOCCA int st_accel_common_probe(struct iio_dev *indio_dev);
65d6251168SDenis Ciocca void st_accel_common_remove(struct iio_dev *indio_dev);
66d6251168SDenis Ciocca 
67d6251168SDenis Ciocca #ifdef CONFIG_IIO_BUFFER
68d6251168SDenis Ciocca int st_accel_allocate_ring(struct iio_dev *indio_dev);
69d6251168SDenis Ciocca void st_accel_deallocate_ring(struct iio_dev *indio_dev);
70d6251168SDenis Ciocca int st_accel_trig_set_state(struct iio_trigger *trig, bool state);
71d6251168SDenis Ciocca #define ST_ACCEL_TRIGGER_SET_STATE (&st_accel_trig_set_state)
72d6251168SDenis Ciocca #else /* CONFIG_IIO_BUFFER */
73d6251168SDenis Ciocca static inline int st_accel_allocate_ring(struct iio_dev *indio_dev)
74d6251168SDenis Ciocca {
75d6251168SDenis Ciocca 	return 0;
76d6251168SDenis Ciocca }
77d6251168SDenis Ciocca static inline void st_accel_deallocate_ring(struct iio_dev *indio_dev)
78d6251168SDenis Ciocca {
79d6251168SDenis Ciocca }
80d6251168SDenis Ciocca #define ST_ACCEL_TRIGGER_SET_STATE NULL
81d6251168SDenis Ciocca #endif /* CONFIG_IIO_BUFFER */
82d6251168SDenis Ciocca 
83d6251168SDenis Ciocca #endif /* ST_ACCEL_H */
84