drivers/iio/imu/inv_icm42600/inv_icm42600.h

Source file repositories/reference/linux-study-clean/drivers/iio/imu/inv_icm42600/inv_icm42600.h

File Facts

System
Linux kernel
Corpus path
drivers/iio/imu/inv_icm42600/inv_icm42600.h
Extension
.h
Size
17056 bytes
Lines
488
Domain
Driver Families
Bucket
drivers/iio
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct inv_icm42600_sensor_conf {
	int mode;
	int fs;
	int odr;
	int filter;
};
#define INV_ICM42600_SENSOR_CONF_INIT		{-1, -1, -1, -1}

struct inv_icm42600_conf {
	struct inv_icm42600_sensor_conf gyro;
	struct inv_icm42600_sensor_conf accel;
	bool temp_en;
};

struct inv_icm42600_suspended {
	enum inv_icm42600_sensor_mode gyro;
	enum inv_icm42600_sensor_mode accel;
	bool temp;
};

struct inv_icm42600_apex {
	unsigned int on;
	struct {
		u64 value;
		bool enable;
	} wom;
};

/**
 *  struct inv_icm42600_state - driver state variables
 *  @lock:		lock for serializing multiple registers access.
 *  @chip:		chip identifier.
 *  @name:		chip name.
 *  @map:		regmap pointer.
 *  @vdd_supply:	VDD voltage regulator for the chip.
 *  @vddio_supply:	I/O voltage regulator for the chip.
 *  @irq:		chip irq, required to enable/disable and set wakeup
 *  @orientation:	sensor chip orientation relative to main hardware.
 *  @conf:		chip sensors configurations.
 *  @suspended:		suspended sensors configuration.
 *  @indio_gyro:	gyroscope IIO device.
 *  @indio_accel:	accelerometer IIO device.
 *  @timestamp:		interrupt timestamps.
 *  @apex:		APEX (Advanced Pedometer and Event detection) management
 *  @fifo:		FIFO management structure.
 *  @buffer:		data transfer buffer aligned for DMA.
 */
struct inv_icm42600_state {
	struct mutex lock;
	enum inv_icm42600_chip chip;
	const char *name;
	struct regmap *map;
	struct regulator *vddio_supply;
	int irq;
	struct iio_mount_matrix orientation;
	struct inv_icm42600_conf conf;
	struct inv_icm42600_suspended suspended;
	struct iio_dev *indio_gyro;
	struct iio_dev *indio_accel;
	struct {
		s64 gyro;
		s64 accel;
	} timestamp;
	struct inv_icm42600_apex apex;
	struct inv_icm42600_fifo fifo;
	u8 buffer[3] __aligned(IIO_DMA_MINALIGN);
};


/**
 * struct inv_icm42600_sensor_state - sensor state variables
 * @scales:		table of scales.
 * @scales_len:		length (nb of items) of the scales table.
 * @power_mode:		sensor requested power mode (for common frequencies)
 * @filter:		sensor filter.
 * @ts:			timestamp module states.
 */
struct inv_icm42600_sensor_state {
	const int *scales;
	size_t scales_len;
	enum inv_icm42600_sensor_mode power_mode;
	enum inv_icm42600_filter filter;
	struct inv_sensors_timestamp ts;
};

/* Virtual register addresses: @bank on MSB (4 upper bits), @address on LSB */

/* Bank selection register, available in all banks */
#define INV_ICM42600_REG_BANK_SEL			0x76
#define INV_ICM42600_BANK_SEL_MASK			GENMASK(2, 0)

Annotation

Implementation Notes