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.

Dependency Surface

Detected Declarations

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

Implementation Notes