drivers/mfd/fsl-imx25-tsadc.c
Source file repositories/reference/linux-study-clean/drivers/mfd/fsl-imx25-tsadc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/fsl-imx25-tsadc.c- Extension
.c- Size
- 5550 bytes
- Lines
- 220
- 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/clk.hlinux/interrupt.hlinux/irqchip/chained_irq.hlinux/irqdesc.hlinux/irqdomain.hlinux/irq.hlinux/mfd/imx25-tsadc.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/regmap.h
Detected Declarations
function mx25_tsadc_irq_handlerfunction mx25_tsadc_domain_mapfunction mx25_tsadc_setup_irqfunction mx25_tsadc_unset_irqfunction mx25_tsadc_setup_clkfunction mx25_tsadc_probefunction mx25_tsadc_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2014-2015 Pengutronix, Markus Pargmann <mpa@pengutronix.de>
*/
#include <linux/clk.h>
#include <linux/interrupt.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/irqdesc.h>
#include <linux/irqdomain.h>
#include <linux/irq.h>
#include <linux/mfd/imx25-tsadc.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
static const struct regmap_config mx25_tsadc_regmap_config = {
.max_register = 8,
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
};
static void mx25_tsadc_irq_handler(struct irq_desc *desc)
{
struct mx25_tsadc *tsadc = irq_desc_get_handler_data(desc);
struct irq_chip *chip = irq_desc_get_chip(desc);
u32 status;
chained_irq_enter(chip, desc);
regmap_read(tsadc->regs, MX25_TSC_TGSR, &status);
if (status & MX25_TGSR_GCQ_INT)
generic_handle_domain_irq(tsadc->domain, 1);
if (status & MX25_TGSR_TCQ_INT)
generic_handle_domain_irq(tsadc->domain, 0);
chained_irq_exit(chip, desc);
}
static int mx25_tsadc_domain_map(struct irq_domain *d, unsigned int irq,
irq_hw_number_t hwirq)
{
struct mx25_tsadc *tsadc = d->host_data;
irq_set_chip_data(irq, tsadc);
irq_set_chip_and_handler(irq, &dummy_irq_chip,
handle_level_irq);
irq_modify_status(irq, IRQ_NOREQUEST, IRQ_NOPROBE);
return 0;
}
static const struct irq_domain_ops mx25_tsadc_domain_ops = {
.map = mx25_tsadc_domain_map,
.xlate = irq_domain_xlate_onecell,
};
static int mx25_tsadc_setup_irq(struct platform_device *pdev,
struct mx25_tsadc *tsadc)
{
struct device *dev = &pdev->dev;
int irq;
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
tsadc->domain = irq_domain_create_simple(dev_fwnode(dev), 2, 0, &mx25_tsadc_domain_ops,
tsadc);
if (!tsadc->domain) {
dev_err(dev, "Failed to add irq domain\n");
return -ENOMEM;
}
irq_set_chained_handler_and_data(irq, mx25_tsadc_irq_handler, tsadc);
return 0;
}
static int mx25_tsadc_unset_irq(struct platform_device *pdev)
{
struct mx25_tsadc *tsadc = platform_get_drvdata(pdev);
int irq = platform_get_irq(pdev, 0);
if (irq >= 0) {
Annotation
- Immediate include surface: `linux/clk.h`, `linux/interrupt.h`, `linux/irqchip/chained_irq.h`, `linux/irqdesc.h`, `linux/irqdomain.h`, `linux/irq.h`, `linux/mfd/imx25-tsadc.h`, `linux/module.h`.
- Detected declarations: `function mx25_tsadc_irq_handler`, `function mx25_tsadc_domain_map`, `function mx25_tsadc_setup_irq`, `function mx25_tsadc_unset_irq`, `function mx25_tsadc_setup_clk`, `function mx25_tsadc_probe`, `function mx25_tsadc_remove`.
- 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.