drivers/soc/qcom/spm.c
Source file repositories/reference/linux-study-clean/drivers/soc/qcom/spm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/qcom/spm.c- Extension
.c- Size
- 15990 bytes
- Lines
- 577
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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/bitfield.hlinux/err.hlinux/init.hlinux/io.hlinux/iopoll.hlinux/kernel.hlinux/linear_range.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/slab.hlinux/smp.hlinux/regulator/driver.hsoc/qcom/spm.h
Detected Declarations
struct spm_reg_datastruct spm_driver_dataenum spm_regfunction spm_register_writefunction spm_register_write_syncfunction spm_register_readfunction spm_set_low_power_modefunction spm_set_voltage_selfunction spm_get_voltage_selfunction smp_set_vdd_v1_1function spm_get_cpufunction for_each_possible_cpufunction spm_register_regulatorfunction spm_dev_probefunction qcom_spm_init
Annotated Snippet
struct spm_reg_data {
const u16 *reg_offset;
u32 spm_cfg;
u32 spm_dly;
u32 pmic_dly;
u32 pmic_data[MAX_PMIC_DATA];
u32 avs_ctl;
u32 avs_limit;
u8 seq[MAX_SEQ_DATA];
u8 start_index[PM_SLEEP_MODE_NR];
smp_call_func_t set_vdd;
/* for now we support only a single range */
struct linear_range *range;
unsigned int ramp_delay;
unsigned int init_uV;
};
struct spm_driver_data {
void __iomem *reg_base;
const struct spm_reg_data *reg_data;
struct device *dev;
unsigned int volt_sel;
int reg_cpu;
};
static const u16 spm_reg_offset_v4_1[SPM_REG_NR] = {
[SPM_REG_AVS_CTL] = 0x904,
[SPM_REG_AVS_LIMIT] = 0x908,
};
static const struct spm_reg_data spm_reg_660_gold_l2 = {
.reg_offset = spm_reg_offset_v4_1,
.avs_ctl = 0x1010031,
.avs_limit = 0x4580458,
};
static const struct spm_reg_data spm_reg_660_silver_l2 = {
.reg_offset = spm_reg_offset_v4_1,
.avs_ctl = 0x101c031,
.avs_limit = 0x4580458,
};
static const struct spm_reg_data spm_reg_8998_gold_l2 = {
.reg_offset = spm_reg_offset_v4_1,
.avs_ctl = 0x1010031,
.avs_limit = 0x4700470,
};
static const struct spm_reg_data spm_reg_8998_silver_l2 = {
.reg_offset = spm_reg_offset_v4_1,
.avs_ctl = 0x1010031,
.avs_limit = 0x4200420,
};
static const u16 spm_reg_offset_v3_0[SPM_REG_NR] = {
[SPM_REG_CFG] = 0x08,
[SPM_REG_SPM_CTL] = 0x30,
[SPM_REG_DLY] = 0x34,
[SPM_REG_SEQ_ENTRY] = 0x400,
};
/* SPM register data for 8909 */
static const struct spm_reg_data spm_reg_8909_cpu = {
.reg_offset = spm_reg_offset_v3_0,
.spm_cfg = 0x1,
.spm_dly = 0x3C102800,
.seq = { 0x60, 0x03, 0x60, 0x0B, 0x0F, 0x20, 0x10, 0x80, 0x30, 0x90,
0x5B, 0x60, 0x03, 0x60, 0x76, 0x76, 0x0B, 0x94, 0x5B, 0x80,
0x10, 0x26, 0x30, 0x0F },
.start_index[PM_SLEEP_MODE_STBY] = 0,
.start_index[PM_SLEEP_MODE_SPC] = 5,
};
/* SPM register data for 8916 */
static const struct spm_reg_data spm_reg_8916_cpu = {
.reg_offset = spm_reg_offset_v3_0,
.spm_cfg = 0x1,
.spm_dly = 0x3C102800,
.seq = { 0x60, 0x03, 0x60, 0x0B, 0x0F, 0x20, 0x10, 0x80, 0x30, 0x90,
0x5B, 0x60, 0x03, 0x60, 0x3B, 0x76, 0x76, 0x0B, 0x94, 0x5B,
0x80, 0x10, 0x26, 0x30, 0x0F },
.start_index[PM_SLEEP_MODE_STBY] = 0,
.start_index[PM_SLEEP_MODE_SPC] = 5,
};
static const struct spm_reg_data spm_reg_8939_cpu = {
.reg_offset = spm_reg_offset_v3_0,
.spm_cfg = 0x1,
.spm_dly = 0x3C102800,
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/err.h`, `linux/init.h`, `linux/io.h`, `linux/iopoll.h`, `linux/kernel.h`, `linux/linear_range.h`, `linux/module.h`.
- Detected declarations: `struct spm_reg_data`, `struct spm_driver_data`, `enum spm_reg`, `function spm_register_write`, `function spm_register_write_sync`, `function spm_register_read`, `function spm_set_low_power_mode`, `function spm_set_voltage_sel`, `function spm_get_voltage_sel`, `function smp_set_vdd_v1_1`.
- Atlas domain: Driver Families / drivers/soc.
- 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.