drivers/pmdomain/sunxi/sun50i-h6-prcm-ppu.c
Source file repositories/reference/linux-study-clean/drivers/pmdomain/sunxi/sun50i-h6-prcm-ppu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pmdomain/sunxi/sun50i-h6-prcm-ppu.c- Extension
.c- Size
- 5764 bytes
- Lines
- 209
- Domain
- Driver Families
- Bucket
- drivers/pmdomain
- 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/bitfield.hlinux/clk.hlinux/io.hlinux/iopoll.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm_domain.hlinux/reset.h
Detected Declarations
struct sun50i_h6_ppu_pdstruct sun50i_h6_ppu_descstruct sun50i_h6_ppu_datafunction sun50i_h6_ppu_power_statusfunction sun50i_h6_ppu_pd_set_powerfunction sun50i_h6_ppu_pd_power_onfunction sun50i_h6_ppu_pd_power_offfunction sun50i_h6_ppu_probe
Annotated Snippet
struct sun50i_h6_ppu_pd {
struct generic_pm_domain genpd;
void __iomem *reg;
u32 gate_mask;
bool negated;
};
#define FLAG_PPU_ALWAYS_ON BIT(0)
#define FLAG_PPU_NEGATED BIT(1)
struct sun50i_h6_ppu_desc {
const char *name;
u32 offset;
u32 mask;
unsigned int flags;
};
static const struct sun50i_h6_ppu_desc sun50i_h6_ppus[] = {
{ "AVCC", PD_H6_VDD_SYS_REG, PD_H6_AVCC_VDD_GATE },
{ "CPUS", PD_H6_VDD_SYS_REG, PD_H6_CPUS_VDD_GATE },
{ "GPU", PD_H6_GPU_REG, PD_H6_GPU_GATE },
};
static const struct sun50i_h6_ppu_desc sun50i_h616_ppus[] = {
{ "PLL", PD_H6_VDD_SYS_REG, PD_H6_AVCC_VDD_GATE,
FLAG_PPU_ALWAYS_ON | FLAG_PPU_NEGATED },
{ "ANA", PD_H6_VDD_SYS_REG, PD_H616_ANA_VDD_GATE, FLAG_PPU_ALWAYS_ON },
{ "GPU", PD_H6_GPU_REG, PD_H6_GPU_GATE, FLAG_PPU_NEGATED },
};
struct sun50i_h6_ppu_data {
const struct sun50i_h6_ppu_desc *descs;
int nr_domains;
};
static const struct sun50i_h6_ppu_data sun50i_h6_ppu_data = {
.descs = sun50i_h6_ppus,
.nr_domains = ARRAY_SIZE(sun50i_h6_ppus),
};
static const struct sun50i_h6_ppu_data sun50i_h616_ppu_data = {
.descs = sun50i_h616_ppus,
.nr_domains = ARRAY_SIZE(sun50i_h616_ppus),
};
#define to_sun50i_h6_ppu_pd(_genpd) \
container_of(_genpd, struct sun50i_h6_ppu_pd, genpd)
static bool sun50i_h6_ppu_power_status(const struct sun50i_h6_ppu_pd *pd)
{
bool bit = readl(pd->reg) & pd->gate_mask;
return bit ^ pd->negated;
}
static int sun50i_h6_ppu_pd_set_power(const struct sun50i_h6_ppu_pd *pd,
bool set_bit)
{
u32 reg = readl(pd->reg);
if (set_bit)
writel(reg | pd->gate_mask, pd->reg);
else
writel(reg & ~pd->gate_mask, pd->reg);
return 0;
}
static int sun50i_h6_ppu_pd_power_on(struct generic_pm_domain *genpd)
{
const struct sun50i_h6_ppu_pd *pd = to_sun50i_h6_ppu_pd(genpd);
return sun50i_h6_ppu_pd_set_power(pd, !pd->negated);
}
static int sun50i_h6_ppu_pd_power_off(struct generic_pm_domain *genpd)
{
const struct sun50i_h6_ppu_pd *pd = to_sun50i_h6_ppu_pd(genpd);
return sun50i_h6_ppu_pd_set_power(pd, pd->negated);
}
static int sun50i_h6_ppu_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct genpd_onecell_data *ppu;
struct sun50i_h6_ppu_pd *pds;
const struct sun50i_h6_ppu_data *data;
void __iomem *base;
int ret, i;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/io.h`, `linux/iopoll.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/pm_domain.h`.
- Detected declarations: `struct sun50i_h6_ppu_pd`, `struct sun50i_h6_ppu_desc`, `struct sun50i_h6_ppu_data`, `function sun50i_h6_ppu_power_status`, `function sun50i_h6_ppu_pd_set_power`, `function sun50i_h6_ppu_pd_power_on`, `function sun50i_h6_ppu_pd_power_off`, `function sun50i_h6_ppu_probe`.
- Atlas domain: Driver Families / drivers/pmdomain.
- 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.