drivers/pmdomain/renesas/rcar-gen4-sysc.c
Source file repositories/reference/linux-study-clean/drivers/pmdomain/renesas/rcar-gen4-sysc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pmdomain/renesas/rcar-gen4-sysc.c- Extension
.c- Size
- 9626 bytes
- Lines
- 379
- Domain
- Driver Families
- Bucket
- drivers/pmdomain
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/bits.hlinux/clk/renesas.hlinux/delay.hlinux/err.hlinux/io.hlinux/iopoll.hlinux/kernel.hlinux/mm.hlinux/of_address.hlinux/pm_domain.hlinux/slab.hlinux/spinlock.hlinux/types.hrcar-gen4-sysc.h
Detected Declarations
struct rcar_gen4_sysc_pdstruct rcar_gen4_pm_domainsfunction rcar_gen4_sysc_pwr_on_offfunction clear_irq_flagsfunction rcar_gen4_sysc_powerfunction rcar_gen4_sysc_power_is_offfunction rcar_gen4_sysc_pd_power_offfunction rcar_gen4_sysc_pd_power_onfunction rcar_gen4_sysc_pd_setupfunction rcar_gen4_sysc_pd_init
Annotated Snippet
struct rcar_gen4_sysc_pd {
struct generic_pm_domain genpd;
u8 pdr;
unsigned int flags;
char name[];
};
static inline struct rcar_gen4_sysc_pd *to_rcar_gen4_pd(struct generic_pm_domain *d)
{
return container_of(d, struct rcar_gen4_sysc_pd, genpd);
}
static int rcar_gen4_sysc_pd_power_off(struct generic_pm_domain *genpd)
{
struct rcar_gen4_sysc_pd *pd = to_rcar_gen4_pd(genpd);
pr_debug("%s: %s\n", __func__, genpd->name);
return rcar_gen4_sysc_power(pd->pdr, false);
}
static int rcar_gen4_sysc_pd_power_on(struct generic_pm_domain *genpd)
{
struct rcar_gen4_sysc_pd *pd = to_rcar_gen4_pd(genpd);
pr_debug("%s: %s\n", __func__, genpd->name);
return rcar_gen4_sysc_power(pd->pdr, true);
}
static int __init rcar_gen4_sysc_pd_setup(struct rcar_gen4_sysc_pd *pd)
{
struct generic_pm_domain *genpd = &pd->genpd;
const char *name = pd->genpd.name;
int error;
if (pd->flags & PD_CPU) {
/*
* This domain contains a CPU core and therefore it should
* only be turned off if the CPU is not in use.
*/
pr_debug("PM domain %s contains %s\n", name, "CPU");
genpd->flags |= GENPD_FLAG_ALWAYS_ON;
} else if (pd->flags & PD_SCU) {
/*
* This domain contains an SCU and cache-controller, and
* therefore it should only be turned off if the CPU cores are
* not in use.
*/
pr_debug("PM domain %s contains %s\n", name, "SCU");
genpd->flags |= GENPD_FLAG_ALWAYS_ON;
} else if (pd->flags & PD_NO_CR) {
/*
* This domain cannot be turned off.
*/
genpd->flags |= GENPD_FLAG_ALWAYS_ON;
}
if (!(pd->flags & (PD_CPU | PD_SCU))) {
/* Enable Clock Domain for I/O devices */
genpd->flags |= GENPD_FLAG_PM_CLK | GENPD_FLAG_ACTIVE_WAKEUP;
genpd->attach_dev = cpg_mssr_attach_dev;
genpd->detach_dev = cpg_mssr_detach_dev;
}
genpd->flags |= GENPD_FLAG_NO_STAY_ON;
genpd->power_off = rcar_gen4_sysc_pd_power_off;
genpd->power_on = rcar_gen4_sysc_pd_power_on;
if (pd->flags & (PD_CPU | PD_NO_CR)) {
/* Skip CPUs (handled by SMP code) and areas without control */
pr_debug("%s: Not touching %s\n", __func__, genpd->name);
goto finalize;
}
if (!rcar_gen4_sysc_power_is_off(pd->pdr)) {
pr_debug("%s: %s is already powered\n", __func__, genpd->name);
goto finalize;
}
rcar_gen4_sysc_power(pd->pdr, true);
finalize:
error = pm_genpd_init(genpd, &simple_qos_governor, false);
if (error)
pr_err("Failed to init PM domain %s: %d\n", name, error);
return error;
}
static const struct of_device_id rcar_gen4_sysc_matches[] __initconst = {
#ifdef CONFIG_SYSC_R8A779A0
Annotation
- Immediate include surface: `linux/bits.h`, `linux/clk/renesas.h`, `linux/delay.h`, `linux/err.h`, `linux/io.h`, `linux/iopoll.h`, `linux/kernel.h`, `linux/mm.h`.
- Detected declarations: `struct rcar_gen4_sysc_pd`, `struct rcar_gen4_pm_domains`, `function rcar_gen4_sysc_pwr_on_off`, `function clear_irq_flags`, `function rcar_gen4_sysc_power`, `function rcar_gen4_sysc_power_is_off`, `function rcar_gen4_sysc_pd_power_off`, `function rcar_gen4_sysc_pd_power_on`, `function rcar_gen4_sysc_pd_setup`, `function rcar_gen4_sysc_pd_init`.
- Atlas domain: Driver Families / drivers/pmdomain.
- Implementation status: integration 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.