drivers/regulator/pv88090-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/pv88090-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/pv88090-regulator.c- Extension
.c- Size
- 10477 bytes
- Lines
- 412
- 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/i2c.hlinux/module.hlinux/init.hlinux/slab.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regmap.hlinux/irq.hlinux/interrupt.hlinux/regulator/of_regulator.hpv88090-regulator.h
Detected Declarations
struct pv88090_regulatorstruct pv88090struct pv88090_buck_voltagefunction pv88090_buck_get_modefunction pv88090_buck_set_modefunction pv88090_irq_handlerfunction pv88090_i2c_probe
Annotated Snippet
struct pv88090_regulator {
struct regulator_desc desc;
unsigned int conf;
unsigned int conf2;
};
struct pv88090 {
struct device *dev;
struct regmap *regmap;
struct regulator_dev *rdev[PV88090_MAX_REGULATORS];
};
struct pv88090_buck_voltage {
int min_uV;
int max_uV;
int uV_step;
};
static const struct regmap_config pv88090_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
};
/* Current limits array (in uA) for BUCK1, BUCK2, BUCK3.
* Entry indexes corresponds to register values.
*/
static const unsigned int pv88090_buck1_limits[] = {
220000, 440000, 660000, 880000, 1100000, 1320000, 1540000, 1760000,
1980000, 2200000, 2420000, 2640000, 2860000, 3080000, 3300000, 3520000,
3740000, 3960000, 4180000, 4400000, 4620000, 4840000, 5060000, 5280000,
5500000, 5720000, 5940000, 6160000, 6380000, 6600000, 6820000, 7040000
};
static const unsigned int pv88090_buck23_limits[] = {
1496000, 2393000, 3291000, 4189000
};
static const struct pv88090_buck_voltage pv88090_buck_vol[3] = {
{
.min_uV = 600000,
.max_uV = 1393750,
.uV_step = 6250,
},
{
.min_uV = 1400000,
.max_uV = 2193750,
.uV_step = 6250,
},
{
.min_uV = 1250000,
.max_uV = 2837500,
.uV_step = 12500,
},
};
static unsigned int pv88090_buck_get_mode(struct regulator_dev *rdev)
{
struct pv88090_regulator *info = rdev_get_drvdata(rdev);
unsigned int data;
int ret, mode = 0;
ret = regmap_read(rdev->regmap, info->conf, &data);
if (ret < 0)
return ret;
switch (data & PV88090_BUCK1_MODE_MASK) {
case PV88090_BUCK_MODE_SYNC:
mode = REGULATOR_MODE_FAST;
break;
case PV88090_BUCK_MODE_AUTO:
mode = REGULATOR_MODE_NORMAL;
break;
case PV88090_BUCK_MODE_SLEEP:
mode = REGULATOR_MODE_STANDBY;
break;
}
return mode;
}
static int pv88090_buck_set_mode(struct regulator_dev *rdev,
unsigned int mode)
{
struct pv88090_regulator *info = rdev_get_drvdata(rdev);
int val = 0;
switch (mode) {
case REGULATOR_MODE_FAST:
Annotation
- Immediate include surface: `linux/err.h`, `linux/i2c.h`, `linux/module.h`, `linux/init.h`, `linux/slab.h`, `linux/regulator/driver.h`, `linux/regulator/machine.h`, `linux/regmap.h`.
- Detected declarations: `struct pv88090_regulator`, `struct pv88090`, `struct pv88090_buck_voltage`, `function pv88090_buck_get_mode`, `function pv88090_buck_set_mode`, `function pv88090_irq_handler`, `function pv88090_i2c_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.