drivers/regulator/mt6358-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/mt6358-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/mt6358-regulator.c- Extension
.c- Size
- 28002 bytes
- Lines
- 746
- 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/mfd/mt6358/registers.hlinux/mfd/mt6397/core.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regulator/mt6358-regulator.hlinux/regulator/of_regulator.hdt-bindings/regulator/mediatek,mt6397-regulator.h
Detected Declarations
struct mt6358_regulator_infofunction mt6358_map_modefunction mt6358_get_buck_voltage_selfunction mt6358_get_statusfunction mt6358_regulator_set_modefunction mt6358_regulator_get_modefunction mt6358_sync_vcn33_settingfunction mt6358_regulator_probe
Annotated Snippet
struct mt6358_regulator_info {
struct regulator_desc desc;
u32 status_reg;
u32 qi;
u32 da_vsel_reg;
u32 da_vsel_mask;
u32 modeset_reg;
u32 modeset_mask;
};
#define to_regulator_info(x) container_of_const((x), struct mt6358_regulator_info, desc)
#define MT6358_BUCK(match, vreg, supply, min, max, step, \
vosel_mask, _da_vsel_reg, _da_vsel_mask, \
_modeset_reg, _modeset_shift) \
[MT6358_ID_##vreg] = { \
.desc = { \
.name = #vreg, \
.supply_name = supply, \
.of_match = of_match_ptr(match), \
.ops = &mt6358_buck_ops, \
.type = REGULATOR_VOLTAGE, \
.id = MT6358_ID_##vreg, \
.owner = THIS_MODULE, \
.n_voltages = ((max) - (min)) / (step) + 1, \
.min_uV = (min), \
.uV_step = (step), \
.vsel_reg = MT6358_BUCK_##vreg##_ELR0, \
.vsel_mask = vosel_mask, \
.enable_reg = MT6358_BUCK_##vreg##_CON0, \
.enable_mask = BIT(0), \
.of_map_mode = mt6358_map_mode, \
}, \
.status_reg = MT6358_BUCK_##vreg##_DBG1, \
.qi = BIT(0), \
.da_vsel_reg = _da_vsel_reg, \
.da_vsel_mask = _da_vsel_mask, \
.modeset_reg = _modeset_reg, \
.modeset_mask = BIT(_modeset_shift), \
}
#define MT6358_LDO(match, vreg, supply, volt_ranges, enreg, enbit, vosel, vosel_mask) \
[MT6358_ID_##vreg] = { \
.desc = { \
.name = #vreg, \
.supply_name = supply, \
.of_match = of_match_ptr(match), \
.ops = &mt6358_volt_table_ops, \
.type = REGULATOR_VOLTAGE, \
.id = MT6358_ID_##vreg, \
.owner = THIS_MODULE, \
.n_voltages = ARRAY_SIZE(volt_ranges##_ranges) * 11, \
.linear_ranges = volt_ranges##_ranges, \
.linear_range_selectors_bitfield = volt_ranges##_selectors, \
.n_linear_ranges = ARRAY_SIZE(volt_ranges##_ranges), \
.vsel_range_reg = vosel, \
.vsel_range_mask = vosel_mask, \
.vsel_reg = MT6358_##vreg##_ANA_CON0, \
.vsel_mask = GENMASK(3, 0), \
.enable_reg = enreg, \
.enable_mask = BIT(enbit), \
}, \
.status_reg = MT6358_LDO_##vreg##_CON1, \
.qi = BIT(15), \
}
#define MT6358_LDO1(match, vreg, supply, min, max, step, \
_da_vsel_reg, _da_vsel_mask, vosel, vosel_mask) \
[MT6358_ID_##vreg] = { \
.desc = { \
.name = #vreg, \
.supply_name = supply, \
.of_match = of_match_ptr(match), \
.ops = &mt6358_volt_range_ops, \
.type = REGULATOR_VOLTAGE, \
.id = MT6358_ID_##vreg, \
.owner = THIS_MODULE, \
.n_voltages = ((max) - (min)) / (step) + 1, \
.min_uV = (min), \
.uV_step = (step), \
.vsel_reg = vosel, \
.vsel_mask = vosel_mask, \
.enable_reg = MT6358_LDO_##vreg##_CON0, \
.enable_mask = BIT(0), \
}, \
.da_vsel_reg = _da_vsel_reg, \
.da_vsel_mask = _da_vsel_mask, \
.status_reg = MT6358_LDO_##vreg##_DBG1, \
.qi = BIT(0), \
}
Annotation
- Immediate include surface: `linux/mfd/mt6358/registers.h`, `linux/mfd/mt6397/core.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/regulator/driver.h`, `linux/regulator/machine.h`.
- Detected declarations: `struct mt6358_regulator_info`, `function mt6358_map_mode`, `function mt6358_get_buck_voltage_sel`, `function mt6358_get_status`, `function mt6358_regulator_set_mode`, `function mt6358_regulator_get_mode`, `function mt6358_sync_vcn33_setting`, `function mt6358_regulator_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.