drivers/regulator/max77675-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/max77675-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/max77675-regulator.c- Extension
.c- Size
- 32913 bytes
- Lines
- 1057
- 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/module.hlinux/mod_devicetable.hlinux/cleanup.hlinux/slab.hlinux/of.hlinux/i2c.hlinux/regmap.hlinux/platform_device.hlinux/regulator/driver.hlinux/regulator/consumer.hlinux/regulator/of_regulator.hlinux/bitfield.hlinux/bitops.h
Detected Declarations
struct max77675_regulator_sbb_settingstruct max77675_configstruct max77675_regulatorenum max77675_regulator_idfunction max77675_regulator_get_fps_srcfunction max77675_regulator_set_fps_srcfunction max77675_set_sbb_slew_rate_fixedfunction max77675_init_regulatorfunction max77675_of_parse_cbfunction max77675_get_error_flagsfunction max77675_volatile_regfunction max77675_apply_configfunction max77675_parse_en_modefunction max77675_parse_voltage_change_latencyfunction max77675_parse_manual_reset_timefunction max77675_parse_dvs_slew_ratefunction max77675_parse_drv_sbb_strengthfunction max77675_parse_debounce_time_usfunction max77675_parse_configfunction max77675_init_eventfunction max77675_regulator_probe
Annotated Snippet
struct max77675_regulator_sbb_setting {
u8 fps_slot;
bool fixed_slew_rate;
};
struct max77675_config {
u8 en_mode;
u8 voltage_change_latency;
u8 drv_sbb_strength;
u8 dvs_slew_rate;
u8 debounce_time;
u8 manual_reset_time;
bool en_pullup_disable;
bool bias_low_power_request;
bool simo_ldo_always_on;
};
struct max77675_regulator {
struct device *dev;
struct regmap *regmap;
struct max77675_config config;
struct max77675_regulator_sbb_setting sbb_setting[MAX77675_ID_NUM_MAX];
};
static int max77675_regulator_get_fps_src(struct max77675_regulator *maxreg, int id)
{
unsigned int reg_addr;
unsigned int val;
int ret;
switch (id) {
case MAX77675_ID_SBB0:
reg_addr = MAX77675_REG_CNFG_SBB0_B;
break;
case MAX77675_ID_SBB1:
reg_addr = MAX77675_REG_CNFG_SBB1_B;
break;
case MAX77675_ID_SBB2:
reg_addr = MAX77675_REG_CNFG_SBB2_B;
break;
case MAX77675_ID_SBB3:
reg_addr = MAX77675_REG_CNFG_SBB3_B;
break;
default:
dev_err(maxreg->dev, "Invalid regulator id: %d\n", id);
return -EINVAL;
}
ret = regmap_read(maxreg->regmap, reg_addr, &val);
if (ret < 0) {
dev_err(maxreg->dev, "Failed to read FPS source (reg 0x%02x): %d\n",
reg_addr, ret);
return ret;
}
return FIELD_GET(MAX77675_EN_SBB_MASK, val);
}
static int max77675_regulator_set_fps_src(struct max77675_regulator *maxreg, int id, u8 fps_src)
{
unsigned int reg_addr;
switch (id) {
case MAX77675_ID_SBB0:
reg_addr = MAX77675_REG_CNFG_SBB0_B;
break;
case MAX77675_ID_SBB1:
reg_addr = MAX77675_REG_CNFG_SBB1_B;
break;
case MAX77675_ID_SBB2:
reg_addr = MAX77675_REG_CNFG_SBB2_B;
break;
case MAX77675_ID_SBB3:
reg_addr = MAX77675_REG_CNFG_SBB3_B;
break;
default:
dev_err(maxreg->dev, "Invalid regulator id: %d\n", id);
return -EINVAL;
}
return regmap_update_bits(maxreg->regmap, reg_addr, MAX77675_EN_SBB_MASK, fps_src);
}
static int max77675_set_sbb_slew_rate_fixed(struct max77675_regulator *maxreg, int id, bool fixed)
{
u8 mask, value;
u8 slew_src_ctrl_bit = fixed ? 0 : 1;
switch (id) {
case MAX77675_ID_SBB0:
Annotation
- Immediate include surface: `linux/module.h`, `linux/mod_devicetable.h`, `linux/cleanup.h`, `linux/slab.h`, `linux/of.h`, `linux/i2c.h`, `linux/regmap.h`, `linux/platform_device.h`.
- Detected declarations: `struct max77675_regulator_sbb_setting`, `struct max77675_config`, `struct max77675_regulator`, `enum max77675_regulator_id`, `function max77675_regulator_get_fps_src`, `function max77675_regulator_set_fps_src`, `function max77675_set_sbb_slew_rate_fixed`, `function max77675_init_regulator`, `function max77675_of_parse_cb`, `function max77675_get_error_flags`.
- 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.