lis2hh.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /******************** (C) COPYRIGHT 2013 STMicroelectronics ********************
  2. *
  3. * File Name : lis2hh_acc_sysfs.h
  4. * Authors : AMS - Motion Mems Division - Application Team
  5. * : Matteo Dameno (matteo.dameno@st.com)
  6. * Version : V.1.1.0
  7. * Date : 2013/Mar/28
  8. *
  9. ********************************************************************************
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. *
  15. * THE PRESENT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES
  16. * OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, FOR THE SOLE
  17. * PURPOSE TO SUPPORT YOUR APPLICATION DEVELOPMENT.
  18. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
  19. * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
  20. * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
  21. * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  22. *
  23. *******************************************************************************/
  24. /*******************************************************************************
  25. Version History.
  26. Revision 1.0.0 25/Feb/2013
  27. first revision
  28. supports sysfs;
  29. Revision 1.1.0 28/Mar/2013
  30. introduces hr_timers for polling;
  31. *******************************************************************************/
  32. #ifndef __LIS2HH_H__
  33. #define __LIS2HH_H__
  34. #define LIS2HH_ACC_DEV_NAME "lis2hh_acc"
  35. #define LIS2HH_ACC_MIN_POLL_PERIOD_MS 2
  36. #ifdef __KERNEL__
  37. #define LIS2HH_ACC_SAD0L (0x10)
  38. #define LIS2HH_ACC_SAD0H (0x01)
  39. #define LIS2HH_ACC_I2C_SADROOT (0x07)
  40. /* I2C address if acc SA0 pin to GND */
  41. #define LIS2HH_ACC_I2C_SAD_L ((LIS2HH_ACC_I2C_SADROOT<<2)| \
  42. LIS2HH_ACC_SAD0L)
  43. /* I2C address if acc SA0 pin to Vdd */
  44. #define LIS2HH_ACC_I2C_SAD_H ((LIS2HH_ACC_I2C_SADROOT<<2)| \
  45. LIS2HH_ACC_SAD0H)
  46. /* to set gpios numb connected to interrupt pins,
  47. * the unused ones have to be set to -EINVAL
  48. */
  49. #define LIS2HH_ACC_DEFAULT_INT1_GPIO (-EINVAL)
  50. #define LIS2HH_ACC_DEFAULT_INT2_GPIO (-EINVAL)
  51. /* Accelerometer Sensor Full Scale */
  52. #define LIS2HH_ACC_FS_MASK (0x30)
  53. #define LIS2HH_ACC_FS_2G (0x00)
  54. #define LIS2HH_ACC_FS_4G (0x20)
  55. #define LIS2HH_ACC_FS_8G (0x30)
  56. struct lis2hh_acc_platform_data {
  57. unsigned int poll_interval;
  58. unsigned int min_interval;
  59. u8 fs_range;
  60. u8 axis_map_x;
  61. u8 axis_map_y;
  62. u8 axis_map_z;
  63. u8 negate_x;
  64. u8 negate_y;
  65. u8 negate_z;
  66. int (*init)(void);
  67. void (*exit)(void);
  68. int (*power_on)(void);
  69. int (*power_off)(void);
  70. u32 int_flags;
  71. /* set gpio_int[1,2] either to the choosen gpio pin number or to -EINVAL
  72. * if leaved unconnected
  73. */
  74. int gpio_int1;
  75. int gpio_int2;
  76. };
  77. #endif /* __KERNEL__ */
  78. #endif /* __LIS2HH_H__ */