kxtj9.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (C) 2011 Kionix, Inc.
  3. * Written by Chris Hudson <chudson@kionix.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  17. * 02111-1307, USA
  18. */
  19. #ifndef __KXTJ9_H__
  20. #define __KXTJ9_H__
  21. #define KXTJ9_I2C_ADDR 0x0F
  22. struct kxtj9_platform_data {
  23. unsigned int min_interval; /* minimum poll interval (in milli-seconds) */
  24. /*
  25. * By default, x is axis 0, y is axis 1, z is axis 2; these can be
  26. * changed to account for sensor orientation within the host device.
  27. */
  28. u8 axis_map_x;
  29. u8 axis_map_y;
  30. u8 axis_map_z;
  31. /*
  32. * Each axis can be negated to account for sensor orientation within
  33. * the host device.
  34. */
  35. bool negate_x;
  36. bool negate_y;
  37. bool negate_z;
  38. /* CTRL_REG1: set resolution, g-range, data ready enable */
  39. /* Output resolution: 8-bit valid or 12-bit valid */
  40. #define RES_8BIT 0
  41. #define RES_12BIT (1 << 6)
  42. u8 res_12bit;
  43. /* Output g-range: +/-2g, 4g, or 8g */
  44. #define KXTJ9_G_2G 0
  45. #define KXTJ9_G_4G (1 << 3)
  46. #define KXTJ9_G_8G (1 << 4)
  47. u8 g_range;
  48. /* DATA_CTRL_REG: controls the output data rate of the part */
  49. #define ODR12_5F 0
  50. #define ODR25F 1
  51. #define ODR50F 2
  52. #define ODR100F 3
  53. #define ODR200F 4
  54. #define ODR400F 5
  55. #define ODR800F 6
  56. u8 data_odr_init;
  57. int (*init)(void);
  58. void (*exit)(void);
  59. int (*power_on)(void);
  60. int (*power_off)(void);
  61. };
  62. #endif /* __KXTJ9_H__ */