drivers/iio/adc/stm32-adc.c
Source file repositories/reference/linux-study-clean/drivers/iio/adc/stm32-adc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/adc/stm32-adc.c- Extension
.c- Size
- 80155 bytes
- Lines
- 2801
- 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/array_size.hlinux/clk.hlinux/debugfs.hlinux/delay.hlinux/dma-mapping.hlinux/dmaengine.hlinux/iio/iio.hlinux/iio/buffer.hlinux/iio/timer/stm32-lptim-trigger.hlinux/iio/timer/stm32-timer-trigger.hlinux/iio/trigger.hlinux/iio/trigger_consumer.hlinux/iio/triggered_buffer.hlinux/interrupt.hlinux/io.hlinux/iopoll.hlinux/module.hlinux/mod_devicetable.hlinux/nvmem-consumer.hlinux/platform_device.hlinux/pm_runtime.hlinux/property.hstm32-adc-core.h
Detected Declarations
struct stm32_adc_icstruct stm32_adc_trig_infostruct stm32_adc_calibstruct stm32_adc_regsstruct stm32_adc_vrefintstruct stm32_adc_regspecstruct stm32_adcstruct stm32_adc_cfgstruct stm32_adcstruct stm32_adc_diff_channelstruct stm32_adc_infoenum stm32_adc_extenenum stm32_adc_extselenum stm32_adc_int_chfunction stm32_adc_readlfunction stm32_adc_readwfunction stm32_adc_writelfunction stm32_adc_set_bitsfunction stm32_adc_set_bits_commonfunction stm32_adc_clr_bitsfunction stm32_adc_clr_bits_commonfunction stm32_adc_conv_irq_enablefunction stm32_adc_conv_irq_disablefunction stm32_adc_ovr_irq_enablefunction stm32_adc_ovr_irq_disablefunction stm32_adc_set_resfunction stm32_adc_hw_stopfunction stm32_adc_hw_startfunction stm32_adc_int_ch_enablefunction stm32_adc_int_ch_disablefunction stm32f4_adc_start_convfunction stm32f4_adc_stop_convfunction stm32f4_adc_irq_clearfunction stm32h7_adc_start_convfunction stm32h7_adc_stop_convfunction stm32h7_adc_irq_clearfunction stm32mp13_adc_start_convfunction stm32h7_adc_set_ovsfunction stm32mp13_adc_set_ovsfunction stm32h7_adc_exit_pwr_downfunction stm32h7_adc_enter_pwr_downfunction stm32h7_adc_enablefunction stm32h7_adc_disablefunction stm32h7_adc_read_selfcalibfunction stm32h7_adc_restore_selfcalibfunction stm32h7_adc_selfcalibfunction stm32h7_adc_check_selfcalibfunction stm32h7_adc_prepare
Annotated Snippet
struct stm32_adc_ic {
const char *name;
u32 idx;
};
static const struct stm32_adc_ic stm32_adc_ic[STM32_ADC_INT_CH_NB] = {
{ "vddcore", STM32_ADC_INT_CH_VDDCORE },
{ "vddcpu", STM32_ADC_INT_CH_VDDCPU },
{ "vddq_ddr", STM32_ADC_INT_CH_VDDQ_DDR },
{ "vrefint", STM32_ADC_INT_CH_VREFINT },
{ "vbat", STM32_ADC_INT_CH_VBAT },
};
/**
* struct stm32_adc_trig_info - ADC trigger info
* @name: name of the trigger, corresponding to its source
* @extsel: trigger selection
*/
struct stm32_adc_trig_info {
const char *name;
enum stm32_adc_extsel extsel;
};
/**
* struct stm32_adc_calib - optional adc calibration data
* @lincalfact: Linearity calibration factor
* @lincal_saved: Indicates that linear calibration factors are saved
*/
struct stm32_adc_calib {
u32 lincalfact[STM32H7_LINCALFACT_NUM];
bool lincal_saved;
};
/**
* struct stm32_adc_regs - stm32 ADC misc registers & bitfield desc
* @reg: register offset
* @mask: bitfield mask
* @shift: left shift
*/
struct stm32_adc_regs {
int reg;
int mask;
int shift;
};
/**
* struct stm32_adc_vrefint - stm32 ADC internal reference voltage data
* @vrefint_cal: vrefint calibration value from nvmem
* @vrefint_data: vrefint actual value
*/
struct stm32_adc_vrefint {
u32 vrefint_cal;
u32 vrefint_data;
};
/**
* struct stm32_adc_regspec - stm32 registers definition
* @dr: data register offset
* @ier_eoc: interrupt enable register & eocie bitfield
* @ier_ovr: interrupt enable register & overrun bitfield
* @isr_eoc: interrupt status register & eoc bitfield
* @isr_ovr: interrupt status register & overrun bitfield
* @sqr: reference to sequence registers array
* @exten: trigger control register & bitfield
* @extsel: trigger selection register & bitfield
* @res: resolution selection register & bitfield
* @difsel: differential mode selection register & bitfield
* @smpr: smpr1 & smpr2 registers offset array
* @smp_bits: smpr1 & smpr2 index and bitfields
* @or_vddcore: option register & vddcore bitfield
* @or_vddcpu: option register & vddcpu bitfield
* @or_vddq_ddr: option register & vddq_ddr bitfield
* @ccr_vbat: common register & vbat bitfield
* @ccr_vref: common register & vrefint bitfield
*/
struct stm32_adc_regspec {
const u32 dr;
const struct stm32_adc_regs ier_eoc;
const struct stm32_adc_regs ier_ovr;
const struct stm32_adc_regs isr_eoc;
const struct stm32_adc_regs isr_ovr;
const struct stm32_adc_regs *sqr;
const struct stm32_adc_regs exten;
const struct stm32_adc_regs extsel;
const struct stm32_adc_regs res;
const struct stm32_adc_regs difsel;
const u32 smpr[2];
const struct stm32_adc_regs *smp_bits;
const struct stm32_adc_regs or_vddcore;
const struct stm32_adc_regs or_vddcpu;
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/clk.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/dmaengine.h`, `linux/iio/iio.h`, `linux/iio/buffer.h`.
- Detected declarations: `struct stm32_adc_ic`, `struct stm32_adc_trig_info`, `struct stm32_adc_calib`, `struct stm32_adc_regs`, `struct stm32_adc_vrefint`, `struct stm32_adc_regspec`, `struct stm32_adc`, `struct stm32_adc_cfg`, `struct stm32_adc`, `struct stm32_adc_diff_channel`.
- 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.