inv_icm42600.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) 2020 Invensense, Inc.
  4. */
  5. #ifndef INV_ICM42600_H_
  6. #define INV_ICM42600_H_
  7. #include <linux/bits.h>
  8. #include <linux/bitfield.h>
  9. #include <linux/regmap.h>
  10. #include <linux/mutex.h>
  11. #include <linux/regulator/consumer.h>
  12. #include <linux/pm.h>
  13. #include <linux/iio/iio.h>
  14. #include <linux/iio/common/inv_sensors_timestamp.h>
  15. #include "inv_icm42600_buffer.h"
  16. enum inv_icm42600_chip {
  17. INV_CHIP_INVALID,
  18. INV_CHIP_ICM42600,
  19. INV_CHIP_ICM42602,
  20. INV_CHIP_ICM42605,
  21. INV_CHIP_ICM42686,
  22. INV_CHIP_ICM42622,
  23. INV_CHIP_ICM42688,
  24. INV_CHIP_ICM42631,
  25. INV_CHIP_NB,
  26. };
  27. /* serial bus slew rates */
  28. enum inv_icm42600_slew_rate {
  29. INV_ICM42600_SLEW_RATE_20_60NS,
  30. INV_ICM42600_SLEW_RATE_12_36NS,
  31. INV_ICM42600_SLEW_RATE_6_18NS,
  32. INV_ICM42600_SLEW_RATE_4_12NS,
  33. INV_ICM42600_SLEW_RATE_2_6NS,
  34. INV_ICM42600_SLEW_RATE_INF_2NS,
  35. };
  36. enum inv_icm42600_sensor_mode {
  37. INV_ICM42600_SENSOR_MODE_OFF,
  38. INV_ICM42600_SENSOR_MODE_STANDBY,
  39. INV_ICM42600_SENSOR_MODE_LOW_POWER,
  40. INV_ICM42600_SENSOR_MODE_LOW_NOISE,
  41. INV_ICM42600_SENSOR_MODE_NB,
  42. };
  43. /* gyroscope fullscale values */
  44. enum inv_icm42600_gyro_fs {
  45. INV_ICM42600_GYRO_FS_2000DPS,
  46. INV_ICM42600_GYRO_FS_1000DPS,
  47. INV_ICM42600_GYRO_FS_500DPS,
  48. INV_ICM42600_GYRO_FS_250DPS,
  49. INV_ICM42600_GYRO_FS_125DPS,
  50. INV_ICM42600_GYRO_FS_62_5DPS,
  51. INV_ICM42600_GYRO_FS_31_25DPS,
  52. INV_ICM42600_GYRO_FS_15_625DPS,
  53. INV_ICM42600_GYRO_FS_NB,
  54. };
  55. enum inv_icm42686_gyro_fs {
  56. INV_ICM42686_GYRO_FS_4000DPS,
  57. INV_ICM42686_GYRO_FS_2000DPS,
  58. INV_ICM42686_GYRO_FS_1000DPS,
  59. INV_ICM42686_GYRO_FS_500DPS,
  60. INV_ICM42686_GYRO_FS_250DPS,
  61. INV_ICM42686_GYRO_FS_125DPS,
  62. INV_ICM42686_GYRO_FS_62_5DPS,
  63. INV_ICM42686_GYRO_FS_31_25DPS,
  64. INV_ICM42686_GYRO_FS_NB,
  65. };
  66. /* accelerometer fullscale values */
  67. enum inv_icm42600_accel_fs {
  68. INV_ICM42600_ACCEL_FS_16G,
  69. INV_ICM42600_ACCEL_FS_8G,
  70. INV_ICM42600_ACCEL_FS_4G,
  71. INV_ICM42600_ACCEL_FS_2G,
  72. INV_ICM42600_ACCEL_FS_NB,
  73. };
  74. enum inv_icm42686_accel_fs {
  75. INV_ICM42686_ACCEL_FS_32G,
  76. INV_ICM42686_ACCEL_FS_16G,
  77. INV_ICM42686_ACCEL_FS_8G,
  78. INV_ICM42686_ACCEL_FS_4G,
  79. INV_ICM42686_ACCEL_FS_2G,
  80. INV_ICM42686_ACCEL_FS_NB,
  81. };
  82. /* ODR suffixed by LN or LP are Low-Noise or Low-Power mode only */
  83. enum inv_icm42600_odr {
  84. INV_ICM42600_ODR_8KHZ_LN = 3,
  85. INV_ICM42600_ODR_4KHZ_LN,
  86. INV_ICM42600_ODR_2KHZ_LN,
  87. INV_ICM42600_ODR_1KHZ_LN,
  88. INV_ICM42600_ODR_200HZ,
  89. INV_ICM42600_ODR_100HZ,
  90. INV_ICM42600_ODR_50HZ,
  91. INV_ICM42600_ODR_25HZ,
  92. INV_ICM42600_ODR_12_5HZ,
  93. INV_ICM42600_ODR_6_25HZ_LP,
  94. INV_ICM42600_ODR_3_125HZ_LP,
  95. INV_ICM42600_ODR_1_5625HZ_LP,
  96. INV_ICM42600_ODR_500HZ,
  97. INV_ICM42600_ODR_NB,
  98. };
  99. enum inv_icm42600_filter {
  100. /* Low-Noise mode sensor data filter (3rd order filter by default) */
  101. INV_ICM42600_FILTER_BW_ODR_DIV_2,
  102. /* Low-Power mode sensor data filter (averaging) */
  103. INV_ICM42600_FILTER_AVG_1X = 1,
  104. INV_ICM42600_FILTER_AVG_16X = 6,
  105. };
  106. struct inv_icm42600_sensor_conf {
  107. int mode;
  108. int fs;
  109. int odr;
  110. int filter;
  111. };
  112. #define INV_ICM42600_SENSOR_CONF_INIT {-1, -1, -1, -1}
  113. struct inv_icm42600_conf {
  114. struct inv_icm42600_sensor_conf gyro;
  115. struct inv_icm42600_sensor_conf accel;
  116. bool temp_en;
  117. };
  118. struct inv_icm42600_suspended {
  119. enum inv_icm42600_sensor_mode gyro;
  120. enum inv_icm42600_sensor_mode accel;
  121. bool temp;
  122. };
  123. /**
  124. * struct inv_icm42600_state - driver state variables
  125. * @lock: lock for serializing multiple registers access.
  126. * @chip: chip identifier.
  127. * @name: chip name.
  128. * @map: regmap pointer.
  129. * @vdd_supply: VDD voltage regulator for the chip.
  130. * @vddio_supply: I/O voltage regulator for the chip.
  131. * @orientation: sensor chip orientation relative to main hardware.
  132. * @conf: chip sensors configurations.
  133. * @suspended: suspended sensors configuration.
  134. * @indio_gyro: gyroscope IIO device.
  135. * @indio_accel: accelerometer IIO device.
  136. * @buffer: data transfer buffer aligned for DMA.
  137. * @fifo: FIFO management structure.
  138. * @timestamp: interrupt timestamps.
  139. */
  140. struct inv_icm42600_state {
  141. struct mutex lock;
  142. enum inv_icm42600_chip chip;
  143. const char *name;
  144. struct regmap *map;
  145. struct regulator *vdd_supply;
  146. struct regulator *vddio_supply;
  147. struct iio_mount_matrix orientation;
  148. struct inv_icm42600_conf conf;
  149. struct inv_icm42600_suspended suspended;
  150. struct iio_dev *indio_gyro;
  151. struct iio_dev *indio_accel;
  152. uint8_t buffer[2] __aligned(IIO_DMA_MINALIGN);
  153. struct inv_icm42600_fifo fifo;
  154. struct {
  155. int64_t gyro;
  156. int64_t accel;
  157. } timestamp;
  158. };
  159. /**
  160. * struct inv_icm42600_sensor_state - sensor state variables
  161. * @scales: table of scales.
  162. * @scales_len: length (nb of items) of the scales table.
  163. * @power_mode: sensor requested power mode (for common frequencies)
  164. * @filter: sensor filter.
  165. * @ts: timestamp module states.
  166. */
  167. struct inv_icm42600_sensor_state {
  168. const int *scales;
  169. size_t scales_len;
  170. enum inv_icm42600_sensor_mode power_mode;
  171. enum inv_icm42600_filter filter;
  172. struct inv_sensors_timestamp ts;
  173. };
  174. /* Virtual register addresses: @bank on MSB (4 upper bits), @address on LSB */
  175. /* Bank selection register, available in all banks */
  176. #define INV_ICM42600_REG_BANK_SEL 0x76
  177. #define INV_ICM42600_BANK_SEL_MASK GENMASK(2, 0)
  178. /* User bank 0 (MSB 0x00) */
  179. #define INV_ICM42600_REG_DEVICE_CONFIG 0x0011
  180. #define INV_ICM42600_DEVICE_CONFIG_SOFT_RESET BIT(0)
  181. #define INV_ICM42600_REG_DRIVE_CONFIG 0x0013
  182. #define INV_ICM42600_DRIVE_CONFIG_I2C_MASK GENMASK(5, 3)
  183. #define INV_ICM42600_DRIVE_CONFIG_I2C(_rate) \
  184. FIELD_PREP(INV_ICM42600_DRIVE_CONFIG_I2C_MASK, (_rate))
  185. #define INV_ICM42600_DRIVE_CONFIG_SPI_MASK GENMASK(2, 0)
  186. #define INV_ICM42600_DRIVE_CONFIG_SPI(_rate) \
  187. FIELD_PREP(INV_ICM42600_DRIVE_CONFIG_SPI_MASK, (_rate))
  188. #define INV_ICM42600_REG_INT_CONFIG 0x0014
  189. #define INV_ICM42600_INT_CONFIG_INT2_LATCHED BIT(5)
  190. #define INV_ICM42600_INT_CONFIG_INT2_PUSH_PULL BIT(4)
  191. #define INV_ICM42600_INT_CONFIG_INT2_ACTIVE_HIGH BIT(3)
  192. #define INV_ICM42600_INT_CONFIG_INT2_ACTIVE_LOW 0x00
  193. #define INV_ICM42600_INT_CONFIG_INT1_LATCHED BIT(2)
  194. #define INV_ICM42600_INT_CONFIG_INT1_PUSH_PULL BIT(1)
  195. #define INV_ICM42600_INT_CONFIG_INT1_ACTIVE_HIGH BIT(0)
  196. #define INV_ICM42600_INT_CONFIG_INT1_ACTIVE_LOW 0x00
  197. #define INV_ICM42600_REG_FIFO_CONFIG 0x0016
  198. #define INV_ICM42600_FIFO_CONFIG_MASK GENMASK(7, 6)
  199. #define INV_ICM42600_FIFO_CONFIG_BYPASS \
  200. FIELD_PREP(INV_ICM42600_FIFO_CONFIG_MASK, 0)
  201. #define INV_ICM42600_FIFO_CONFIG_STREAM \
  202. FIELD_PREP(INV_ICM42600_FIFO_CONFIG_MASK, 1)
  203. #define INV_ICM42600_FIFO_CONFIG_STOP_ON_FULL \
  204. FIELD_PREP(INV_ICM42600_FIFO_CONFIG_MASK, 2)
  205. /* all sensor data are 16 bits (2 registers wide) in big-endian */
  206. #define INV_ICM42600_REG_TEMP_DATA 0x001D
  207. #define INV_ICM42600_REG_ACCEL_DATA_X 0x001F
  208. #define INV_ICM42600_REG_ACCEL_DATA_Y 0x0021
  209. #define INV_ICM42600_REG_ACCEL_DATA_Z 0x0023
  210. #define INV_ICM42600_REG_GYRO_DATA_X 0x0025
  211. #define INV_ICM42600_REG_GYRO_DATA_Y 0x0027
  212. #define INV_ICM42600_REG_GYRO_DATA_Z 0x0029
  213. #define INV_ICM42600_DATA_INVALID -32768
  214. #define INV_ICM42600_REG_INT_STATUS 0x002D
  215. #define INV_ICM42600_INT_STATUS_UI_FSYNC BIT(6)
  216. #define INV_ICM42600_INT_STATUS_PLL_RDY BIT(5)
  217. #define INV_ICM42600_INT_STATUS_RESET_DONE BIT(4)
  218. #define INV_ICM42600_INT_STATUS_DATA_RDY BIT(3)
  219. #define INV_ICM42600_INT_STATUS_FIFO_THS BIT(2)
  220. #define INV_ICM42600_INT_STATUS_FIFO_FULL BIT(1)
  221. #define INV_ICM42600_INT_STATUS_AGC_RDY BIT(0)
  222. /*
  223. * FIFO access registers
  224. * FIFO count is 16 bits (2 registers) big-endian
  225. * FIFO data is a continuous read register to read FIFO content
  226. */
  227. #define INV_ICM42600_REG_FIFO_COUNT 0x002E
  228. #define INV_ICM42600_REG_FIFO_DATA 0x0030
  229. #define INV_ICM42600_REG_SIGNAL_PATH_RESET 0x004B
  230. #define INV_ICM42600_SIGNAL_PATH_RESET_DMP_INIT_EN BIT(6)
  231. #define INV_ICM42600_SIGNAL_PATH_RESET_DMP_MEM_RESET BIT(5)
  232. #define INV_ICM42600_SIGNAL_PATH_RESET_RESET BIT(3)
  233. #define INV_ICM42600_SIGNAL_PATH_RESET_TMST_STROBE BIT(2)
  234. #define INV_ICM42600_SIGNAL_PATH_RESET_FIFO_FLUSH BIT(1)
  235. /* default configuration: all data big-endian and fifo count in bytes */
  236. #define INV_ICM42600_REG_INTF_CONFIG0 0x004C
  237. #define INV_ICM42600_INTF_CONFIG0_FIFO_HOLD_LAST_DATA BIT(7)
  238. #define INV_ICM42600_INTF_CONFIG0_FIFO_COUNT_REC BIT(6)
  239. #define INV_ICM42600_INTF_CONFIG0_FIFO_COUNT_ENDIAN BIT(5)
  240. #define INV_ICM42600_INTF_CONFIG0_SENSOR_DATA_ENDIAN BIT(4)
  241. #define INV_ICM42600_INTF_CONFIG0_UI_SIFS_CFG_MASK GENMASK(1, 0)
  242. #define INV_ICM42600_INTF_CONFIG0_UI_SIFS_CFG_SPI_DIS \
  243. FIELD_PREP(INV_ICM42600_INTF_CONFIG0_UI_SIFS_CFG_MASK, 2)
  244. #define INV_ICM42600_INTF_CONFIG0_UI_SIFS_CFG_I2C_DIS \
  245. FIELD_PREP(INV_ICM42600_INTF_CONFIG0_UI_SIFS_CFG_MASK, 3)
  246. #define INV_ICM42600_REG_INTF_CONFIG1 0x004D
  247. #define INV_ICM42600_INTF_CONFIG1_ACCEL_LP_CLK_RC BIT(3)
  248. #define INV_ICM42600_REG_PWR_MGMT0 0x004E
  249. #define INV_ICM42600_PWR_MGMT0_TEMP_DIS BIT(5)
  250. #define INV_ICM42600_PWR_MGMT0_IDLE BIT(4)
  251. #define INV_ICM42600_PWR_MGMT0_GYRO(_mode) \
  252. FIELD_PREP(GENMASK(3, 2), (_mode))
  253. #define INV_ICM42600_PWR_MGMT0_ACCEL(_mode) \
  254. FIELD_PREP(GENMASK(1, 0), (_mode))
  255. #define INV_ICM42600_REG_GYRO_CONFIG0 0x004F
  256. #define INV_ICM42600_GYRO_CONFIG0_FS(_fs) \
  257. FIELD_PREP(GENMASK(7, 5), (_fs))
  258. #define INV_ICM42600_GYRO_CONFIG0_ODR(_odr) \
  259. FIELD_PREP(GENMASK(3, 0), (_odr))
  260. #define INV_ICM42600_REG_ACCEL_CONFIG0 0x0050
  261. #define INV_ICM42600_ACCEL_CONFIG0_FS(_fs) \
  262. FIELD_PREP(GENMASK(7, 5), (_fs))
  263. #define INV_ICM42600_ACCEL_CONFIG0_ODR(_odr) \
  264. FIELD_PREP(GENMASK(3, 0), (_odr))
  265. #define INV_ICM42600_REG_GYRO_ACCEL_CONFIG0 0x0052
  266. #define INV_ICM42600_GYRO_ACCEL_CONFIG0_ACCEL_FILT(_f) \
  267. FIELD_PREP(GENMASK(7, 4), (_f))
  268. #define INV_ICM42600_GYRO_ACCEL_CONFIG0_GYRO_FILT(_f) \
  269. FIELD_PREP(GENMASK(3, 0), (_f))
  270. #define INV_ICM42600_REG_TMST_CONFIG 0x0054
  271. #define INV_ICM42600_TMST_CONFIG_MASK GENMASK(4, 0)
  272. #define INV_ICM42600_TMST_CONFIG_TMST_TO_REGS_EN BIT(4)
  273. #define INV_ICM42600_TMST_CONFIG_TMST_RES_16US BIT(3)
  274. #define INV_ICM42600_TMST_CONFIG_TMST_DELTA_EN BIT(2)
  275. #define INV_ICM42600_TMST_CONFIG_TMST_FSYNC_EN BIT(1)
  276. #define INV_ICM42600_TMST_CONFIG_TMST_EN BIT(0)
  277. #define INV_ICM42600_REG_FIFO_CONFIG1 0x005F
  278. #define INV_ICM42600_FIFO_CONFIG1_RESUME_PARTIAL_RD BIT(6)
  279. #define INV_ICM42600_FIFO_CONFIG1_WM_GT_TH BIT(5)
  280. #define INV_ICM42600_FIFO_CONFIG1_TMST_FSYNC_EN BIT(3)
  281. #define INV_ICM42600_FIFO_CONFIG1_TEMP_EN BIT(2)
  282. #define INV_ICM42600_FIFO_CONFIG1_GYRO_EN BIT(1)
  283. #define INV_ICM42600_FIFO_CONFIG1_ACCEL_EN BIT(0)
  284. /* FIFO watermark is 16 bits (2 registers wide) in little-endian */
  285. #define INV_ICM42600_REG_FIFO_WATERMARK 0x0060
  286. #define INV_ICM42600_FIFO_WATERMARK_VAL(_wm) \
  287. cpu_to_le16((_wm) & GENMASK(11, 0))
  288. /* FIFO is 2048 bytes, let 12 samples for reading latency */
  289. #define INV_ICM42600_FIFO_WATERMARK_MAX (2048 - 12 * 16)
  290. #define INV_ICM42600_REG_INT_CONFIG1 0x0064
  291. #define INV_ICM42600_INT_CONFIG1_TPULSE_DURATION BIT(6)
  292. #define INV_ICM42600_INT_CONFIG1_TDEASSERT_DISABLE BIT(5)
  293. #define INV_ICM42600_INT_CONFIG1_ASYNC_RESET BIT(4)
  294. #define INV_ICM42600_REG_INT_SOURCE0 0x0065
  295. #define INV_ICM42600_INT_SOURCE0_UI_FSYNC_INT1_EN BIT(6)
  296. #define INV_ICM42600_INT_SOURCE0_PLL_RDY_INT1_EN BIT(5)
  297. #define INV_ICM42600_INT_SOURCE0_RESET_DONE_INT1_EN BIT(4)
  298. #define INV_ICM42600_INT_SOURCE0_UI_DRDY_INT1_EN BIT(3)
  299. #define INV_ICM42600_INT_SOURCE0_FIFO_THS_INT1_EN BIT(2)
  300. #define INV_ICM42600_INT_SOURCE0_FIFO_FULL_INT1_EN BIT(1)
  301. #define INV_ICM42600_INT_SOURCE0_UI_AGC_RDY_INT1_EN BIT(0)
  302. #define INV_ICM42600_REG_WHOAMI 0x0075
  303. #define INV_ICM42600_WHOAMI_ICM42600 0x40
  304. #define INV_ICM42600_WHOAMI_ICM42602 0x41
  305. #define INV_ICM42600_WHOAMI_ICM42605 0x42
  306. #define INV_ICM42600_WHOAMI_ICM42686 0x44
  307. #define INV_ICM42600_WHOAMI_ICM42622 0x46
  308. #define INV_ICM42600_WHOAMI_ICM42688 0x47
  309. #define INV_ICM42600_WHOAMI_ICM42631 0x5C
  310. /* User bank 1 (MSB 0x10) */
  311. #define INV_ICM42600_REG_SENSOR_CONFIG0 0x1003
  312. #define INV_ICM42600_SENSOR_CONFIG0_ZG_DISABLE BIT(5)
  313. #define INV_ICM42600_SENSOR_CONFIG0_YG_DISABLE BIT(4)
  314. #define INV_ICM42600_SENSOR_CONFIG0_XG_DISABLE BIT(3)
  315. #define INV_ICM42600_SENSOR_CONFIG0_ZA_DISABLE BIT(2)
  316. #define INV_ICM42600_SENSOR_CONFIG0_YA_DISABLE BIT(1)
  317. #define INV_ICM42600_SENSOR_CONFIG0_XA_DISABLE BIT(0)
  318. /* Timestamp value is 20 bits (3 registers) in little-endian */
  319. #define INV_ICM42600_REG_TMSTVAL 0x1062
  320. #define INV_ICM42600_TMSTVAL_MASK GENMASK(19, 0)
  321. #define INV_ICM42600_REG_INTF_CONFIG4 0x107A
  322. #define INV_ICM42600_INTF_CONFIG4_I3C_BUS_ONLY BIT(6)
  323. #define INV_ICM42600_INTF_CONFIG4_SPI_AP_4WIRE BIT(1)
  324. #define INV_ICM42600_REG_INTF_CONFIG6 0x107C
  325. #define INV_ICM42600_INTF_CONFIG6_MASK GENMASK(4, 0)
  326. #define INV_ICM42600_INTF_CONFIG6_I3C_EN BIT(4)
  327. #define INV_ICM42600_INTF_CONFIG6_I3C_IBI_BYTE_EN BIT(3)
  328. #define INV_ICM42600_INTF_CONFIG6_I3C_IBI_EN BIT(2)
  329. #define INV_ICM42600_INTF_CONFIG6_I3C_DDR_EN BIT(1)
  330. #define INV_ICM42600_INTF_CONFIG6_I3C_SDR_EN BIT(0)
  331. /* User bank 4 (MSB 0x40) */
  332. #define INV_ICM42600_REG_INT_SOURCE8 0x404F
  333. #define INV_ICM42600_INT_SOURCE8_FSYNC_IBI_EN BIT(5)
  334. #define INV_ICM42600_INT_SOURCE8_PLL_RDY_IBI_EN BIT(4)
  335. #define INV_ICM42600_INT_SOURCE8_UI_DRDY_IBI_EN BIT(3)
  336. #define INV_ICM42600_INT_SOURCE8_FIFO_THS_IBI_EN BIT(2)
  337. #define INV_ICM42600_INT_SOURCE8_FIFO_FULL_IBI_EN BIT(1)
  338. #define INV_ICM42600_INT_SOURCE8_AGC_RDY_IBI_EN BIT(0)
  339. #define INV_ICM42600_REG_OFFSET_USER0 0x4077
  340. #define INV_ICM42600_REG_OFFSET_USER1 0x4078
  341. #define INV_ICM42600_REG_OFFSET_USER2 0x4079
  342. #define INV_ICM42600_REG_OFFSET_USER3 0x407A
  343. #define INV_ICM42600_REG_OFFSET_USER4 0x407B
  344. #define INV_ICM42600_REG_OFFSET_USER5 0x407C
  345. #define INV_ICM42600_REG_OFFSET_USER6 0x407D
  346. #define INV_ICM42600_REG_OFFSET_USER7 0x407E
  347. #define INV_ICM42600_REG_OFFSET_USER8 0x407F
  348. /* Sleep times required by the driver */
  349. #define INV_ICM42600_POWER_UP_TIME_MS 100
  350. #define INV_ICM42600_RESET_TIME_MS 1
  351. #define INV_ICM42600_ACCEL_STARTUP_TIME_MS 20
  352. #define INV_ICM42600_GYRO_STARTUP_TIME_MS 60
  353. #define INV_ICM42600_GYRO_STOP_TIME_MS 150
  354. #define INV_ICM42600_TEMP_STARTUP_TIME_MS 14
  355. #define INV_ICM42600_SUSPEND_DELAY_MS 2000
  356. typedef int (*inv_icm42600_bus_setup)(struct inv_icm42600_state *);
  357. extern const struct regmap_config inv_icm42600_regmap_config;
  358. extern const struct regmap_config inv_icm42600_spi_regmap_config;
  359. extern const struct dev_pm_ops inv_icm42600_pm_ops;
  360. const struct iio_mount_matrix *
  361. inv_icm42600_get_mount_matrix(const struct iio_dev *indio_dev,
  362. const struct iio_chan_spec *chan);
  363. uint32_t inv_icm42600_odr_to_period(enum inv_icm42600_odr odr);
  364. int inv_icm42600_set_accel_conf(struct inv_icm42600_state *st,
  365. struct inv_icm42600_sensor_conf *conf,
  366. unsigned int *sleep_ms);
  367. int inv_icm42600_set_gyro_conf(struct inv_icm42600_state *st,
  368. struct inv_icm42600_sensor_conf *conf,
  369. unsigned int *sleep_ms);
  370. int inv_icm42600_set_temp_conf(struct inv_icm42600_state *st, bool enable,
  371. unsigned int *sleep_ms);
  372. int inv_icm42600_debugfs_reg(struct iio_dev *indio_dev, unsigned int reg,
  373. unsigned int writeval, unsigned int *readval);
  374. int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
  375. inv_icm42600_bus_setup bus_setup);
  376. struct iio_dev *inv_icm42600_gyro_init(struct inv_icm42600_state *st);
  377. int inv_icm42600_gyro_parse_fifo(struct iio_dev *indio_dev);
  378. struct iio_dev *inv_icm42600_accel_init(struct inv_icm42600_state *st);
  379. int inv_icm42600_accel_parse_fifo(struct iio_dev *indio_dev);
  380. #endif