drivers/iio/adc/exynos_adc.c
Source file repositories/reference/linux-study-clean/drivers/iio/adc/exynos_adc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/adc/exynos_adc.c- Extension
.c- Size
- 18130 bytes
- Lines
- 722
- 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/compiler.hlinux/module.hlinux/platform_device.hlinux/interrupt.hlinux/delay.hlinux/errno.hlinux/kernel.hlinux/slab.hlinux/io.hlinux/clk.hlinux/completion.hlinux/of.hlinux/regulator/consumer.hlinux/of_platform.hlinux/err.hlinux/iio/iio.hlinux/iio/machine.hlinux/iio/driver.hlinux/mfd/syscon.hlinux/regmap.h
Detected Declarations
struct exynos_adcstruct exynos_adc_datafunction exynos_adc_unprepare_clkfunction exynos_adc_prepare_clkfunction exynos_adc_disable_clkfunction exynos_adc_enable_clkfunction exynos_adc_v1_init_hwfunction exynos_adc_v1_exit_hwfunction exynos_adc_v1_clear_irqfunction exynos_adc_v1_start_convfunction exynos_adc_s3c64xx_start_convfunction exynos_adc_v2_init_hwfunction exynos_adc_v2_exit_hwfunction exynos_adc_v2_clear_irqfunction exynos_adc_v2_start_convfunction exynos_adc_exynos7_init_hwfunction exynos_read_rawfunction exynos_adc_isrfunction exynos_adc_reg_accessfunction exynos_adc_probefunction exynos_adc_removefunction exynos_adc_suspendfunction exynos_adc_resume
Annotated Snippet
struct exynos_adc {
struct exynos_adc_data *data;
struct device *dev;
void __iomem *regs;
struct regmap *pmu_map;
struct clk *clk;
struct clk *sclk;
unsigned int irq;
struct regulator *vdd;
struct completion completion;
u32 value;
unsigned int version;
/*
* Lock to protect from potential concurrent access to the
* completion callback during a manual conversion. For this driver
* a wait-callback is used to wait for the conversion result,
* so in the meantime no other read request (or conversion start)
* must be performed, otherwise it would interfere with the
* current conversion result.
*/
struct mutex lock;
};
struct exynos_adc_data {
int num_channels;
bool needs_sclk;
bool needs_adc_phy;
int phy_offset;
u32 mask;
void (*init_hw)(struct exynos_adc *info);
void (*exit_hw)(struct exynos_adc *info);
void (*clear_irq)(struct exynos_adc *info);
void (*start_conv)(struct exynos_adc *info, unsigned long addr);
};
static void exynos_adc_unprepare_clk(struct exynos_adc *info)
{
if (info->data->needs_sclk)
clk_unprepare(info->sclk);
clk_unprepare(info->clk);
}
static int exynos_adc_prepare_clk(struct exynos_adc *info)
{
int ret;
ret = clk_prepare(info->clk);
if (ret) {
dev_err(info->dev, "failed preparing adc clock: %d\n", ret);
return ret;
}
if (info->data->needs_sclk) {
ret = clk_prepare(info->sclk);
if (ret) {
clk_unprepare(info->clk);
dev_err(info->dev,
"failed preparing sclk_adc clock: %d\n", ret);
return ret;
}
}
return 0;
}
static void exynos_adc_disable_clk(struct exynos_adc *info)
{
if (info->data->needs_sclk)
clk_disable(info->sclk);
clk_disable(info->clk);
}
static int exynos_adc_enable_clk(struct exynos_adc *info)
{
int ret;
ret = clk_enable(info->clk);
if (ret) {
dev_err(info->dev, "failed enabling adc clock: %d\n", ret);
return ret;
}
if (info->data->needs_sclk) {
ret = clk_enable(info->sclk);
if (ret) {
clk_disable(info->clk);
Annotation
- Immediate include surface: `linux/compiler.h`, `linux/module.h`, `linux/platform_device.h`, `linux/interrupt.h`, `linux/delay.h`, `linux/errno.h`, `linux/kernel.h`, `linux/slab.h`.
- Detected declarations: `struct exynos_adc`, `struct exynos_adc_data`, `function exynos_adc_unprepare_clk`, `function exynos_adc_prepare_clk`, `function exynos_adc_disable_clk`, `function exynos_adc_enable_clk`, `function exynos_adc_v1_init_hw`, `function exynos_adc_v1_exit_hw`, `function exynos_adc_v1_clear_irq`, `function exynos_adc_v1_start_conv`.
- 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.