drivers/spmi/spmi-pmic-arb.c
Source file repositories/reference/linux-study-clean/drivers/spmi/spmi-pmic-arb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/spmi/spmi-pmic-arb.c- Extension
.c- Size
- 57806 bytes
- Lines
- 2101
- Domain
- Driver Families
- Bucket
- drivers/spmi
- 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
linux/bitfield.hlinux/bitmap.hlinux/delay.hlinux/err.hlinux/interrupt.hlinux/io.hlinux/irqchip/chained_irq.hlinux/irqdomain.hlinux/irq.hlinux/kernel.hlinux/module.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/platform_device.hlinux/slab.hlinux/spmi.h
Detected Declarations
struct pmic_arb_ver_opsstruct apid_datastruct spmi_pmic_arbstruct spmi_pmic_arb_busstruct spmi_pmic_arbstruct pmic_arb_ver_opsstruct spmi_pmic_arb_qpnpint_typeenum pmic_arb_chnl_statusenum pmic_arb_cmd_op_codeenum pmic_arb_channelenum qpnpint_regsfunction pmic_arb_base_writefunction pmic_arb_set_rd_cmdfunction pmic_arb_read_datafunction pmic_arb_write_datafunction pmic_arb_wait_for_donefunction pmic_arb_non_data_cmd_v1function pmic_arb_non_data_cmd_v2function pmic_arb_cmdfunction pmic_arb_fmt_read_cmdfunction pmic_arb_read_cmd_unlockedfunction pmic_arb_read_cmdfunction pmic_arb_fmt_write_cmdfunction pmic_arb_write_cmd_unlockedfunction pmic_arb_write_cmdfunction pmic_arb_masked_writefunction qpnpint_spmi_writefunction qpnpint_spmi_readfunction qpnpint_spmi_masked_writefunction cleanup_irqfunction periph_interruptfunction pmic_arb_chained_irqfunction qpnpint_irq_ackfunction qpnpint_irq_maskfunction qpnpint_irq_unmaskfunction qpnpint_irq_set_typefunction qpnpint_irq_set_wakefunction qpnpint_get_irqchip_statefunction qpnpint_irq_domain_activatefunction qpnpint_irq_domain_translatefunction qpnpint_irq_domain_mapfunction qpnpint_irq_domain_allocfunction pmic_arb_init_apid_min_maxfunction pmic_arb_get_core_resources_v1function pmic_arb_init_apid_v1function pmic_arb_ppid_to_apid_v1function pmic_arb_offset_v1function pmic_arb_find_apid
Annotated Snippet
struct apid_data {
u16 ppid;
u8 write_ee;
u8 irq_ee;
};
struct spmi_pmic_arb;
/**
* struct spmi_pmic_arb_bus - SPMI PMIC Arbiter Bus object
*
* @pmic_arb: the SPMI PMIC Arbiter the bus belongs to.
* @domain: irq domain object for PMIC IRQ domain
* @intr: address of the SPMI interrupt control registers.
* @cnfg: address of the PMIC Arbiter configuration registers.
* @apid_owner: on v8: address of APID owner mapping table registers
* @spmic: spmi controller registered for this bus
* @lock: lock to synchronize accesses.
* @base_apid: on v7 and v8: minimum APID associated with the
* particular SPMI bus instance
* @apid_count: on v5, v7 and v8: number of APIDs associated with the
* particular SPMI bus instance
* @mapping_table: in-memory copy of PPID -> APID mapping table.
* @mapping_table_valid:bitmap containing valid-only periphs
* @ppid_to_apid: in-memory copy of PPID -> APID mapping table.
* @last_apid: Highest value APID in use
* @apid_data: Table of data for all APIDs
* @min_apid: minimum APID (used for bounding IRQ search)
* @max_apid: maximum APID
* @irq: PMIC ARB interrupt.
* @id: unique ID of the bus
*/
struct spmi_pmic_arb_bus {
struct spmi_pmic_arb *pmic_arb;
struct irq_domain *domain;
void __iomem *intr;
void __iomem *cnfg;
void __iomem *apid_owner;
struct spmi_controller *spmic;
raw_spinlock_t lock;
u16 base_apid;
int apid_count;
u32 *mapping_table;
DECLARE_BITMAP(mapping_table_valid, PMIC_ARB_MAX_PERIPHS);
u16 *ppid_to_apid;
u16 last_apid;
struct apid_data *apid_data;
u16 min_apid;
u16 max_apid;
int irq;
u8 id;
};
/**
* struct spmi_pmic_arb - SPMI PMIC Arbiter object
*
* @rd_base: on v1 "core", on v2 "observer" register base off DT.
* @wr_base: on v1 "core", on v2 "chnls" register base off DT.
* @core: core register base for v2 and above only (see above)
* @core_size: core register base size
* @apid_map: on v8, APID mapping table register base
* @channel: execution environment channel to use for accesses.
* @ee: the current Execution Environment
* @ver_ops: version dependent operations.
* @max_periphs: Number of elements in apid_data[]
* @buses: per arbiter buses instances
* @buses_available: number of buses registered
*/
struct spmi_pmic_arb {
void __iomem *rd_base;
void __iomem *wr_base;
void __iomem *core;
resource_size_t core_size;
void __iomem *apid_map;
u8 channel;
u8 ee;
const struct pmic_arb_ver_ops *ver_ops;
int max_periphs;
struct spmi_pmic_arb_bus *buses[PMIC_ARB_MAX_BUSES];
int buses_available;
};
/**
* struct pmic_arb_ver_ops - version dependent functionality.
*
* @ver_str: version string.
* @get_core_resources: initializes the core, observer and channels
* @get_bus_resources: requests per-SPMI bus register resources
* @init_apid: finds the apid base and count
* @ppid_to_apid: finds the apid for a given ppid.
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitmap.h`, `linux/delay.h`, `linux/err.h`, `linux/interrupt.h`, `linux/io.h`, `linux/irqchip/chained_irq.h`, `linux/irqdomain.h`.
- Detected declarations: `struct pmic_arb_ver_ops`, `struct apid_data`, `struct spmi_pmic_arb`, `struct spmi_pmic_arb_bus`, `struct spmi_pmic_arb`, `struct pmic_arb_ver_ops`, `struct spmi_pmic_arb_qpnpint_type`, `enum pmic_arb_chnl_status`, `enum pmic_arb_cmd_op_code`, `enum pmic_arb_channel`.
- Atlas domain: Driver Families / drivers/spmi.
- 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.