drivers/regulator/max77826-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/max77826-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/max77826-regulator.c- Extension
.c- Size
- 8070 bytes
- Lines
- 300
- 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/platform_device.hlinux/regulator/driver.hlinux/regulator/of_regulator.hlinux/i2c.hlinux/regmap.h
Detected Declarations
struct max77826_regulator_infoenum max77826_registersenum max77826_regulatorsfunction max77826_set_voltage_time_selfunction max77826_read_device_idfunction max77826_i2c_probe
Annotated Snippet
struct max77826_regulator_info {
struct regmap *regmap;
};
static const struct regmap_config max77826_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = MAX77826_REG_DEVICE_ID,
};
static int max77826_set_voltage_time_sel(struct regulator_dev *,
unsigned int old_selector,
unsigned int new_selector);
static const struct regulator_ops max77826_most_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
};
static const struct regulator_ops max77826_buck_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.set_voltage_time_sel = max77826_set_voltage_time_sel,
};
static const struct regulator_desc max77826_regulators_desc[] = {
MAX77826_LDO(1, NMOS),
MAX77826_LDO(2, NMOS),
MAX77826_LDO(3, NMOS),
MAX77826_LDO(4, PMOS),
MAX77826_LDO(5, PMOS),
MAX77826_LDO(6, PMOS),
MAX77826_LDO(7, PMOS),
MAX77826_LDO(8, PMOS),
MAX77826_LDO(9, PMOS),
MAX77826_LDO(10, PMOS),
MAX77826_LDO(11, PMOS),
MAX77826_LDO(12, PMOS),
MAX77826_LDO(13, PMOS),
MAX77826_LDO(14, PMOS),
MAX77826_LDO(15, PMOS),
MAX77826_BUCK(0, BUCK, max77826_buck_ops),
MAX77826_BUCK(1, BUCKBOOST, max77826_most_ops),
};
static int max77826_set_voltage_time_sel(struct regulator_dev *rdev,
unsigned int old_selector,
unsigned int new_selector)
{
if (new_selector > old_selector) {
return DIV_ROUND_UP(MAX77826_BUCK_VOLT_STEP *
(new_selector - old_selector),
MAX77826_BUCK_RAMP_DELAY);
}
return 0;
}
static int max77826_read_device_id(struct regmap *regmap, struct device *dev)
{
unsigned int device_id;
int res;
res = regmap_read(regmap, MAX77826_REG_DEVICE_ID, &device_id);
if (!res)
dev_dbg(dev, "DEVICE_ID: 0x%x\n", device_id);
return res;
}
static int max77826_i2c_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct max77826_regulator_info *info;
struct regulator_config config = {};
struct regulator_dev *rdev;
struct regmap *regmap;
int i;
info = devm_kzalloc(dev, sizeof(struct max77826_regulator_info),
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/err.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regulator/driver.h`, `linux/regulator/of_regulator.h`.
- Detected declarations: `struct max77826_regulator_info`, `enum max77826_registers`, `enum max77826_regulators`, `function max77826_set_voltage_time_sel`, `function max77826_read_device_id`, `function max77826_i2c_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.