drivers/mfd/sun4i-gpadc.c
Source file repositories/reference/linux-study-clean/drivers/mfd/sun4i-gpadc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/sun4i-gpadc.c- Extension
.c- Size
- 4415 bytes
- Lines
- 175
- Domain
- Driver Families
- Bucket
- drivers/mfd
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/interrupt.hlinux/kernel.hlinux/mfd/core.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/mfd/sun4i-gpadc.h
Detected Declarations
function sun4i_gpadc_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/* ADC MFD core driver for sunxi platforms
*
* Copyright (c) 2016 Quentin Schulz <quentin.schulz@free-electrons.com>
*/
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/mfd/sun4i-gpadc.h>
#define ARCH_SUN4I_A10 0
#define ARCH_SUN5I_A13 1
#define ARCH_SUN6I_A31 2
static const struct resource adc_resources[] = {
DEFINE_RES_IRQ_NAMED(SUN4I_GPADC_IRQ_FIFO_DATA, "FIFO_DATA_PENDING"),
DEFINE_RES_IRQ_NAMED(SUN4I_GPADC_IRQ_TEMP_DATA, "TEMP_DATA_PENDING"),
};
static const struct regmap_irq sun4i_gpadc_regmap_irq[] = {
REGMAP_IRQ_REG(SUN4I_GPADC_IRQ_FIFO_DATA, 0,
SUN4I_GPADC_INT_FIFOC_TP_DATA_IRQ_EN),
REGMAP_IRQ_REG(SUN4I_GPADC_IRQ_TEMP_DATA, 0,
SUN4I_GPADC_INT_FIFOC_TEMP_IRQ_EN),
};
static const struct regmap_irq_chip sun4i_gpadc_regmap_irq_chip = {
.name = "sun4i_gpadc_irq_chip",
.status_base = SUN4I_GPADC_INT_FIFOS,
.ack_base = SUN4I_GPADC_INT_FIFOS,
.unmask_base = SUN4I_GPADC_INT_FIFOC,
.init_ack_masked = true,
.irqs = sun4i_gpadc_regmap_irq,
.num_irqs = ARRAY_SIZE(sun4i_gpadc_regmap_irq),
.num_regs = 1,
};
static struct mfd_cell sun4i_gpadc_cells[] = {
{
.name = "sun4i-a10-gpadc-iio",
.resources = adc_resources,
.num_resources = ARRAY_SIZE(adc_resources),
},
{ .name = "iio_hwmon" }
};
static struct mfd_cell sun5i_gpadc_cells[] = {
{
.name = "sun5i-a13-gpadc-iio",
.resources = adc_resources,
.num_resources = ARRAY_SIZE(adc_resources),
},
{ .name = "iio_hwmon" },
};
static struct mfd_cell sun6i_gpadc_cells[] = {
{
.name = "sun6i-a31-gpadc-iio",
.resources = adc_resources,
.num_resources = ARRAY_SIZE(adc_resources),
},
{ .name = "iio_hwmon" },
};
static const struct regmap_config sun4i_gpadc_regmap_config = {
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
};
static const struct of_device_id sun4i_gpadc_of_match[] = {
{
.compatible = "allwinner,sun4i-a10-ts",
.data = (void *)ARCH_SUN4I_A10,
}, {
.compatible = "allwinner,sun5i-a13-ts",
.data = (void *)ARCH_SUN5I_A13,
}, {
.compatible = "allwinner,sun6i-a31-ts",
.data = (void *)ARCH_SUN6I_A31,
}, { /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, sun4i_gpadc_of_match);
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/kernel.h`, `linux/mfd/core.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/mfd/sun4i-gpadc.h`.
- Detected declarations: `function sun4i_gpadc_probe`.
- Atlas domain: Driver Families / drivers/mfd.
- Implementation status: source implementation candidate.
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.