/* SPDX-License-Identifier: GPL-2.0 */ #ifndef ICM40605_H_ #define ICM40605_H_ #include #include #include #include #include #include #include #include #include #include #include extern const struct regmap_config icm40605_regmap_config; extern const struct dev_pm_ops inv_icm42600_pm_ops; #define ICM40605_POWER_UP_TIME 100 /** BANK0 */ #define MPUREG_CHIP_CONFIG_REG 0x11 #define BIT_SPI_MODE 0x10 #define BIT_SOFT_RESET_CHIP_CONFIG 0x01 #define MPUREG_DRIVE_CONFIG_REG 0x13 #define BIT_PADS_SLEW_TRIM_D2A 0x07 #define BIT_SPI_SPEED_5M 0x03 #define BIT_SPI_SPEED_17M 0x05 #define MPUREG_INT_CONFIG_REG 0x14 #define BIT_INT2_MODE 0x20 #define BIT_INT2_DRIVE_CIRCUIT 0x10 #define BIT_INT2_POLARITY 0x08 #define BIT_INT1_MODE 0x04 #define BIT_INT1_DRIVE_CIRCUIT 0x02 #define BIT_INT1_POLARITY 0x01 #define BIT_ONLY_INT1_ACTIVE_HIGH 0x1B #define BIT_ONLY_INT1_ACTIVE_LOW 0x1A #define MPUREG_FIFO_CONFIG_REG 0x16 #define BIT_FIFO_MODE_CTRL_MASK ((0x03)<<6) #define BIT_FIFO_MODE_CTRL_BYPASS ((0x00)<<6) #define BIT_FIFO_MODE_CTRL_STREAM ((0x01)<<6) #define BIT_FIFO_MODE_CTRL_SNAPSHOT ((0x02)<<6) #define MPUREG_TEMP_DATA0_UI 0x1D #define MPUREG_ACCEL_DATA_X0_UI 0x1F #define MPUREG_GYRO_DATA_X0_UI 0x25 #define MPUREG_TMST_FSYNC1 0x2B #define MPUREG_INT_STATUS 0x2D #define BIT_STATUS_UI_FSYNC 0x40 #define BIT_STATUS_PLL_RDY 0x20 #define BIT_STATUS_RESET_DONE 0x10 #define BIT_STATUS_DRDY 0x08 #define BIT_STATUS_FIFO_THS 0x04 #define BIT_STATUS_FIFO_FULL 0x02 #define BIT_STATUS_AGC_RDY 0x01 #define MPUREG_FIFO_BYTE_COUNT1_REG 0x2E #define MPUREG_FIFO_BYTE_COUNT2_REG 0x2F #define MPUREG_FIFO_DATA_REG 0x30 #define MPUREG_SIGNAL_PATH_RESET_REG 0x4B #define BIT_ABORT_AND_RESET 0x08 #define BIT_TMST_STROBE 0x04 #define BIT_FIFO_FLUSH 0x02 #define BIT_TEMP_RST 0x01 #define MPUREG_INTF_CONFIG0_REG 0x4C #define BIT_FIFO_SREG_INVALID_IND_DIS 0x80 #define BIT_FIFO_COUNT_REC 0x40 #define BIT_FIFO_COUNT_ENDIAN 0x20 #define BIT_SENSOR_DATA_ENDIAN 0x10 #define BIT_SPI_MODE_OIS2 0x08 #define BIT_SPI_MODE_OIS1 0x04 #define BIT_SPI_I2C_SEL_MASK (0x03) // follow 3 not defined in ref driver, but in datasheet #define BIT_SEL_SPI_DISABLE 0x02 #define BIT_SEL_I2C_DISABLE 0x03 #define MPUREG_INTF_CONFIG1_REG 0x4D #define BITS_GYRO_AFSR_MODE_MASK (0xC0) #define BITS_ACCEL_AFSR_MODE_MASK (0x30) #define BITS_ACCEL_LP_CLK_SEL 0x08 #define BITS_RTC_MODE 0x04 #define BITS_CLKSEL_MASK (0x03) #define MPUREG_PWR_MGMT_0_REG 0x4E #define BIT_TEMP_DIS 0x20 #define BIT_IDLE 0x10 #define BIT_GYRO_MODE_MASK ((0x03)<<2) #define BIT_GYRO_MODE_OFF ((0x00)<<2) #define BIT_GYRO_MODE_STANDBY ((0x01)<<2) #define BIT_GYRO_MODE_LP ((0x02)<<2) #define BIT_GYRO_MODE_LN ((0x03)<<2) #define BIT_ACCEL_MODE_MASK ((0x03)<<0) #define BIT_ACCEL_MODE_OFF 0x00 #define BIT_ACCEL_MODE_LP 0x02 #define BIT_ACCEL_MODE_LN 0x03 #define SET_LPM 0 #define SET_LNM 1 #define MPUREG_GYRO_CONFIG0_REG 0x4F #define BIT_GYRO_UI_FS_SEL_SHIFT 5 #define BIT_GYRO_UI_FS_SEL_MASK ((0x07)<