drivers/soc/dove/pmu.c
Source file repositories/reference/linux-study-clean/drivers/soc/dove/pmu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/dove/pmu.c- Extension
.c- Size
- 11521 bytes
- Lines
- 455
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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.
- 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/io.hlinux/irq.hlinux/irqdomain.hlinux/of.hlinux/of_irq.hlinux/of_address.hlinux/platform_device.hlinux/pm_domain.hlinux/reset.hlinux/reset-controller.hlinux/sched.hlinux/slab.hlinux/soc/dove/pmu.hlinux/spinlock.h
Detected Declarations
struct pmu_datastruct pmu_domainfunction pmu_reset_resetfunction pmu_reset_assertfunction pmu_reset_deassertfunction pmu_reset_initfunction pmu_reset_initfunction pmu_domain_power_onfunction __pmu_domain_registerfunction pmu_irq_handlerfunction dove_init_pmu_irqfunction dove_init_pmu_legacyfunction dove_init_pmufunction for_each_available_child_of_node_scoped
Annotated Snippet
struct pmu_data {
spinlock_t lock;
struct device_node *of_node;
void __iomem *pmc_base;
void __iomem *pmu_base;
struct irq_chip_generic *irq_gc;
struct irq_domain *irq_domain;
#ifdef CONFIG_RESET_CONTROLLER
struct reset_controller_dev reset;
#endif
};
/*
* The PMU contains a register to reset various subsystems within the
* SoC. Export this as a reset controller.
*/
#ifdef CONFIG_RESET_CONTROLLER
#define rcdev_to_pmu(rcdev) container_of(rcdev, struct pmu_data, reset)
static int pmu_reset_reset(struct reset_controller_dev *rc, unsigned long id)
{
struct pmu_data *pmu = rcdev_to_pmu(rc);
unsigned long flags;
u32 val;
spin_lock_irqsave(&pmu->lock, flags);
val = readl_relaxed(pmu->pmc_base + PMC_SW_RST);
writel_relaxed(val & ~BIT(id), pmu->pmc_base + PMC_SW_RST);
writel_relaxed(val | BIT(id), pmu->pmc_base + PMC_SW_RST);
spin_unlock_irqrestore(&pmu->lock, flags);
return 0;
}
static int pmu_reset_assert(struct reset_controller_dev *rc, unsigned long id)
{
struct pmu_data *pmu = rcdev_to_pmu(rc);
unsigned long flags;
u32 val = ~BIT(id);
spin_lock_irqsave(&pmu->lock, flags);
val &= readl_relaxed(pmu->pmc_base + PMC_SW_RST);
writel_relaxed(val, pmu->pmc_base + PMC_SW_RST);
spin_unlock_irqrestore(&pmu->lock, flags);
return 0;
}
static int pmu_reset_deassert(struct reset_controller_dev *rc, unsigned long id)
{
struct pmu_data *pmu = rcdev_to_pmu(rc);
unsigned long flags;
u32 val = BIT(id);
spin_lock_irqsave(&pmu->lock, flags);
val |= readl_relaxed(pmu->pmc_base + PMC_SW_RST);
writel_relaxed(val, pmu->pmc_base + PMC_SW_RST);
spin_unlock_irqrestore(&pmu->lock, flags);
return 0;
}
static const struct reset_control_ops pmu_reset_ops = {
.reset = pmu_reset_reset,
.assert = pmu_reset_assert,
.deassert = pmu_reset_deassert,
};
static struct reset_controller_dev pmu_reset __initdata = {
.ops = &pmu_reset_ops,
.owner = THIS_MODULE,
.nr_resets = 32,
};
static void __init pmu_reset_init(struct pmu_data *pmu)
{
int ret;
pmu->reset = pmu_reset;
pmu->reset.of_node = pmu->of_node;
ret = reset_controller_register(&pmu->reset);
if (ret)
pr_err("pmu: %s failed: %d\n", "reset_controller_register", ret);
}
#else
static void __init pmu_reset_init(struct pmu_data *pmu)
{
}
#endif
Annotation
- Immediate include surface: `linux/io.h`, `linux/irq.h`, `linux/irqdomain.h`, `linux/of.h`, `linux/of_irq.h`, `linux/of_address.h`, `linux/platform_device.h`, `linux/pm_domain.h`.
- Detected declarations: `struct pmu_data`, `struct pmu_domain`, `function pmu_reset_reset`, `function pmu_reset_assert`, `function pmu_reset_deassert`, `function pmu_reset_init`, `function pmu_reset_init`, `function pmu_domain_power_on`, `function __pmu_domain_register`, `function pmu_irq_handler`.
- Atlas domain: Driver Families / drivers/soc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.