drivers/iio/common/ms_sensors/ms_sensors_i2c.c
Source file repositories/reference/linux-study-clean/drivers/iio/common/ms_sensors/ms_sensors_i2c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/common/ms_sensors/ms_sensors_i2c.c- Extension
.c- Size
- 18416 bytes
- Lines
- 698
- Domain
- Driver Families
- Bucket
- drivers/iio
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/module.hlinux/iio/iio.hlinux/device.hlinux/delay.hms_sensors_i2c.h
Detected Declarations
function ms_sensors_resetfunction ms_sensors_read_prom_wordfunction ms_sensors_convert_and_readfunction ms_sensors_crc_validfunction ms_sensors_read_serialfunction ms_sensors_read_config_regfunction ms_sensors_write_resolutionfunction ms_sensors_show_battery_lowfunction ms_sensors_show_heaterfunction ms_sensors_write_heaterfunction ms_sensors_ht_read_temperaturefunction ms_sensors_ht_read_humidityfunction ms_sensors_tp_crc4function ms_sensors_tp_crc_valid_112function ms_sensors_tp_crc_valid_128function ms_sensors_tp_read_promfunction ms_sensors_read_temp_and_pressure
Annotated Snippet
if (temp < -1500) {
s64 tmp = (s64)temp + 1500;
off2 += 17 * tmp * tmp;
sens2 += 9 * tmp * tmp;
}
} else {
t2 = (5 * ((s64)dt * (s64)dt)) >> 38;
off2 = 0;
sens2 = 0;
}
/* OFF = OFF_T1 + TCO * dT */
off = (((s64)prom[2]) << 17) + ((((s64)prom[4]) * (s64)dt) >> 6);
off -= off2;
/* Sensitivity at actual temperature = SENS_T1 + TCS * dT */
sens = (((s64)prom[1]) << 16) + (((s64)prom[3] * dt) >> 7);
sens -= sens2;
/* Temperature compensated pressure = D1 * SENS - OFF */
*temperature = (temp - t2) * 10;
*pressure = (u32)(((((s64)p_adc * sens) >> 21) - off) >> 15);
return 0;
}
EXPORT_SYMBOL_NS(ms_sensors_read_temp_and_pressure, "IIO_MEAS_SPEC_SENSORS");
MODULE_DESCRIPTION("Measurement-Specialties common i2c driver");
MODULE_AUTHOR("William Markezana <william.markezana@meas-spec.com>");
MODULE_AUTHOR("Ludovic Tancerel <ludovic.tancerel@maplehightech.com>");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/module.h`, `linux/iio/iio.h`, `linux/device.h`, `linux/delay.h`, `ms_sensors_i2c.h`.
- Detected declarations: `function ms_sensors_reset`, `function ms_sensors_read_prom_word`, `function ms_sensors_convert_and_read`, `function ms_sensors_crc_valid`, `function ms_sensors_read_serial`, `function ms_sensors_read_config_reg`, `function ms_sensors_write_resolution`, `function ms_sensors_show_battery_low`, `function ms_sensors_show_heater`, `function ms_sensors_write_heater`.
- Atlas domain: Driver Families / drivers/iio.
- Implementation status: integration 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.