drivers/iio/adc/at91-sama5d2_adc.c
Source file repositories/reference/linux-study-clean/drivers/iio/adc/at91-sama5d2_adc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/adc/at91-sama5d2_adc.c- Extension
.c- Size
- 74536 bytes
- Lines
- 2631
- 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/bitops.hlinux/cleanup.hlinux/clk.hlinux/delay.hlinux/dma-mapping.hlinux/dmaengine.hlinux/interrupt.hlinux/io.hlinux/module.hlinux/mod_devicetable.hlinux/platform_device.hlinux/property.hlinux/sched.hlinux/units.hlinux/wait.hlinux/iio/iio.hlinux/iio/sysfs.hlinux/iio/buffer.hlinux/iio/trigger.hlinux/iio/trigger_consumer.hlinux/iio/triggered_buffer.hlinux/nvmem-consumer.hlinux/pinctrl/consumer.hlinux/pm_runtime.hlinux/regulator/consumer.hdt-bindings/iio/adc/at91-sama5d2_adc.h
Detected Declarations
struct at91_adc_reg_layoutstruct at91_adc_platformstruct at91_adc_temp_sensor_clbstruct at91_adc_soc_infostruct at91_adc_triggerstruct at91_adc_dmastruct at91_adc_touchstruct at91_adc_tempstruct at91_adc_stateenum at91_adc_ts_clb_idxfunction at91_adc_chan_xlatefunction at91_adc_chan_getfunction at91_adc_fwnode_xlatefunction at91_adc_active_scan_mask_to_regfunction for_each_set_bitfunction at91_adc_corfunction at91_adc_irq_statusfunction at91_adc_irq_maskfunction at91_adc_eoc_disfunction at91_adc_eoc_enafunction at91_adc_config_emrfunction at91_adc_adjust_val_osrfunction at91_adc_adjust_val_osr_arrayfunction bytesfunction at91_adc_configure_touchfunction at91_adc_touch_posfunction at91_adc_touch_x_posfunction at91_adc_touch_y_posfunction at91_adc_touch_pressurefunction at91_adc_read_positionfunction at91_adc_read_pressurefunction at91_adc_configure_trigger_registersfunction at91_adc_configure_triggerfunction at91_adc_reenable_triggerfunction at91_adc_dma_size_donefunction at91_dma_buffer_donefunction at91_adc_dma_startfunction for_each_set_bitfunction at91_adc_buffer_check_use_irqfunction at91_adc_current_chan_is_touchfunction at91_adc_buffer_preparefunction for_each_set_bitfunction at91_adc_buffer_postdisablefunction at91_adc_trigger_handler_nodmafunction for_each_set_bitfunction maskfunction at91_adc_trigger_handler_dmafunction at91_adc_trigger_handler
Annotated Snippet
struct at91_adc_reg_layout {
/* Control Register */
u16 CR;
/* Software Reset */
#define AT91_SAMA5D2_CR_SWRST BIT(0)
/* Start Conversion */
#define AT91_SAMA5D2_CR_START BIT(1)
/* Touchscreen Calibration */
#define AT91_SAMA5D2_CR_TSCALIB BIT(2)
/* Comparison Restart */
#define AT91_SAMA5D2_CR_CMPRST BIT(4)
/* Mode Register */
u16 MR;
/* Trigger Selection */
#define AT91_SAMA5D2_MR_TRGSEL(v) ((v) << 1)
/* ADTRG */
#define AT91_SAMA5D2_MR_TRGSEL_TRIG0 0
/* TIOA0 */
#define AT91_SAMA5D2_MR_TRGSEL_TRIG1 1
/* TIOA1 */
#define AT91_SAMA5D2_MR_TRGSEL_TRIG2 2
/* TIOA2 */
#define AT91_SAMA5D2_MR_TRGSEL_TRIG3 3
/* PWM event line 0 */
#define AT91_SAMA5D2_MR_TRGSEL_TRIG4 4
/* PWM event line 1 */
#define AT91_SAMA5D2_MR_TRGSEL_TRIG5 5
/* TIOA3 */
#define AT91_SAMA5D2_MR_TRGSEL_TRIG6 6
/* RTCOUT0 */
#define AT91_SAMA5D2_MR_TRGSEL_TRIG7 7
/* Sleep Mode */
#define AT91_SAMA5D2_MR_SLEEP BIT(5)
/* Fast Wake Up */
#define AT91_SAMA5D2_MR_FWUP BIT(6)
/* Prescaler Rate Selection */
#define AT91_SAMA5D2_MR_PRESCAL(v) ((v) << AT91_SAMA5D2_MR_PRESCAL_OFFSET)
#define AT91_SAMA5D2_MR_PRESCAL_OFFSET 8
#define AT91_SAMA5D2_MR_PRESCAL_MAX 0xff
#define AT91_SAMA5D2_MR_PRESCAL_MASK GENMASK(15, 8)
/* Startup Time */
#define AT91_SAMA5D2_MR_STARTUP(v) ((v) << 16)
#define AT91_SAMA5D2_MR_STARTUP_MASK GENMASK(19, 16)
/* Minimum startup time for temperature sensor */
#define AT91_SAMA5D2_MR_STARTUP_TS_MIN (50)
/* Analog Change */
#define AT91_SAMA5D2_MR_ANACH BIT(23)
/* Tracking Time */
#define AT91_SAMA5D2_MR_TRACKTIM(v) ((v) << 24)
#define AT91_SAMA5D2_MR_TRACKTIM_TS 6
#define AT91_SAMA5D2_MR_TRACKTIM_MAX 0xf
/* Transfer Time */
#define AT91_SAMA5D2_MR_TRANSFER(v) ((v) << 28)
#define AT91_SAMA5D2_MR_TRANSFER_MAX 0x3
/* Use Sequence Enable */
#define AT91_SAMA5D2_MR_USEQ BIT(31)
/* Channel Sequence Register 1 */
u16 SEQR1;
/* Channel Sequence Register 2 */
u16 SEQR2;
/* Channel Enable Register */
u16 CHER;
/* Channel Disable Register */
u16 CHDR;
/* Channel Status Register */
u16 CHSR;
/* Last Converted Data Register */
u16 LCDR;
/* Interrupt Enable Register */
u16 IER;
/* Interrupt Enable Register - TS X measurement ready */
#define AT91_SAMA5D2_IER_XRDY BIT(20)
/* Interrupt Enable Register - TS Y measurement ready */
#define AT91_SAMA5D2_IER_YRDY BIT(21)
/* Interrupt Enable Register - TS pressure measurement ready */
#define AT91_SAMA5D2_IER_PRDY BIT(22)
/* Interrupt Enable Register - Data ready */
#define AT91_SAMA5D2_IER_DRDY BIT(24)
/* Interrupt Enable Register - general overrun error */
#define AT91_SAMA5D2_IER_GOVRE BIT(25)
/* Interrupt Enable Register - Pen detect */
#define AT91_SAMA5D2_IER_PEN BIT(29)
/* Interrupt Enable Register - No pen detect */
#define AT91_SAMA5D2_IER_NOPEN BIT(30)
/* Interrupt Disable Register */
u16 IDR;
/* Interrupt Mask Register */
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/cleanup.h`, `linux/clk.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/dmaengine.h`, `linux/interrupt.h`, `linux/io.h`.
- Detected declarations: `struct at91_adc_reg_layout`, `struct at91_adc_platform`, `struct at91_adc_temp_sensor_clb`, `struct at91_adc_soc_info`, `struct at91_adc_trigger`, `struct at91_adc_dma`, `struct at91_adc_touch`, `struct at91_adc_temp`, `struct at91_adc_state`, `enum at91_adc_ts_clb_idx`.
- 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.