drivers/pmdomain/actions/owl-sps.c
Source file repositories/reference/linux-study-clean/drivers/pmdomain/actions/owl-sps.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pmdomain/actions/owl-sps.c- Extension
.c- Size
- 6427 bytes
- Lines
- 315
- 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.
- 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/mod_devicetable.hlinux/of_address.hlinux/platform_device.hlinux/property.hlinux/pm_domain.hlinux/soc/actions/owl-sps.hdt-bindings/power/owl-s500-powergate.hdt-bindings/power/owl-s700-powergate.hdt-bindings/power/owl-s900-powergate.h
Detected Declarations
struct owl_sps_domain_infostruct owl_sps_infostruct owl_spsstruct owl_sps_domainfunction owl_sps_set_powerfunction owl_sps_power_onfunction owl_sps_power_offfunction owl_sps_init_domainfunction owl_sps_probefunction owl_sps_init
Annotated Snippet
struct owl_sps_domain_info {
const char *name;
int pwr_bit;
int ack_bit;
unsigned int genpd_flags;
};
struct owl_sps_info {
unsigned num_domains;
const struct owl_sps_domain_info *domains;
};
struct owl_sps {
struct device *dev;
const struct owl_sps_info *info;
void __iomem *base;
struct genpd_onecell_data genpd_data;
struct generic_pm_domain *domains[];
};
#define to_owl_pd(gpd) container_of(gpd, struct owl_sps_domain, genpd)
struct owl_sps_domain {
struct generic_pm_domain genpd;
const struct owl_sps_domain_info *info;
struct owl_sps *sps;
};
static int owl_sps_set_power(struct owl_sps_domain *pd, bool enable)
{
u32 pwr_mask, ack_mask;
ack_mask = BIT(pd->info->ack_bit);
pwr_mask = BIT(pd->info->pwr_bit);
return owl_sps_set_pg(pd->sps->base, pwr_mask, ack_mask, enable);
}
static int owl_sps_power_on(struct generic_pm_domain *domain)
{
struct owl_sps_domain *pd = to_owl_pd(domain);
dev_dbg(pd->sps->dev, "%s power on", pd->info->name);
return owl_sps_set_power(pd, true);
}
static int owl_sps_power_off(struct generic_pm_domain *domain)
{
struct owl_sps_domain *pd = to_owl_pd(domain);
dev_dbg(pd->sps->dev, "%s power off", pd->info->name);
return owl_sps_set_power(pd, false);
}
static int owl_sps_init_domain(struct owl_sps *sps, int index)
{
struct owl_sps_domain *pd;
pd = devm_kzalloc(sps->dev, sizeof(*pd), GFP_KERNEL);
if (!pd)
return -ENOMEM;
pd->info = &sps->info->domains[index];
pd->sps = sps;
pd->genpd.name = pd->info->name;
pd->genpd.power_on = owl_sps_power_on;
pd->genpd.power_off = owl_sps_power_off;
pd->genpd.flags = pd->info->genpd_flags;
pm_genpd_init(&pd->genpd, NULL, false);
sps->genpd_data.domains[index] = &pd->genpd;
return 0;
}
static int owl_sps_probe(struct platform_device *pdev)
{
const struct owl_sps_info *sps_info;
struct owl_sps *sps;
int i, ret;
sps_info = device_get_match_data(&pdev->dev);
if (!sps_info) {
dev_err(&pdev->dev, "unknown compatible or missing data\n");
return -EINVAL;
}
Annotation
- Immediate include surface: `linux/mod_devicetable.h`, `linux/of_address.h`, `linux/platform_device.h`, `linux/property.h`, `linux/pm_domain.h`, `linux/soc/actions/owl-sps.h`, `dt-bindings/power/owl-s500-powergate.h`, `dt-bindings/power/owl-s700-powergate.h`.
- Detected declarations: `struct owl_sps_domain_info`, `struct owl_sps_info`, `struct owl_sps`, `struct owl_sps_domain`, `function owl_sps_set_power`, `function owl_sps_power_on`, `function owl_sps_power_off`, `function owl_sps_init_domain`, `function owl_sps_probe`, `function owl_sps_init`.
- Atlas domain: Driver Families / drivers/pmdomain.
- Implementation status: integration 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.