drivers/iio/temperature/mlx90635.c

Source file repositories/reference/linux-study-clean/drivers/iio/temperature/mlx90635.c

File Facts

System
Linux kernel
Corpus path
drivers/iio/temperature/mlx90635.c
Extension
.c
Size
30465 bytes
Lines
1095
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 mlx90635_data {
	struct i2c_client *client;
	struct mutex lock;
	struct regmap *regmap;
	struct regmap *regmap_ee;
	u16 emissivity;
	struct regulator *regulator;
	int powerstatus;
	unsigned long interaction_ts;
};

static const struct regmap_range mlx90635_volatile_reg_range[] = {
	regmap_reg_range(MLX90635_REG_STATUS, MLX90635_REG_STATUS),
	regmap_reg_range(MLX90635_RESULT_1, MLX90635_RESULT_5),
	regmap_reg_range(MLX90635_REG_EE, MLX90635_REG_EE),
	regmap_reg_range(MLX90635_REG_CMD, MLX90635_REG_CMD),
	regmap_reg_range(MLX90635_REG_CTRL1, MLX90635_REG_CTRL2),
};

static const struct regmap_access_table mlx90635_volatile_regs_tbl = {
	.yes_ranges = mlx90635_volatile_reg_range,
	.n_yes_ranges = ARRAY_SIZE(mlx90635_volatile_reg_range),
};

static const struct regmap_range mlx90635_read_reg_range[] = {
	regmap_reg_range(MLX90635_REG_STATUS, MLX90635_REG_STATUS),
	regmap_reg_range(MLX90635_RESULT_1, MLX90635_RESULT_5),
	regmap_reg_range(MLX90635_REG_EE, MLX90635_REG_EE),
	regmap_reg_range(MLX90635_REG_CMD, MLX90635_REG_CMD),
	regmap_reg_range(MLX90635_REG_CTRL1, MLX90635_REG_CTRL2),
};

static const struct regmap_access_table mlx90635_readable_regs_tbl = {
	.yes_ranges = mlx90635_read_reg_range,
	.n_yes_ranges = ARRAY_SIZE(mlx90635_read_reg_range),
};

static const struct regmap_range mlx90635_no_write_reg_range[] = {
	regmap_reg_range(MLX90635_RESULT_1, MLX90635_RESULT_5),
};

static const struct regmap_access_table mlx90635_writeable_regs_tbl = {
	.no_ranges = mlx90635_no_write_reg_range,
	.n_no_ranges = ARRAY_SIZE(mlx90635_no_write_reg_range),
};

static const struct regmap_config mlx90635_regmap = {
	.name = "mlx90635-registers",
	.reg_stride = 1,
	.reg_bits = 16,
	.val_bits = 16,

	.volatile_table = &mlx90635_volatile_regs_tbl,
	.rd_table = &mlx90635_readable_regs_tbl,
	.wr_table = &mlx90635_writeable_regs_tbl,

	.use_single_read = true,
	.use_single_write = true,
	.can_multi_write = false,
	.reg_format_endian = REGMAP_ENDIAN_BIG,
	.val_format_endian = REGMAP_ENDIAN_BIG,
	.cache_type = REGCACHE_RBTREE,
};

static const struct regmap_range mlx90635_read_ee_range[] = {
	regmap_reg_range(MLX90635_EE_I2C_CFG, MLX90635_EE_CTRL2),
	regmap_reg_range(MLX90635_EE_Ha, MLX90635_EE_Gb),
};

static const struct regmap_access_table mlx90635_readable_ees_tbl = {
	.yes_ranges = mlx90635_read_ee_range,
	.n_yes_ranges = ARRAY_SIZE(mlx90635_read_ee_range),
};

static const struct regmap_range mlx90635_no_write_ee_range[] = {
	regmap_reg_range(MLX90635_ADDR_EEPROM, MLX90635_EE_Gb),
};

static const struct regmap_access_table mlx90635_writeable_ees_tbl = {
	.no_ranges = mlx90635_no_write_ee_range,
	.n_no_ranges = ARRAY_SIZE(mlx90635_no_write_ee_range),
};

static const struct regmap_config mlx90635_regmap_ee = {
	.name = "mlx90635-eeprom",
	.reg_stride = 1,
	.reg_bits = 16,
	.val_bits = 16,

	.volatile_table = NULL,

Annotation

Implementation Notes