drivers/pmdomain/amlogic/meson-secure-pwrc.c
Source file repositories/reference/linux-study-clean/drivers/pmdomain/amlogic/meson-secure-pwrc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pmdomain/amlogic/meson-secure-pwrc.c- Extension
.c- Size
- 14729 bytes
- Lines
- 509
- 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/io.hlinux/of.hlinux/platform_device.hlinux/pm_domain.hdt-bindings/power/meson-a1-power.hdt-bindings/power/amlogic,c3-pwrc.hdt-bindings/power/meson-s4-power.hdt-bindings/power/amlogic,t7-pwrc.hdt-bindings/power/amlogic,a4-pwrc.hdt-bindings/power/amlogic,a5-pwrc.hdt-bindings/power/amlogic,s6-pwrc.hdt-bindings/power/amlogic,s7-pwrc.hdt-bindings/power/amlogic,s7d-pwrc.hlinux/arm-smccc.hlinux/firmware/meson/meson_sm.hlinux/module.h
Detected Declarations
struct meson_secure_pwrc_domainstruct meson_secure_pwrcstruct meson_secure_pwrc_domain_descstruct meson_secure_pwrc_domain_datafunction pwrc_secure_is_offfunction meson_secure_pwrc_offfunction meson_secure_pwrc_onfunction meson_secure_pwrc_probe
Annotated Snippet
struct meson_secure_pwrc_domain {
struct generic_pm_domain base;
unsigned int index;
unsigned int parent;
struct meson_secure_pwrc *pwrc;
};
struct meson_secure_pwrc {
struct meson_secure_pwrc_domain *domains;
struct genpd_onecell_data xlate;
struct meson_sm_firmware *fw;
};
struct meson_secure_pwrc_domain_desc {
unsigned int index;
unsigned int parent;
unsigned int flags;
char *name;
bool (*is_off)(struct meson_secure_pwrc_domain *pwrc_domain);
};
struct meson_secure_pwrc_domain_data {
unsigned int count;
const struct meson_secure_pwrc_domain_desc *domains;
};
static bool pwrc_secure_is_off(struct meson_secure_pwrc_domain *pwrc_domain)
{
int is_off = 1;
if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_GET, &is_off,
pwrc_domain->index, 0, 0, 0, 0) < 0)
pr_err("failed to get power domain status\n");
return is_off;
}
static int meson_secure_pwrc_off(struct generic_pm_domain *domain)
{
int ret = 0;
struct meson_secure_pwrc_domain *pwrc_domain =
container_of(domain, struct meson_secure_pwrc_domain, base);
if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_SET, NULL,
pwrc_domain->index, PWRC_OFF, 0, 0, 0) < 0) {
pr_err("failed to set power domain off\n");
ret = -EINVAL;
}
return ret;
}
static int meson_secure_pwrc_on(struct generic_pm_domain *domain)
{
int ret = 0;
struct meson_secure_pwrc_domain *pwrc_domain =
container_of(domain, struct meson_secure_pwrc_domain, base);
if (meson_sm_call(pwrc_domain->pwrc->fw, SM_A1_PWRC_SET, NULL,
pwrc_domain->index, PWRC_ON, 0, 0, 0) < 0) {
pr_err("failed to set power domain on\n");
ret = -EINVAL;
}
return ret;
}
#define SEC_PD(__name, __flag) \
[PWRC_##__name##_ID] = \
{ \
.name = #__name, \
.index = PWRC_##__name##_ID, \
.is_off = pwrc_secure_is_off, \
.flags = __flag, \
.parent = PWRC_NO_PARENT, \
}
#define TOP_PD(__name, __flag, __parent) \
[PWRC_##__name##_ID] = \
{ \
.name = #__name, \
.index = PWRC_##__name##_ID, \
.is_off = pwrc_secure_is_off, \
.flags = __flag, \
.parent = __parent, \
}
static const struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
SEC_PD(DSPA, 0),
SEC_PD(DSPB, 0),
Annotation
- Immediate include surface: `linux/io.h`, `linux/of.h`, `linux/platform_device.h`, `linux/pm_domain.h`, `dt-bindings/power/meson-a1-power.h`, `dt-bindings/power/amlogic,c3-pwrc.h`, `dt-bindings/power/meson-s4-power.h`, `dt-bindings/power/amlogic,t7-pwrc.h`.
- Detected declarations: `struct meson_secure_pwrc_domain`, `struct meson_secure_pwrc`, `struct meson_secure_pwrc_domain_desc`, `struct meson_secure_pwrc_domain_data`, `function pwrc_secure_is_off`, `function meson_secure_pwrc_off`, `function meson_secure_pwrc_on`, `function meson_secure_pwrc_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.