drivers/regulator/stpmic1_regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/stpmic1_regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/stpmic1_regulator.c- Extension
.c- Size
- 18382 bytes
- Lines
- 652
- Domain
- Driver Families
- Bucket
- drivers/regulator
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/interrupt.hlinux/mfd/stpmic1.hlinux/module.hlinux/of_irq.hlinux/platform_device.hlinux/regmap.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regulator/of_regulator.hdt-bindings/mfd/st,stpmic1.h
Detected Declarations
struct stpmic1_regulator_cfgfunction stpmic1_map_modefunction stpmic1_get_modefunction stpmic1_set_modefunction stpmic1_set_iccfunction stpmic1_curlim_irq_handlerfunction stpmic1_regulator_registerfunction stpmic1_regulator_probe
Annotated Snippet
struct stpmic1_regulator_cfg {
struct regulator_desc desc;
u8 mask_reset_reg;
u8 mask_reset_mask;
u8 icc_reg;
u8 icc_mask;
};
static int stpmic1_set_mode(struct regulator_dev *rdev, unsigned int mode);
static unsigned int stpmic1_get_mode(struct regulator_dev *rdev);
static int stpmic1_set_icc(struct regulator_dev *rdev, int lim, int severity,
bool enable);
static unsigned int stpmic1_map_mode(unsigned int mode);
enum {
STPMIC1_BUCK1 = 0,
STPMIC1_BUCK2 = 1,
STPMIC1_BUCK3 = 2,
STPMIC1_BUCK4 = 3,
STPMIC1_LDO1 = 4,
STPMIC1_LDO2 = 5,
STPMIC1_LDO3 = 6,
STPMIC1_LDO4 = 7,
STPMIC1_LDO5 = 8,
STPMIC1_LDO6 = 9,
STPMIC1_VREF_DDR = 10,
STPMIC1_BOOST = 11,
STPMIC1_VBUS_OTG = 12,
STPMIC1_SW_OUT = 13,
};
/* Enable time worst case is 5000mV/(2250uV/uS) */
#define PMIC_ENABLE_TIME_US 2200
/* Ramp delay worst case is (2250uV/uS) */
#define PMIC_RAMP_DELAY 2200
static const struct linear_range buck1_ranges[] = {
REGULATOR_LINEAR_RANGE(725000, 0, 4, 0),
REGULATOR_LINEAR_RANGE(725000, 5, 36, 25000),
REGULATOR_LINEAR_RANGE(1500000, 37, 63, 0),
};
static const struct linear_range buck2_ranges[] = {
REGULATOR_LINEAR_RANGE(1000000, 0, 17, 0),
REGULATOR_LINEAR_RANGE(1050000, 18, 19, 0),
REGULATOR_LINEAR_RANGE(1100000, 20, 21, 0),
REGULATOR_LINEAR_RANGE(1150000, 22, 23, 0),
REGULATOR_LINEAR_RANGE(1200000, 24, 25, 0),
REGULATOR_LINEAR_RANGE(1250000, 26, 27, 0),
REGULATOR_LINEAR_RANGE(1300000, 28, 29, 0),
REGULATOR_LINEAR_RANGE(1350000, 30, 31, 0),
REGULATOR_LINEAR_RANGE(1400000, 32, 33, 0),
REGULATOR_LINEAR_RANGE(1450000, 34, 35, 0),
REGULATOR_LINEAR_RANGE(1500000, 36, 63, 0),
};
static const struct linear_range buck3_ranges[] = {
REGULATOR_LINEAR_RANGE(1000000, 0, 19, 0),
REGULATOR_LINEAR_RANGE(1100000, 20, 23, 0),
REGULATOR_LINEAR_RANGE(1200000, 24, 27, 0),
REGULATOR_LINEAR_RANGE(1300000, 28, 31, 0),
REGULATOR_LINEAR_RANGE(1400000, 32, 35, 0),
REGULATOR_LINEAR_RANGE(1500000, 36, 55, 100000),
REGULATOR_LINEAR_RANGE(3400000, 56, 63, 0),
};
static const struct linear_range buck4_ranges[] = {
REGULATOR_LINEAR_RANGE(600000, 0, 27, 25000),
REGULATOR_LINEAR_RANGE(1300000, 28, 29, 0),
REGULATOR_LINEAR_RANGE(1350000, 30, 31, 0),
REGULATOR_LINEAR_RANGE(1400000, 32, 33, 0),
REGULATOR_LINEAR_RANGE(1450000, 34, 35, 0),
REGULATOR_LINEAR_RANGE(1500000, 36, 60, 100000),
REGULATOR_LINEAR_RANGE(3900000, 61, 63, 0),
};
static const struct linear_range ldo1_ranges[] = {
REGULATOR_LINEAR_RANGE(1700000, 0, 7, 0),
REGULATOR_LINEAR_RANGE(1700000, 8, 24, 100000),
REGULATOR_LINEAR_RANGE(3300000, 25, 31, 0),
};
static const struct linear_range ldo2_ranges[] = {
REGULATOR_LINEAR_RANGE(1700000, 0, 7, 0),
REGULATOR_LINEAR_RANGE(1700000, 8, 24, 100000),
REGULATOR_LINEAR_RANGE(3300000, 25, 30, 0),
};
static const struct linear_range ldo3_ranges[] = {
REGULATOR_LINEAR_RANGE(1700000, 0, 7, 0),
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/mfd/stpmic1.h`, `linux/module.h`, `linux/of_irq.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/regulator/driver.h`, `linux/regulator/machine.h`.
- Detected declarations: `struct stpmic1_regulator_cfg`, `function stpmic1_map_mode`, `function stpmic1_get_mode`, `function stpmic1_set_mode`, `function stpmic1_set_icc`, `function stpmic1_curlim_irq_handler`, `function stpmic1_regulator_register`, `function stpmic1_regulator_probe`.
- Atlas domain: Driver Families / drivers/regulator.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.