drivers/pmdomain/bcm/bcm-pmb.c
Source file repositories/reference/linux-study-clean/drivers/pmdomain/bcm/bcm-pmb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pmdomain/bcm/bcm-pmb.c- Extension
.c- Size
- 9839 bytes
- Lines
- 364
- 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.
- 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
dt-bindings/soc/bcm-pmb.hlinux/io.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm_domain.hlinux/reset/bcm63xx_pmb.h
Detected Declarations
struct bcm_pmbstruct bcm_pmb_pd_datastruct bcm_pmb_pm_domainfunction bcm_pmb_bpcm_readfunction bcm_pmb_bpcm_writefunction bcm_pmb_power_off_zonefunction bcm_pmb_power_on_zonefunction bcm_pmb_power_off_devicefunction bcm_pmb_power_on_devicefunction bcm_pmb_power_on_satafunction bcm_pmb_power_onfunction bcm_pmb_power_offfunction bcm_pmb_probe
Annotated Snippet
struct bcm_pmb {
struct device *dev;
void __iomem *base;
spinlock_t lock;
bool little_endian;
struct genpd_onecell_data genpd_onecell_data;
};
struct bcm_pmb_pd_data {
const char * const name;
int id;
u8 bus;
u8 device;
};
struct bcm_pmb_pm_domain {
struct bcm_pmb *pmb;
const struct bcm_pmb_pd_data *data;
struct generic_pm_domain genpd;
};
static int bcm_pmb_bpcm_read(struct bcm_pmb *pmb, int bus, u8 device,
int offset, u32 *val)
{
void __iomem *base = pmb->base + bus * 0x20;
unsigned long flags;
int err;
spin_lock_irqsave(&pmb->lock, flags);
err = bpcm_rd(base, device, offset, val);
spin_unlock_irqrestore(&pmb->lock, flags);
if (!err)
*val = pmb->little_endian ? le32_to_cpu(*val) : be32_to_cpu(*val);
return err;
}
static int bcm_pmb_bpcm_write(struct bcm_pmb *pmb, int bus, u8 device,
int offset, u32 val)
{
void __iomem *base = pmb->base + bus * 0x20;
unsigned long flags;
int err;
val = pmb->little_endian ? cpu_to_le32(val) : cpu_to_be32(val);
spin_lock_irqsave(&pmb->lock, flags);
err = bpcm_wr(base, device, offset, val);
spin_unlock_irqrestore(&pmb->lock, flags);
return err;
}
static int bcm_pmb_power_off_zone(struct bcm_pmb *pmb, int bus, u8 device,
int zone)
{
int offset;
u32 val;
int err;
offset = BPCM_ZONE0 + zone * BPCM_ZONE_SIZE + BPCM_ZONE_CONTROL;
err = bcm_pmb_bpcm_read(pmb, bus, device, offset, &val);
if (err)
return err;
val |= BPCM_ZONE_CONTROL_PWR_DN_REQ;
val &= ~BPCM_ZONE_CONTROL_PWR_UP_REQ;
err = bcm_pmb_bpcm_write(pmb, bus, device, offset, val);
return err;
}
static int bcm_pmb_power_on_zone(struct bcm_pmb *pmb, int bus, u8 device,
int zone)
{
int offset;
u32 val;
int err;
offset = BPCM_ZONE0 + zone * BPCM_ZONE_SIZE + BPCM_ZONE_CONTROL;
err = bcm_pmb_bpcm_read(pmb, bus, device, offset, &val);
if (err)
return err;
if (!(val & BPCM_ZONE_CONTROL_PWR_ON_STATE)) {
val &= ~BPCM_ZONE_CONTROL_PWR_DN_REQ;
Annotation
- Immediate include surface: `dt-bindings/soc/bcm-pmb.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/pm_domain.h`, `linux/reset/bcm63xx_pmb.h`.
- Detected declarations: `struct bcm_pmb`, `struct bcm_pmb_pd_data`, `struct bcm_pmb_pm_domain`, `function bcm_pmb_bpcm_read`, `function bcm_pmb_bpcm_write`, `function bcm_pmb_power_off_zone`, `function bcm_pmb_power_on_zone`, `function bcm_pmb_power_off_device`, `function bcm_pmb_power_on_device`, `function bcm_pmb_power_on_sata`.
- Atlas domain: Driver Families / drivers/pmdomain.
- 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.