drivers/iio/temperature/mlx90632.c
Source file repositories/reference/linux-study-clean/drivers/iio/temperature/mlx90632.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/temperature/mlx90632.c- Extension
.c- Size
- 38573 bytes
- Lines
- 1345
- 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.
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/delay.hlinux/device.hlinux/err.hlinux/gpio/consumer.hlinux/i2c.hlinux/iopoll.hlinux/jiffies.hlinux/kernel.hlinux/limits.hlinux/mod_devicetable.hlinux/module.hlinux/math64.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/iio/iio.hlinux/iio/sysfs.h
Detected Declarations
struct mlx90632_datafunction mlx90632_pwr_set_sleep_stepfunction mlx90632_pwr_continuousfunction mlx90632_reset_delayfunction mlx90632_get_measurement_timefunction mlx90632_calculate_dataset_ready_timefunction mlx90632_perform_measurementfunction mlx90632_perform_measurement_burstfunction mlx90632_set_meas_typefunction mlx90632_channel_new_selectfunction mlx90632_read_ambient_rawfunction mlx90632_read_object_rawfunction mlx90632_read_all_channelfunction mlx90632_read_ambient_raw_extendedfunction mlx90632_read_object_raw_extendedfunction mlx90632_read_all_channel_extendedfunction mlx90632_read_ee_registerfunction mlx90632_preprocess_temp_ambfunction mlx90632_preprocess_temp_objfunction mlx90632_preprocess_temp_obj_extendedfunction mlx90632_calc_temp_ambientfunction mlx90632_calc_temp_object_iterationfunction mlx90632_calc_ta4function mlx90632_calc_temp_objectfunction mlx90632_calc_temp_object_extendedfunction mlx90632_calc_object_dsp105function mlx90632_calc_ambient_dsp105function mlx90632_get_refresh_ratefunction mlx90632_pm_interraction_wakeupfunction msecs_to_jiffiesfunction mlx90632_read_rawfunction mlx90632_write_rawfunction mlx90632_read_availfunction mlx90632_sleepfunction mlx90632_suspendfunction mlx90632_wakeupfunction mlx90632_disable_regulatorfunction mlx90632_enable_regulatorfunction mlx90632_probefunction mlx90632_pm_suspendfunction mlx90632_pm_resumefunction mlx90632_pm_runtime_suspend
Annotated Snippet
struct mlx90632_data {
struct i2c_client *client;
struct mutex lock;
struct regmap *regmap;
u16 emissivity;
u8 mtyp;
u32 object_ambient_temperature;
struct regulator *regulator;
int powerstatus;
unsigned long interaction_ts;
};
static const struct regmap_range mlx90632_volatile_reg_range[] = {
regmap_reg_range(MLX90632_REG_I2C_ADDR, MLX90632_REG_CONTROL),
regmap_reg_range(MLX90632_REG_I2C_CMD, MLX90632_REG_I2C_CMD),
regmap_reg_range(MLX90632_REG_STATUS, MLX90632_REG_STATUS),
regmap_reg_range(MLX90632_RAM_1(0),
MLX90632_RAM_3(MLX90632_MAX_MEAS_NUM)),
};
static const struct regmap_access_table mlx90632_volatile_regs_tbl = {
.yes_ranges = mlx90632_volatile_reg_range,
.n_yes_ranges = ARRAY_SIZE(mlx90632_volatile_reg_range),
};
static const struct regmap_range mlx90632_read_reg_range[] = {
regmap_reg_range(MLX90632_EE_VERSION, MLX90632_EE_Ka),
regmap_reg_range(MLX90632_EE_CTRL, MLX90632_EE_I2C_ADDR),
regmap_reg_range(MLX90632_EE_Ha, MLX90632_EE_Hb),
regmap_reg_range(MLX90632_EE_MEDICAL_MEAS1, MLX90632_EE_MEDICAL_MEAS2),
regmap_reg_range(MLX90632_EE_EXTENDED_MEAS1, MLX90632_EE_EXTENDED_MEAS3),
regmap_reg_range(MLX90632_REG_I2C_ADDR, MLX90632_REG_CONTROL),
regmap_reg_range(MLX90632_REG_I2C_CMD, MLX90632_REG_I2C_CMD),
regmap_reg_range(MLX90632_REG_STATUS, MLX90632_REG_STATUS),
regmap_reg_range(MLX90632_RAM_1(0),
MLX90632_RAM_3(MLX90632_MAX_MEAS_NUM)),
};
static const struct regmap_access_table mlx90632_readable_regs_tbl = {
.yes_ranges = mlx90632_read_reg_range,
.n_yes_ranges = ARRAY_SIZE(mlx90632_read_reg_range),
};
static const struct regmap_range mlx90632_no_write_reg_range[] = {
regmap_reg_range(MLX90632_EE_VERSION, MLX90632_EE_Ka),
regmap_reg_range(MLX90632_RAM_1(0),
MLX90632_RAM_3(MLX90632_MAX_MEAS_NUM)),
};
static const struct regmap_access_table mlx90632_writeable_regs_tbl = {
.no_ranges = mlx90632_no_write_reg_range,
.n_no_ranges = ARRAY_SIZE(mlx90632_no_write_reg_range),
};
static const struct regmap_config mlx90632_regmap = {
.reg_bits = 16,
.val_bits = 16,
.volatile_table = &mlx90632_volatile_regs_tbl,
.rd_table = &mlx90632_readable_regs_tbl,
.wr_table = &mlx90632_writeable_regs_tbl,
.use_single_read = true,
.use_single_write = true,
.reg_format_endian = REGMAP_ENDIAN_BIG,
.val_format_endian = REGMAP_ENDIAN_BIG,
.cache_type = REGCACHE_RBTREE,
};
static int mlx90632_pwr_set_sleep_step(struct regmap *regmap)
{
struct mlx90632_data *data =
iio_priv(dev_get_drvdata(regmap_get_device(regmap)));
int ret;
if (data->powerstatus == MLX90632_PWR_STATUS_SLEEP_STEP)
return 0;
ret = regmap_write_bits(regmap, MLX90632_REG_CONTROL, MLX90632_CFG_PWR_MASK,
MLX90632_PWR_STATUS_SLEEP_STEP);
if (ret < 0)
return ret;
data->powerstatus = MLX90632_PWR_STATUS_SLEEP_STEP;
return 0;
}
static int mlx90632_pwr_continuous(struct regmap *regmap)
{
struct mlx90632_data *data =
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/delay.h`, `linux/device.h`, `linux/err.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/iopoll.h`, `linux/jiffies.h`.
- Detected declarations: `struct mlx90632_data`, `function mlx90632_pwr_set_sleep_step`, `function mlx90632_pwr_continuous`, `function mlx90632_reset_delay`, `function mlx90632_get_measurement_time`, `function mlx90632_calculate_dataset_ready_time`, `function mlx90632_perform_measurement`, `function mlx90632_perform_measurement_burst`, `function mlx90632_set_meas_type`, `function mlx90632_channel_new_select`.
- Atlas domain: Driver Families / drivers/iio.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.