drivers/iio/addac/ad74115.c
Source file repositories/reference/linux-study-clean/drivers/iio/addac/ad74115.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/addac/ad74115.c- Extension
.c- Size
- 51604 bytes
- Lines
- 1931
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/bitops.hlinux/crc8.hlinux/device.hlinux/gpio/driver.hlinux/interrupt.hlinux/module.hlinux/regmap.hlinux/regulator/consumer.hlinux/spi/spi.hlinux/units.hlinux/unaligned.hlinux/iio/buffer.hlinux/iio/iio.hlinux/iio/trigger.hlinux/iio/trigger_consumer.hlinux/iio/triggered_buffer.h
Detected Declarations
struct ad74115_channelsstruct ad74115_statestruct ad74115_fw_propenum ad74115_dac_chenum ad74115_adc_chenum ad74115_ch_funcenum ad74115_adc_rangeenum ad74115_adc_conv_seqenum ad74115_din_threshold_modeenum ad74115_slew_modeenum ad74115_slew_stepenum ad74115_slew_rateenum ad74115_gpio_configenum ad74115_gpio_modefunction _ad74115_find_tbl_indexfunction ad74115_crcfunction ad74115_format_reg_writefunction ad74115_reg_writefunction ad74115_crc_checkfunction ad74115_reg_readfunction ad74115_gpio_config_setfunction ad74115_gpio_init_valid_maskfunction ad74115_gpio_get_directionfunction ad74115_gpio_direction_inputfunction ad74115_gpio_direction_outputfunction ad74115_gpio_getfunction ad74115_gpio_setfunction ad74115_set_comp_debouncefunction ad74115_comp_gpio_get_directionfunction ad74115_comp_gpio_set_configfunction ad74115_comp_gpio_getfunction ad74115_trigger_handlerfunction ad74115_adc_data_interruptfunction ad74115_set_adc_ch_enfunction ad74115_set_adc_conv_seqfunction ad74115_update_scan_modefunction for_each_clear_bitfunction ad74115_buffer_postenablefunction ad74115_buffer_predisablefunction ad74115_get_adc_ratefunction _ad74115_get_adc_codefunction ad74115_get_adc_codefunction ad74115_adc_code_to_resistancefunction ad74115_set_dac_codefunction ad74115_get_dac_codefunction ad74115_set_adc_ratefunction ad74115_get_dac_ratefunction ad74115_set_dac_rate
Annotated Snippet
struct ad74115_channels {
const struct iio_chan_spec *channels;
unsigned int num_channels;
};
struct ad74115_state {
struct spi_device *spi;
struct regmap *regmap;
struct iio_trigger *trig;
/*
* Synchronize consecutive operations when doing a one-shot
* conversion and when updating the ADC samples SPI message.
*/
struct mutex lock;
struct gpio_chip gc;
struct gpio_chip comp_gc;
int irq;
unsigned int avdd_mv;
unsigned long gpio_valid_mask;
bool dac_bipolar;
bool dac_hart_slew;
bool rtd_mode_4_wire;
enum ad74115_ch_func ch_func;
enum ad74115_din_threshold_mode din_threshold_mode;
struct completion adc_data_completion;
struct spi_message adc_samples_msg;
struct spi_transfer adc_samples_xfer[AD74115_ADC_CH_NUM + 1];
/*
* DMA (thus cache coherency maintenance) requires the
* transfer buffers to live in their own cache lines.
*/
u8 reg_tx_buf[AD74115_FRAME_SIZE] __aligned(IIO_DMA_MINALIGN);
u8 reg_rx_buf[AD74115_FRAME_SIZE];
u8 adc_samples_tx_buf[AD74115_FRAME_SIZE * AD74115_ADC_CH_NUM];
u8 adc_samples_rx_buf[AD74115_FRAME_SIZE * AD74115_ADC_CH_NUM];
};
struct ad74115_fw_prop {
const char *name;
bool is_boolean;
bool negate;
unsigned int max;
unsigned int reg;
unsigned int mask;
const unsigned int *lookup_tbl;
unsigned int lookup_tbl_len;
};
#define AD74115_FW_PROP(_name, _max, _reg, _mask) \
{ \
.name = (_name), \
.max = (_max), \
.reg = (_reg), \
.mask = (_mask), \
}
#define AD74115_FW_PROP_TBL(_name, _tbl, _reg, _mask) \
{ \
.name = (_name), \
.reg = (_reg), \
.mask = (_mask), \
.lookup_tbl = (_tbl), \
.lookup_tbl_len = ARRAY_SIZE(_tbl), \
}
#define AD74115_FW_PROP_BOOL(_name, _reg, _mask) \
{ \
.name = (_name), \
.is_boolean = true, \
.reg = (_reg), \
.mask = (_mask), \
}
#define AD74115_FW_PROP_BOOL_NEG(_name, _reg, _mask) \
{ \
.name = (_name), \
.is_boolean = true, \
.negate = true, \
.reg = (_reg), \
.mask = (_mask), \
}
static const int ad74115_dac_rate_tbl[] = {
0,
4 * 8,
4 * 15,
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitops.h`, `linux/crc8.h`, `linux/device.h`, `linux/gpio/driver.h`, `linux/interrupt.h`, `linux/module.h`, `linux/regmap.h`.
- Detected declarations: `struct ad74115_channels`, `struct ad74115_state`, `struct ad74115_fw_prop`, `enum ad74115_dac_ch`, `enum ad74115_adc_ch`, `enum ad74115_ch_func`, `enum ad74115_adc_range`, `enum ad74115_adc_conv_seq`, `enum ad74115_din_threshold_mode`, `enum ad74115_slew_mode`.
- 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.