drivers/iio/adc/ad7380.c
Source file repositories/reference/linux-study-clean/drivers/iio/adc/ad7380.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/adc/ad7380.c- Extension
.c- Size
- 64378 bytes
- Lines
- 2155
- 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/align.hlinux/bitfield.hlinux/bitops.hlinux/cleanup.hlinux/device.hlinux/err.hlinux/kernel.hlinux/math.hlinux/module.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/spi/offload/consumer.hlinux/spi/spi.hlinux/units.hlinux/util_macros.hlinux/iio/buffer.hlinux/iio/buffer-dmaengine.hlinux/iio/events.hlinux/iio/iio.hlinux/iio/trigger_consumer.hlinux/iio/triggered_buffer.h
Detected Declarations
struct ad7380_timing_specsstruct ad7380_chip_infostruct ad7380_statefunction BITfunction ad7380_regmap_reg_writefunction ad7380_regmap_reg_readfunction ad7380_debugfs_reg_accessfunction ad7380_regval_to_osrfunction ad7380_get_osrfunction readfunction ad7380_update_xfersfunction ad7380_set_sample_freqfunction ad7380_init_offload_msgfunction ad7380_offload_buffer_postenablefunction ad7380_offload_buffer_predisablefunction ad7380_triggered_buffer_preenablefunction ad7380_triggered_buffer_postdisablefunction ad7380_trigger_handlerfunction ad7380_read_directfunction ad7380_read_rawfunction ad7380_read_availfunction ad7380_osr_to_regvalfunction ad7380_set_oversampling_ratiofunction ad7380_write_rawfunction ad7380_get_current_scan_typefunction ad7380_read_event_configfunction ad7380_write_event_configfunction ad7380_get_alert_thfunction ad7380_read_event_valuefunction ad7380_set_alert_thfunction ad7380_write_event_valuefunction ad7380_initfunction ad7380_probe_spi_offloadfunction ad7380_probe
Annotated Snippet
struct ad7380_timing_specs {
const unsigned int t_csh_ns; /* CS minimum high time */
};
struct ad7380_chip_info {
const char *name;
const struct iio_chan_spec *channels;
const struct iio_chan_spec *offload_channels;
unsigned int num_channels;
unsigned int num_simult_channels;
bool has_hardware_gain;
bool has_mux;
const char * const *supplies;
unsigned int num_supplies;
bool external_ref_only;
bool internal_ref_only;
unsigned int internal_ref_mv;
const char * const *vcm_supplies;
unsigned int num_vcm_supplies;
const unsigned long *available_scan_masks;
const struct ad7380_timing_specs *timing_specs;
u32 max_conversion_rate_hz;
};
static const struct iio_event_spec ad7380_events[] = {
{
.type = IIO_EV_TYPE_THRESH,
.dir = IIO_EV_DIR_RISING,
.mask_shared_by_dir = BIT(IIO_EV_INFO_VALUE),
},
{
.type = IIO_EV_TYPE_THRESH,
.dir = IIO_EV_DIR_FALLING,
.mask_shared_by_dir = BIT(IIO_EV_INFO_VALUE),
},
{
.type = IIO_EV_TYPE_THRESH,
.dir = IIO_EV_DIR_EITHER,
.mask_shared_by_all = BIT(IIO_EV_INFO_ENABLE),
},
};
enum {
AD7380_SCAN_TYPE_NORMAL,
AD7380_SCAN_TYPE_RESOLUTION_BOOST,
};
/* Extended scan types for 12-bit unsigned chips. */
static const struct iio_scan_type ad7380_scan_type_12_u[] = {
[AD7380_SCAN_TYPE_NORMAL] = {
.sign = 'u',
.realbits = 12,
.storagebits = 16,
.endianness = IIO_CPU,
},
[AD7380_SCAN_TYPE_RESOLUTION_BOOST] = {
.sign = 'u',
.realbits = 14,
.storagebits = 16,
.endianness = IIO_CPU,
},
};
/* Extended scan types for 14-bit signed chips. */
static const struct iio_scan_type ad7380_scan_type_14_s[] = {
[AD7380_SCAN_TYPE_NORMAL] = {
.sign = 's',
.realbits = 14,
.storagebits = 16,
.endianness = IIO_CPU,
},
[AD7380_SCAN_TYPE_RESOLUTION_BOOST] = {
.sign = 's',
.realbits = 16,
.storagebits = 16,
.endianness = IIO_CPU,
},
};
/* Extended scan types for 14-bit unsigned chips. */
static const struct iio_scan_type ad7380_scan_type_14_u[] = {
[AD7380_SCAN_TYPE_NORMAL] = {
.sign = 'u',
.realbits = 14,
.storagebits = 16,
.endianness = IIO_CPU,
},
[AD7380_SCAN_TYPE_RESOLUTION_BOOST] = {
.sign = 'u',
.realbits = 16,
Annotation
- Immediate include surface: `linux/align.h`, `linux/bitfield.h`, `linux/bitops.h`, `linux/cleanup.h`, `linux/device.h`, `linux/err.h`, `linux/kernel.h`, `linux/math.h`.
- Detected declarations: `struct ad7380_timing_specs`, `struct ad7380_chip_info`, `struct ad7380_state`, `function BIT`, `function ad7380_regmap_reg_write`, `function ad7380_regmap_reg_read`, `function ad7380_debugfs_reg_access`, `function ad7380_regval_to_osr`, `function ad7380_get_osr`, `function read`.
- 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.