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.

Dependency Surface

Detected Declarations

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

Implementation Notes