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, 35f94124f9SLorenzo Bianconi LIS2DW12, 36fea4d486SLorenzo Bianconi LIS3DHH, 3789a2a93fSShrirang Bagul ST_ACCEL_MAX, 3889a2a93fSShrirang Bagul }; 3989a2a93fSShrirang Bagul 40b30f1593SLorenzo Bianconi #define H3LIS331DL_ACCEL_DEV_NAME "h3lis331dl_accel" 413acddf74SLinus Walleij #define LIS3LV02DL_ACCEL_DEV_NAME "lis3lv02dl_accel" 42d6251168SDenis Ciocca #define LSM303DLHC_ACCEL_DEV_NAME "lsm303dlhc_accel" 43d6251168SDenis Ciocca #define LIS3DH_ACCEL_DEV_NAME "lis3dh" 44d6251168SDenis Ciocca #define LSM330D_ACCEL_DEV_NAME "lsm330d_accel" 45d6251168SDenis Ciocca #define LSM330DL_ACCEL_DEV_NAME "lsm330dl_accel" 46d6251168SDenis Ciocca #define LSM330DLC_ACCEL_DEV_NAME "lsm330dlc_accel" 47bbf5f037SLinus Walleij #define LIS331DL_ACCEL_DEV_NAME "lis331dl_accel" 48d6251168SDenis Ciocca #define LIS331DLH_ACCEL_DEV_NAME "lis331dlh" 49d6251168SDenis Ciocca #define LSM303DL_ACCEL_DEV_NAME "lsm303dl_accel" 50d6251168SDenis Ciocca #define LSM303DLH_ACCEL_DEV_NAME "lsm303dlh_accel" 51d6251168SDenis Ciocca #define LSM303DLM_ACCEL_DEV_NAME "lsm303dlm_accel" 52d6251168SDenis Ciocca #define LSM330_ACCEL_DEV_NAME "lsm330_accel" 53ddc05fa2SGiuseppe Barba #define LSM303AGR_ACCEL_DEV_NAME "lsm303agr_accel" 5434dc578dSGiuseppe Barba #define LIS2DH12_ACCEL_DEV_NAME "lis2dh12_accel" 554e68cfbfSJonathan Cameron #define LIS3L02DQ_ACCEL_DEV_NAME "lis3l02dq" 56dcdb0a78SLorenzo Bianconi #define LNG2DM_ACCEL_DEV_NAME "lng2dm" 57f94124f9SLorenzo Bianconi #define LIS2DW12_ACCEL_DEV_NAME "lis2dw12" 58fea4d486SLorenzo Bianconi #define LIS3DHH_ACCEL_DEV_NAME "lis3dhh" 59d6251168SDenis Ciocca 6023cde4d6SDenis CIOCCA /** 6123cde4d6SDenis CIOCCA * struct st_sensors_platform_data - default accel platform data 6223cde4d6SDenis CIOCCA * @drdy_int_pin: default accel DRDY is available on INT1 pin. 6323cde4d6SDenis CIOCCA */ 6423cde4d6SDenis CIOCCA static const struct st_sensors_platform_data default_accel_pdata = { 6523cde4d6SDenis CIOCCA .drdy_int_pin = 1, 6623cde4d6SDenis CIOCCA }; 6723cde4d6SDenis CIOCCA 68b6e6bda6SDenis CIOCCA int st_accel_common_probe(struct iio_dev *indio_dev); 69d6251168SDenis Ciocca void st_accel_common_remove(struct iio_dev *indio_dev); 70d6251168SDenis Ciocca 71d6251168SDenis Ciocca #ifdef CONFIG_IIO_BUFFER 72d6251168SDenis Ciocca int st_accel_allocate_ring(struct iio_dev *indio_dev); 73d6251168SDenis Ciocca void st_accel_deallocate_ring(struct iio_dev *indio_dev); 74d6251168SDenis Ciocca int st_accel_trig_set_state(struct iio_trigger *trig, bool state); 75d6251168SDenis Ciocca #define ST_ACCEL_TRIGGER_SET_STATE (&st_accel_trig_set_state) 76d6251168SDenis Ciocca #else /* CONFIG_IIO_BUFFER */ 77d6251168SDenis Ciocca static inline int st_accel_allocate_ring(struct iio_dev *indio_dev) 78d6251168SDenis Ciocca { 79d6251168SDenis Ciocca return 0; 80d6251168SDenis Ciocca } 81d6251168SDenis Ciocca static inline void st_accel_deallocate_ring(struct iio_dev *indio_dev) 82d6251168SDenis Ciocca { 83d6251168SDenis Ciocca } 84d6251168SDenis Ciocca #define ST_ACCEL_TRIGGER_SET_STATE NULL 85d6251168SDenis Ciocca #endif /* CONFIG_IIO_BUFFER */ 86d6251168SDenis Ciocca 87d6251168SDenis Ciocca #endif /* ST_ACCEL_H */ 88