st_accel.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  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. #ifndef ST_ACCEL_H
  11. #define ST_ACCEL_H
  12. #include <linux/types.h>
  13. #include <linux/iio/common/st_sensors.h>
  14. enum st_accel_type {
  15. LSM303DLH,
  16. LSM303DLHC,
  17. LIS3DH,
  18. LSM330D,
  19. LSM330DL,
  20. LSM330DLC,
  21. LIS331DLH,
  22. LSM303DL,
  23. LSM303DLM,
  24. LSM330,
  25. LSM303AGR,
  26. LIS2DH12,
  27. LIS3L02DQ,
  28. LNG2DM,
  29. ST_ACCEL_MAX,
  30. };
  31. #define H3LIS331DL_DRIVER_NAME "h3lis331dl_accel"
  32. #define LIS3LV02DL_ACCEL_DEV_NAME "lis3lv02dl_accel"
  33. #define LSM303DLHC_ACCEL_DEV_NAME "lsm303dlhc_accel"
  34. #define LIS3DH_ACCEL_DEV_NAME "lis3dh"
  35. #define LSM330D_ACCEL_DEV_NAME "lsm330d_accel"
  36. #define LSM330DL_ACCEL_DEV_NAME "lsm330dl_accel"
  37. #define LSM330DLC_ACCEL_DEV_NAME "lsm330dlc_accel"
  38. #define LIS331DL_ACCEL_DEV_NAME "lis331dl_accel"
  39. #define LIS331DLH_ACCEL_DEV_NAME "lis331dlh"
  40. #define LSM303DL_ACCEL_DEV_NAME "lsm303dl_accel"
  41. #define LSM303DLH_ACCEL_DEV_NAME "lsm303dlh_accel"
  42. #define LSM303DLM_ACCEL_DEV_NAME "lsm303dlm_accel"
  43. #define LSM330_ACCEL_DEV_NAME "lsm330_accel"
  44. #define LSM303AGR_ACCEL_DEV_NAME "lsm303agr_accel"
  45. #define LIS2DH12_ACCEL_DEV_NAME "lis2dh12_accel"
  46. #define LIS3L02DQ_ACCEL_DEV_NAME "lis3l02dq"
  47. #define LNG2DM_ACCEL_DEV_NAME "lng2dm"
  48. /**
  49. * struct st_sensors_platform_data - default accel platform data
  50. * @drdy_int_pin: default accel DRDY is available on INT1 pin.
  51. */
  52. static const struct st_sensors_platform_data default_accel_pdata = {
  53. .drdy_int_pin = 1,
  54. };
  55. int st_accel_common_probe(struct iio_dev *indio_dev);
  56. void st_accel_common_remove(struct iio_dev *indio_dev);
  57. #ifdef CONFIG_IIO_BUFFER
  58. int st_accel_allocate_ring(struct iio_dev *indio_dev);
  59. void st_accel_deallocate_ring(struct iio_dev *indio_dev);
  60. int st_accel_trig_set_state(struct iio_trigger *trig, bool state);
  61. #define ST_ACCEL_TRIGGER_SET_STATE (&st_accel_trig_set_state)
  62. #else /* CONFIG_IIO_BUFFER */
  63. static inline int st_accel_allocate_ring(struct iio_dev *indio_dev)
  64. {
  65. return 0;
  66. }
  67. static inline void st_accel_deallocate_ring(struct iio_dev *indio_dev)
  68. {
  69. }
  70. #define ST_ACCEL_TRIGGER_SET_STATE NULL
  71. #endif /* CONFIG_IIO_BUFFER */
  72. #endif /* ST_ACCEL_H */