drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h

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

File Facts

System
Linux kernel
Corpus path
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h
Extension
.h
Size
16688 bytes
Lines
582
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 st_lsm6dsx_reg {
	u8 addr;
	u8 mask;
};

struct st_lsm6dsx_sensor;
struct st_lsm6dsx_hw;

struct st_lsm6dsx_odr {
	u32 milli_hz;
	u8 val;
};

#define ST_LSM6DSX_ODR_LIST_SIZE	8
struct st_lsm6dsx_odr_table_entry {
	struct st_lsm6dsx_reg reg;

	struct st_lsm6dsx_odr odr_avl[ST_LSM6DSX_ODR_LIST_SIZE];
	int odr_len;
};

struct st_lsm6dsx_samples_to_discard {
	struct {
		u32 milli_hz;
		u16 samples;
	} val[ST_LSM6DSX_ODR_LIST_SIZE];
};

struct st_lsm6dsx_fs {
	u32 gain;
	u8 val;
};

#define ST_LSM6DSX_FS_LIST_SIZE		4
struct st_lsm6dsx_fs_table_entry {
	struct st_lsm6dsx_reg reg;

	struct st_lsm6dsx_fs fs_avl[ST_LSM6DSX_FS_LIST_SIZE];
	int fs_len;
};

/**
 * struct st_lsm6dsx_fifo_ops - ST IMU FIFO settings
 * @update_fifo: Update FIFO configuration callback.
 * @read_fifo: Read FIFO callback.
 * @fifo_th: FIFO threshold register info (addr + mask).
 * @fifo_diff: FIFO diff status register info (addr + mask).
 * @max_size: Sensor max fifo length in FIFO words.
 * @th_wl: FIFO threshold word length.
 */
struct st_lsm6dsx_fifo_ops {
	int (*update_fifo)(struct st_lsm6dsx_sensor *sensor, bool enable);
	int (*read_fifo)(struct st_lsm6dsx_hw *hw);
	struct {
		u8 addr;
		u16 mask;
	} fifo_th;
	struct {
		u8 addr;
		u16 mask;
	} fifo_diff;
	u16 max_size;
	u8 th_wl;
};

/**
 * struct st_lsm6dsx_hw_ts_settings - ST IMU hw timer settings
 * @timer_en: Hw timer enable register info (addr + mask).
 * @hr_timer: Hw timer resolution register info (addr + mask).
 * @fifo_en: Hw timer FIFO enable register info (addr + mask).
 * @decimator: Hw timer FIFO decimator register info (addr + mask).
 * @freq_fine: Difference in % of ODR with respect to the typical.
 * @ts_sensitivity: Nominal timestamp sensitivity.
 * @ts_trim_coeff: Coefficient for calculating the calibrated timestamp gain.
 *                 This coefficient comes into play when linearizing the formula
 *                 used to calculate the calibrated timestamp (please see the
 *                 relevant formula in the AN for the specific IMU).
 *                 For example, in the case of LSM6DSO we have:
 *
 *                  1 / (1 + x) ~= 1 - x (Taylor’s Series)
 *                  ttrim[s] = 1 / (40000 * (1 + 0.0015 * val)) (from AN5192)
 *                  ttrim[ns] ~= 25000 - 37.5 * val
 *                  ttrim[ns] ~= 25000 - (37500 * val) / 1000
 *
 *                  so, replacing ts_sensitivity = 25000 and
 *                  ts_trim_coeff = 37500
 *
 *                  ttrim[ns] ~= ts_sensitivity - (ts_trim_coeff * val) / 1000
 */
struct st_lsm6dsx_hw_ts_settings {

Annotation

Implementation Notes