drivers/regulator/pfuze100-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/pfuze100-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/pfuze100-regulator.c- Extension
.c- Size
- 26602 bytes
- Lines
- 857
- 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.
- 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/kernel.hlinux/module.hlinux/init.hlinux/err.hlinux/of.hlinux/of_device.hlinux/regulator/of_regulator.hlinux/platform_device.hlinux/reboot.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regulator/pfuze100.hlinux/i2c.hlinux/slab.hlinux/regmap.h
Detected Declarations
struct pfuze_regulatorstruct pfuze_chipenum chipsfunction pfuze100_set_ramp_delayfunction pfuze_parse_regulators_dtfunction pfuze_power_off_preparefunction pfuze_power_off_prepare_initfunction pfuze_identifyfunction pfuze100_regulator_probe
Annotated Snippet
struct pfuze_regulator {
struct regulator_desc desc;
unsigned char stby_reg;
unsigned char stby_mask;
bool sw_reg;
};
struct pfuze_chip {
int chip_id;
int flags;
struct regmap *regmap;
struct device *dev;
struct pfuze_regulator regulator_descs[PFUZE100_MAX_REGULATOR];
struct regulator_dev *regulators[PFUZE100_MAX_REGULATOR];
const struct pfuze_regulator *pfuze_regulators;
};
static const int pfuze100_swbst[] = {
5000000, 5050000, 5100000, 5150000,
};
static const int pfuze100_vsnvs[] = {
1000000, 1100000, 1200000, 1300000, 1500000, 1800000, 3000000,
};
static const int pfuze100_coin[] = {
2500000, 2700000, 2800000, 2900000, 3000000, 3100000, 3200000, 3300000,
};
static const int pfuze3000_sw1a[] = {
700000, 725000, 750000, 775000, 800000, 825000, 850000, 875000,
900000, 925000, 950000, 975000, 1000000, 1025000, 1050000, 1075000,
1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000,
1300000, 1325000, 1350000, 1375000, 1400000, 1425000, 1800000, 3300000,
};
static const int pfuze3000_sw2lo[] = {
1500000, 1550000, 1600000, 1650000, 1700000, 1750000, 1800000, 1850000,
};
static const int pfuze3000_sw2hi[] = {
2500000, 2800000, 2850000, 3000000, 3100000, 3150000, 3200000, 3300000,
};
static const struct of_device_id pfuze_dt_ids[] = {
{ .compatible = "fsl,pfuze100", .data = (void *)PFUZE100},
{ .compatible = "fsl,pfuze200", .data = (void *)PFUZE200},
{ .compatible = "fsl,pfuze3000", .data = (void *)PFUZE3000},
{ .compatible = "fsl,pfuze3001", .data = (void *)PFUZE3001},
{ }
};
MODULE_DEVICE_TABLE(of, pfuze_dt_ids);
static int pfuze100_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
{
struct pfuze_chip *pfuze100 = rdev_get_drvdata(rdev);
int id = rdev_get_id(rdev);
bool reg_has_ramp_delay;
unsigned int ramp_bits = 0;
int ret;
switch (pfuze100->chip_id) {
case PFUZE3001:
/* no dynamic voltage scaling for PF3001 */
reg_has_ramp_delay = false;
break;
case PFUZE3000:
reg_has_ramp_delay = (id < PFUZE3000_SWBST);
break;
case PFUZE200:
reg_has_ramp_delay = (id < PFUZE200_SWBST);
break;
case PFUZE100:
default:
reg_has_ramp_delay = (id < PFUZE100_SWBST);
break;
}
if (reg_has_ramp_delay) {
if (ramp_delay > 0) {
ramp_delay = 12500 / ramp_delay;
ramp_bits = (ramp_delay >> 1) - (ramp_delay >> 3);
}
ret = regmap_update_bits(pfuze100->regmap,
rdev->desc->vsel_reg + 4,
0xc0, ramp_bits << 6);
if (ret < 0)
dev_err(pfuze100->dev, "ramp failed, err %d\n", ret);
} else {
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/err.h`, `linux/of.h`, `linux/of_device.h`, `linux/regulator/of_regulator.h`, `linux/platform_device.h`.
- Detected declarations: `struct pfuze_regulator`, `struct pfuze_chip`, `enum chips`, `function pfuze100_set_ramp_delay`, `function pfuze_parse_regulators_dt`, `function pfuze_power_off_prepare`, `function pfuze_power_off_prepare_init`, `function pfuze_identify`, `function pfuze100_regulator_probe`.
- Atlas domain: Driver Families / drivers/regulator.
- 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.