drivers/regulator/pf1550-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/pf1550-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/pf1550-regulator.c- Extension
.c- Size
- 13219 bytes
- Lines
- 429
- 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.
- 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/err.hlinux/interrupt.hlinux/mfd/pf1550.hlinux/module.hlinux/platform_device.hlinux/regulator/driver.hlinux/regulator/machine.h
Detected Declarations
struct pf1550_descstruct pf1550_regulator_infofunction pf1550_set_ramp_delayfunction pf1550_set_suspend_enablefunction pf1550_set_suspend_disablefunction pf1550_buck_set_table_suspend_voltagefunction pf1550_buck_set_linear_suspend_voltagefunction pf1550_regulator_irq_handlerfunction pf1550_regulator_probe
Annotated Snippet
struct pf1550_desc {
struct regulator_desc desc;
unsigned char stby_reg;
unsigned char stby_mask;
unsigned char stby_enable_reg;
unsigned char stby_enable_mask;
};
struct pf1550_regulator_info {
struct device *dev;
const struct pf1550_ddata *pf1550;
struct pf1550_desc regulator_descs[PF1550_MAX_REGULATOR];
struct regulator_dev *rdevs[PF1550_MAX_REGULATOR];
};
static const int pf1550_sw12_volts[] = {
1100000, 1200000, 1350000, 1500000, 1800000, 2500000, 3000000, 3300000,
};
static const int pf1550_ldo13_volts[] = {
750000, 800000, 850000, 900000, 950000, 1000000, 1050000, 1100000,
1150000, 1200000, 1250000, 1300000, 1350000, 1400000, 1450000, 1500000,
1800000, 1900000, 2000000, 2100000, 2200000, 2300000, 2400000, 2500000,
2600000, 2700000, 2800000, 2900000, 3000000, 3100000, 3200000, 3300000,
};
static int pf1550_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
{
int id = rdev_get_id(rdev);
unsigned int ramp_bits = 0;
int ret;
if (id > PF1550_VREFDDR)
return -EACCES;
if (ramp_delay < 0 || ramp_delay > 6250)
return -EINVAL;
ramp_delay = 6250 / ramp_delay;
ramp_bits = ramp_delay >> 1;
ret = regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg + 4, 0x10,
ramp_bits << 4);
if (ret < 0)
dev_err(&rdev->dev, "ramp failed, err %d\n", ret);
return ret;
}
static int pf1550_set_suspend_enable(struct regulator_dev *rdev)
{
const struct pf1550_desc *desc = container_of_const(rdev->desc,
struct pf1550_desc,
desc);
unsigned int val = desc->stby_enable_mask;
return regmap_update_bits(rdev->regmap, desc->stby_enable_reg,
desc->stby_enable_mask, val);
}
static int pf1550_set_suspend_disable(struct regulator_dev *rdev)
{
const struct pf1550_desc *desc = container_of_const(rdev->desc,
struct pf1550_desc,
desc);
return regmap_update_bits(rdev->regmap, desc->stby_enable_reg,
desc->stby_enable_mask, 0);
}
static int pf1550_buck_set_table_suspend_voltage(struct regulator_dev *rdev,
int uV)
{
const struct pf1550_desc *desc = container_of_const(rdev->desc,
struct pf1550_desc,
desc);
int ret;
ret = regulator_map_voltage_ascend(rdev, uV, uV);
if (ret < 0) {
dev_err(rdev_get_dev(rdev), "failed to map %i uV\n", uV);
return ret;
}
return regmap_update_bits(rdev->regmap, desc->stby_reg,
desc->stby_mask, ret);
}
static int pf1550_buck_set_linear_suspend_voltage(struct regulator_dev *rdev,
int uV)
Annotation
- Immediate include surface: `linux/err.h`, `linux/interrupt.h`, `linux/mfd/pf1550.h`, `linux/module.h`, `linux/platform_device.h`, `linux/regulator/driver.h`, `linux/regulator/machine.h`.
- Detected declarations: `struct pf1550_desc`, `struct pf1550_regulator_info`, `function pf1550_set_ramp_delay`, `function pf1550_set_suspend_enable`, `function pf1550_set_suspend_disable`, `function pf1550_buck_set_table_suspend_voltage`, `function pf1550_buck_set_linear_suspend_voltage`, `function pf1550_regulator_irq_handler`, `function pf1550_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.