drivers/iio/temperature/ltc2983.c
Source file repositories/reference/linux-study-clean/drivers/iio/temperature/ltc2983.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/temperature/ltc2983.c- Extension
.c- Size
- 49860 bytes
- Lines
- 1695
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/completion.hlinux/device.hlinux/err.hlinux/errno.hlinux/kernel.hlinux/iio/iio.hlinux/interrupt.hlinux/list.hlinux/mod_devicetable.hlinux/module.hlinux/property.hlinux/regmap.hlinux/regulator/consumer.hlinux/spi/spi.hasm/byteorder.hlinux/unaligned.h
Detected Declarations
struct ltc2983_chip_infostruct ltc2983_datastruct ltc2983_sensorstruct ltc2983_custom_sensorstruct ltc2983_thermocouplestruct ltc2983_rtdstruct ltc2983_thermistorstruct ltc2983_diodestruct ltc2983_rsensestruct ltc2983_adcstruct ltc2983_tempfunction __convert_to_rawfunction __convert_to_raw_signfunction __ltc2983_fault_handlerfunction __ltc2983_chan_assign_commonfunction __ltc2983_chan_custom_sensor_assignfunction donefunction __ltc2983_custom_sensor_newfunction ltc2983_thermocouple_fault_handlerfunction ltc2983_common_fault_handlerfunction ltc2983_thermocouple_assign_chanfunction ltc2983_rtd_assign_chanfunction ltc2983_thermistor_assign_chanfunction ltc2983_diode_assign_chanfunction ltc2983_r_sense_assign_chanfunction ltc2983_adc_assign_chanfunction ltc2983_temp_assign_chanfunction ltc2983_thermocouple_newfunction ltc2983_rtd_newfunction ltc2983_thermistor_newfunction ltc2983_diode_newfunction ltc2983_chan_readfunction ltc2983_read_rawfunction ltc2983_reg_accessfunction ltc2983_irq_handlerfunction ltc2983_parse_fwfunction ltc2983_eeprom_cmdfunction ltc2983_setupfunction ltc2983_probefunction ltc2983_resumefunction ltc2983_suspend
Annotated Snippet
struct ltc2983_chip_info {
const char *name;
unsigned int max_channels_nr;
bool has_temp;
bool has_eeprom;
};
struct ltc2983_data {
const struct ltc2983_chip_info *info;
struct regmap *regmap;
struct spi_device *spi;
struct mutex lock;
struct completion completion;
struct iio_chan_spec *iio_chan;
struct ltc2983_sensor **sensors;
u32 mux_delay_config;
u32 filter_notch_freq;
u16 custom_table_size;
u8 num_channels;
u8 iio_channels;
/*
* DMA (thus cache coherency maintenance) may require the
* transfer buffers to live in their own cache lines.
* Holds the converted temperature
*/
__be32 temp __aligned(IIO_DMA_MINALIGN);
__be32 chan_val;
__be32 eeprom_key;
};
struct ltc2983_sensor {
int (*fault_handler)(const struct ltc2983_data *st, const u32 result);
int (*assign_chan)(struct ltc2983_data *st,
const struct ltc2983_sensor *sensor);
/* specifies the sensor channel */
u32 chan;
/* sensor type */
u32 type;
};
struct ltc2983_custom_sensor {
/* raw table sensor data */
void *table;
size_t size;
/* address offset */
s8 offset;
bool is_steinhart;
};
struct ltc2983_thermocouple {
struct ltc2983_sensor sensor;
struct ltc2983_custom_sensor *custom;
u32 sensor_config;
u32 cold_junction_chan;
};
struct ltc2983_rtd {
struct ltc2983_sensor sensor;
struct ltc2983_custom_sensor *custom;
u32 sensor_config;
u32 r_sense_chan;
u32 excitation_current;
u32 rtd_curve;
};
struct ltc2983_thermistor {
struct ltc2983_sensor sensor;
struct ltc2983_custom_sensor *custom;
u32 sensor_config;
u32 r_sense_chan;
u32 excitation_current;
};
struct ltc2983_diode {
struct ltc2983_sensor sensor;
u32 sensor_config;
u32 excitation_current;
u32 ideal_factor_value;
};
struct ltc2983_rsense {
struct ltc2983_sensor sensor;
u32 r_sense_val;
};
struct ltc2983_adc {
struct ltc2983_sensor sensor;
bool single_ended;
};
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/completion.h`, `linux/device.h`, `linux/err.h`, `linux/errno.h`, `linux/kernel.h`, `linux/iio/iio.h`, `linux/interrupt.h`.
- Detected declarations: `struct ltc2983_chip_info`, `struct ltc2983_data`, `struct ltc2983_sensor`, `struct ltc2983_custom_sensor`, `struct ltc2983_thermocouple`, `struct ltc2983_rtd`, `struct ltc2983_thermistor`, `struct ltc2983_diode`, `struct ltc2983_rsense`, `struct ltc2983_adc`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.