drivers/iio/adc/ad4130.c
Source file repositories/reference/linux-study-clean/drivers/iio/adc/ad4130.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/adc/ad4130.c- Extension
.c- Size
- 55358 bytes
- Lines
- 2124
- 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.
- 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/cleanup.hlinux/clk.hlinux/clk-provider.hlinux/delay.hlinux/device.hlinux/err.hlinux/gpio/driver.hlinux/interrupt.hlinux/irq.hlinux/kernel.hlinux/module.hlinux/property.hlinux/regmap.hlinux/regulator/consumer.hlinux/spi/spi.hlinux/units.hasm/div64.hlinux/unaligned.hlinux/iio/buffer.hlinux/iio/iio.hlinux/iio/kfifo_buf.hlinux/iio/sysfs.h
Detected Declarations
struct ad4130_setup_infostruct ad4130_slot_infostruct ad4130_chan_infostruct ad4130_filter_configstruct ad4130_stateenum ad4130_int_ref_valenum ad4130_mclk_selenum ad4130_int_pin_selenum ad4130_ioutenum ad4130_burnoutenum ad4130_ref_selenum ad4130_fifo_modeenum ad4130_modeenum ad4130_filter_typeenum ad4130_pin_functionfunction ad4130_get_reg_sizefunction ad4130_data_reg_sizefunction ad4130_resolutionfunction ad4130_reg_writefunction ad4130_reg_readfunction ad4130_gpio_init_valid_maskfunction ad4130_gpio_get_directionfunction ad4130_gpio_setfunction ad4130_set_modefunction ad4130_set_watermark_interrupt_enfunction ad4130_watermark_reg_valfunction ad4130_set_fifo_modefunction ad4130_push_fifo_datafunction ad4130_irq_handlerfunction ad4130_setup_info_eqfunction ad4130_find_slotfunction ad4130_unlink_channelfunction ad4130_unlink_slotfunction ad4130_link_channel_slotfunction ad4130_write_slot_setupfunction ad4130_write_channel_setupfunction ad4130_set_channel_enablefunction ad4130_freq_to_fsfunction ad4130_fs_to_freqfunction ad4130_set_filter_typefunction ad4130_get_filter_typefunction ad4130_set_channel_pgafunction ad4130_set_channel_freqfunction _ad4130_read_samplefunction ad4130_read_samplefunction ad4130_read_rawfunction ad4130_read_availfunction scoped_guard
Annotated Snippet
struct ad4130_setup_info {
unsigned int iout0_val;
unsigned int iout1_val;
unsigned int burnout;
unsigned int pga;
unsigned int fs;
u32 ref_sel;
enum ad4130_filter_type filter_type;
bool ref_bufp;
bool ref_bufm;
};
struct ad4130_slot_info {
struct ad4130_setup_info setup;
unsigned int enabled_channels;
unsigned int channels;
};
struct ad4130_chan_info {
struct ad4130_setup_info setup;
u32 iout0;
u32 iout1;
int slot;
bool enabled;
bool initialized;
};
struct ad4130_filter_config {
enum ad4130_filter_type filter_type;
unsigned int odr_div;
unsigned int fs_max;
enum iio_available_type samp_freq_avail_type;
int samp_freq_avail_len;
int samp_freq_avail[3][2];
};
struct ad4130_state {
struct regmap *regmap;
struct spi_device *spi;
struct clk *mclk;
struct regulator_bulk_data regulators[4];
u32 irq_trigger;
u32 inv_irq_trigger;
/*
* Synchronize access to members the of driver state, and ensure
* atomicity of consecutive regmap operations.
*/
struct mutex lock;
struct completion completion;
struct iio_chan_spec chans[AD4130_MAX_CHANNELS];
struct ad4130_chan_info chans_info[AD4130_MAX_CHANNELS];
struct ad4130_slot_info slots_info[AD4130_MAX_SETUPS];
enum ad4130_pin_function pins_fn[AD4130_MAX_ANALOG_PINS];
u32 vbias_pins[AD4130_MAX_ANALOG_PINS];
u32 num_vbias_pins;
int scale_tbls[AD4130_REF_SEL_MAX][AD4130_MAX_PGA][2];
struct gpio_chip gc;
struct clk_hw int_clk_hw;
u32 int_pin_sel;
u32 int_ref_uv;
u32 mclk_sel;
bool int_ref_en;
bool bipolar;
unsigned int num_enabled_channels;
unsigned int effective_watermark;
unsigned int watermark;
struct spi_message fifo_msg;
struct spi_transfer fifo_xfer[2];
/*
* DMA (thus cache coherency maintenance) requires any transfer
* buffers to live in their own cache lines. As the use of these
* buffers is synchronous, all of the buffers used for DMA in this
* driver may share a cache line.
*/
u8 reset_buf[AD4130_RESET_BUF_SIZE] __aligned(IIO_DMA_MINALIGN);
u8 reg_write_tx_buf[4];
u8 reg_read_tx_buf[1];
u8 reg_read_rx_buf[3];
u8 fifo_tx_buf[2];
u8 fifo_rx_buf[AD4130_FIFO_SIZE *
AD4130_FIFO_MAX_SAMPLE_SIZE];
};
static const char * const ad4130_int_pin_names[] = {
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitops.h`, `linux/cleanup.h`, `linux/clk.h`, `linux/clk-provider.h`, `linux/delay.h`, `linux/device.h`, `linux/err.h`.
- Detected declarations: `struct ad4130_setup_info`, `struct ad4130_slot_info`, `struct ad4130_chan_info`, `struct ad4130_filter_config`, `struct ad4130_state`, `enum ad4130_int_ref_val`, `enum ad4130_mclk_sel`, `enum ad4130_int_pin_sel`, `enum ad4130_iout`, `enum ad4130_burnout`.
- Atlas domain: Driver Families / drivers/iio.
- Implementation status: source implementation candidate.
- 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.