k3dh_reg.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * STMicroelectronics kr3dh acceleration sensor driver
  3. *
  4. * Copyright (C) 2010 Samsung Electronics Co.Ltd
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. /* kr3dh i2c slave address */
  17. #define KR3DH_I2C_ADDR 0x19
  18. /* kr3dh registers */
  19. #define STATUS_AUX 0x07
  20. #define OUT_1_L 0x08
  21. #define OUT_1_H 0x09
  22. #define OUT_2_L 0x0A
  23. #define OUT_2_H 0x0B
  24. #define OUT_3_L 0x0C
  25. #define OUT_3_H 0x0D
  26. #define INT_COUNTER 0x0E
  27. #define WHO_AM_I 0x0F
  28. #define TEMP_CFG_REG 0x1F
  29. #define CTRL_REG1 0x20 /* power control reg */
  30. #define CTRL_REG2 0x21 /* power control reg */
  31. #define CTRL_REG3 0x22 /* power control reg */
  32. #define CTRL_REG4 0x23 /* interrupt control reg */
  33. #define CTRL_REG5 0x24 /* interrupt control reg */
  34. #define CTRL_REG6 0x25
  35. #define REFERENCE 0x26
  36. #define STATUS_REG 0x27
  37. #define OUT_X_L 0x28
  38. #define OUT_X_H 0x29
  39. #define OUT_Y_L 0x2A
  40. #define OUT_Y_H 0x2B
  41. #define OUT_Z_L 0x2C
  42. #define OUT_Z_H 0x2D
  43. #define FIFO_CTRL_REG 0x2E
  44. #define FIFO_SRC_REG 0x2F
  45. #define INT1_CFG 0x30
  46. #define INT1_SRC 0x31
  47. #define INT1_THS 0x32
  48. #define INT1_DURATION 0x33
  49. #define CLICK_CFG 0x38
  50. #define CLICK_SRC 0x39
  51. #define CLICK_THS 0x3A
  52. #define TIME_LIMIT 0x3B
  53. #define TIME_LATENCY 0x3C
  54. #define TIME_WINDOW 0x3D
  55. /* CTRL_REG1 */
  56. #define CTRL_REG1_ODR3 (1 << 7)
  57. #define CTRL_REG1_ODR2 (1 << 6)
  58. #define CTRL_REG1_ODR1 (1 << 5)
  59. #define CTRL_REG1_ODR0 (1 << 4)
  60. #define CTRL_REG1_LPEN (1 << 3)
  61. #define CTRL_REG1_Zen (1 << 2)
  62. #define CTRL_REG1_Yen (1 << 1)
  63. #define CTRL_REG1_Xen (1 << 0)
  64. #define PM_OFF 0x00
  65. #define ENABLE_ALL_AXES 0x07
  66. #define ODR1 0x10 /* 1Hz output data rate */
  67. #define ODR10 0x20 /* 10Hz output data rate */
  68. #define ODR25 0x30 /* 10Hz output data rate */
  69. #define ODR50 0x40 /* 50Hz output data rate */
  70. #define ODR100 0x50 /* 100Hz output data rate */
  71. #define ODR200 0x60 /* 100Hz output data rate */
  72. #define ODR400 0x70 /* 400Hz output data rate */
  73. #define ODR1344 0x90 /* 1344Hz output data rate */
  74. #define ODR_MASK 0xf0
  75. /* CTRL_REG2 */
  76. #define CTRL_REG2_HPM1 (1 << 7)
  77. #define CTRL_REG2_HPM0 (1 << 6)
  78. #define CTRL_REG2_HPCF2 (1 << 5)
  79. #define CTRL_REG2_HPCF1 (1 << 4)
  80. #define CTRL_REG2_FDS (1 << 3)
  81. #define CTRL_REG2_HPPCLICK (1 << 2)
  82. #define CTRL_REG2_HPIS2 (1 << 1)
  83. #define CTRL_REG2_HPIS1 (1 << 0)
  84. #define HPM_Normal (CTRL_REG2_HPM1)
  85. #define HPM_Filter (CTRL_REG2_HPM0)
  86. /* CTRL_REG3 */
  87. #define I1_CLICK (1 << 7)
  88. #define I1_AOI1 (1 << 6)
  89. #define I1_AOI2 (1 << 5)
  90. #define I1_DRDY1 (1 << 4)
  91. #define I1_DRDY2 (1 << 3)
  92. #define I1_WTM (1 << 2)
  93. #define I1_OVERRUN (1 << 1)
  94. /* CTRL_REG4 */
  95. #define CTRL_REG4_BDU (1 << 7)
  96. #define CTRL_REG4_BLE (1 << 6)
  97. #define CTRL_REG4_FS1 (1 << 5)
  98. #define CTRL_REG4_FS0 (1 << 4)
  99. #define CTRL_REG4_HR (1 << 3)
  100. #define CTRL_REG4_ST1 (1 << 2)
  101. #define CTRL_REG4_ST0 (1 << 1)
  102. #define CTRL_REG4_SIM (1 << 0)
  103. #define FS2g 0x00
  104. #define FS4g (CTRL_REG4_FS0)
  105. #define FS8g (CTRL_REG4_FS1)
  106. #define FS16g (CTRL_REG4_FS1|CTRL_REG4_FS0)
  107. /* CTRL_REG5 */
  108. #define BOOT (1 << 7)
  109. #define FIFO_EN (1 << 6)
  110. #define LIR_INT1 (1 << 3)
  111. #define D4D_INT1 (1 << 2)
  112. /* STATUS_REG */
  113. #define ZYXOR (1 << 7)
  114. #define ZOR (1 << 6)
  115. #define YOR (1 << 5)
  116. #define XOR (1 << 4)
  117. #define ZYXDA (1 << 3)
  118. #define ZDA (1 << 2)
  119. #define YDA (1 << 1)
  120. #define XDA (1 << 0)
  121. /* INT1_CFG */
  122. #define INT_CFG_AOI (1 << 7)
  123. #define INT_CFG_6D (1 << 6)
  124. #define INT_CFG_ZHIE (1 << 5)
  125. #define INT_CFG_ZLIE (1 << 4)
  126. #define INT_CFG_YHIE (1 << 3)
  127. #define INT_CFG_YLIE (1 << 2)
  128. #define INT_CFG_XHIE (1 << 1)
  129. #define INT_CFG_XLIE (1 << 0)
  130. /* INT1_SRC */
  131. #define IA (1 << 6)
  132. #define ZH (1 << 5)
  133. #define ZL (1 << 4)
  134. #define YH (1 << 3)
  135. #define YL (1 << 2)
  136. #define XH (1 << 1)
  137. #define XL (1 << 0)
  138. /* Register Auto-increase */
  139. #define AC (1 << 7)