drivers/regulator/max77857-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/max77857-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/max77857-regulator.c- Extension
.c- Size
- 11805 bytes
- Lines
- 462
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/i2c.hlinux/interrupt.hlinux/module.hlinux/regmap.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regulator/of_regulator.hlinux/util_macros.h
Detected Declarations
enum max77857_idfunction max77857_volatile_regfunction max77857_get_statusfunction max77857_get_modefunction max77857_set_modefunction max77857_get_error_flagsfunction max77859_set_voltage_selfunction max77859_get_voltage_selfunction max77859_set_current_limitfunction max77859_get_current_limitfunction max77857_calc_rangefunction max77857_probe
Annotated Snippet
switch (id) {
case ID_MAX77831:
case ID_MAX77857:
ret = regmap_update_bits(regmap, MAX77857_REG_CONT1,
MAX77857_CONT1_FREQ, switch_freq);
if (switch_freq >= 2)
break;
max77857_regulator_desc.ramp_delay_table = max77857_ramp_table[1];
max77857_regulator_desc.ramp_delay = max77857_ramp_table[1][0];
break;
case ID_MAX77859:
case ID_MAX77859A:
ret = regmap_update_bits(regmap, MAX77859_REG_CONT1,
MAX77857_CONT1_FREQ, switch_freq);
break;
}
if (ret)
return ret;
}
cfg.dev = dev;
cfg.driver_data = (void *)id;
cfg.regmap = regmap;
cfg.init_data = of_get_regulator_init_data(dev, dev->of_node,
&max77857_regulator_desc);
if (!cfg.init_data)
return -ENOMEM;
rdev = devm_regulator_register(dev, &max77857_regulator_desc, &cfg);
if (IS_ERR(rdev))
return dev_err_probe(dev, PTR_ERR(rdev),
"cannot register regulator\n");
return 0;
}
static const struct i2c_device_id max77857_id[] = {
{ "max77831", ID_MAX77831 },
{ "max77857", ID_MAX77857 },
{ "max77859", ID_MAX77859 },
{ "max77859a", ID_MAX77859A },
{ }
};
MODULE_DEVICE_TABLE(i2c, max77857_id);
static const struct of_device_id max77857_of_id[] = {
{ .compatible = "adi,max77831", .data = (void *)ID_MAX77831 },
{ .compatible = "adi,max77857", .data = (void *)ID_MAX77857 },
{ .compatible = "adi,max77859", .data = (void *)ID_MAX77859 },
{ .compatible = "adi,max77859a", .data = (void *)ID_MAX77859A },
{ }
};
MODULE_DEVICE_TABLE(of, max77857_of_id);
static struct i2c_driver max77857_driver = {
.driver = {
.name = "max77857",
.of_match_table = max77857_of_id,
},
.id_table = max77857_id,
.probe = max77857_probe,
};
module_i2c_driver(max77857_driver);
MODULE_DESCRIPTION("Analog Devices MAX77857 Buck-Boost Converter Driver");
MODULE_AUTHOR("Ibrahim Tilki <Ibrahim.Tilki@analog.com>");
MODULE_AUTHOR("Okan Sahin <Okan.Sahin@analog.com>");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/module.h`, `linux/regmap.h`, `linux/regulator/driver.h`, `linux/regulator/machine.h`, `linux/regulator/of_regulator.h`.
- Detected declarations: `enum max77857_id`, `function max77857_volatile_reg`, `function max77857_get_status`, `function max77857_get_mode`, `function max77857_set_mode`, `function max77857_get_error_flags`, `function max77859_set_voltage_sel`, `function max77859_get_voltage_sel`, `function max77859_set_current_limit`, `function max77859_get_current_limit`.
- 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.