xref: /openbmc/linux/drivers/iio/accel/st_accel.h (revision 89a2a93f)
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,
3289a2a93fSShrirang Bagul 	ST_ACCEL_MAX,
3389a2a93fSShrirang Bagul };
3489a2a93fSShrirang Bagul 
351e52fefcSTiberiu Breana #define H3LIS331DL_DRIVER_NAME		"h3lis331dl_accel"
363acddf74SLinus Walleij #define LIS3LV02DL_ACCEL_DEV_NAME	"lis3lv02dl_accel"
37d6251168SDenis Ciocca #define LSM303DLHC_ACCEL_DEV_NAME	"lsm303dlhc_accel"
38d6251168SDenis Ciocca #define LIS3DH_ACCEL_DEV_NAME		"lis3dh"
39d6251168SDenis Ciocca #define LSM330D_ACCEL_DEV_NAME		"lsm330d_accel"
40d6251168SDenis Ciocca #define LSM330DL_ACCEL_DEV_NAME		"lsm330dl_accel"
41d6251168SDenis Ciocca #define LSM330DLC_ACCEL_DEV_NAME	"lsm330dlc_accel"
42bbf5f037SLinus Walleij #define LIS331DL_ACCEL_DEV_NAME		"lis331dl_accel"
43d6251168SDenis Ciocca #define LIS331DLH_ACCEL_DEV_NAME	"lis331dlh"
44d6251168SDenis Ciocca #define LSM303DL_ACCEL_DEV_NAME		"lsm303dl_accel"
45d6251168SDenis Ciocca #define LSM303DLH_ACCEL_DEV_NAME	"lsm303dlh_accel"
46d6251168SDenis Ciocca #define LSM303DLM_ACCEL_DEV_NAME	"lsm303dlm_accel"
47d6251168SDenis Ciocca #define LSM330_ACCEL_DEV_NAME		"lsm330_accel"
48ddc05fa2SGiuseppe Barba #define LSM303AGR_ACCEL_DEV_NAME	"lsm303agr_accel"
4934dc578dSGiuseppe Barba #define LIS2DH12_ACCEL_DEV_NAME		"lis2dh12_accel"
504e68cfbfSJonathan Cameron #define LIS3L02DQ_ACCEL_DEV_NAME	"lis3l02dq"
51dcdb0a78SLorenzo Bianconi #define LNG2DM_ACCEL_DEV_NAME		"lng2dm"
52d6251168SDenis Ciocca 
5323cde4d6SDenis CIOCCA /**
5423cde4d6SDenis CIOCCA * struct st_sensors_platform_data - default accel platform data
5523cde4d6SDenis CIOCCA * @drdy_int_pin: default accel DRDY is available on INT1 pin.
5623cde4d6SDenis CIOCCA */
5723cde4d6SDenis CIOCCA static const struct st_sensors_platform_data default_accel_pdata = {
5823cde4d6SDenis CIOCCA 	.drdy_int_pin = 1,
5923cde4d6SDenis CIOCCA };
6023cde4d6SDenis CIOCCA 
61b6e6bda6SDenis CIOCCA int st_accel_common_probe(struct iio_dev *indio_dev);
62d6251168SDenis Ciocca void st_accel_common_remove(struct iio_dev *indio_dev);
63d6251168SDenis Ciocca 
64d6251168SDenis Ciocca #ifdef CONFIG_IIO_BUFFER
65d6251168SDenis Ciocca int st_accel_allocate_ring(struct iio_dev *indio_dev);
66d6251168SDenis Ciocca void st_accel_deallocate_ring(struct iio_dev *indio_dev);
67d6251168SDenis Ciocca int st_accel_trig_set_state(struct iio_trigger *trig, bool state);
68d6251168SDenis Ciocca #define ST_ACCEL_TRIGGER_SET_STATE (&st_accel_trig_set_state)
69d6251168SDenis Ciocca #else /* CONFIG_IIO_BUFFER */
70d6251168SDenis Ciocca static inline int st_accel_allocate_ring(struct iio_dev *indio_dev)
71d6251168SDenis Ciocca {
72d6251168SDenis Ciocca 	return 0;
73d6251168SDenis Ciocca }
74d6251168SDenis Ciocca static inline void st_accel_deallocate_ring(struct iio_dev *indio_dev)
75d6251168SDenis Ciocca {
76d6251168SDenis Ciocca }
77d6251168SDenis Ciocca #define ST_ACCEL_TRIGGER_SET_STATE NULL
78d6251168SDenis Ciocca #endif /* CONFIG_IIO_BUFFER */
79d6251168SDenis Ciocca 
80d6251168SDenis Ciocca #endif /* ST_ACCEL_H */
81