drivers/regulator/s2dos05-regulator.c
Source file repositories/reference/linux-study-clean/drivers/regulator/s2dos05-regulator.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/regulator/s2dos05-regulator.c- Extension
.c- Size
- 5111 bytes
- Lines
- 166
- 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/bug.hlinux/delay.hlinux/err.hlinux/slab.hlinux/module.hlinux/regmap.hlinux/interrupt.hlinux/platform_device.hlinux/regulator/driver.hlinux/regulator/machine.hlinux/regulator/of_regulator.hlinux/mfd/samsung/core.hlinux/regulator/s2dos05.hlinux/i2c.h
Detected Declarations
struct s2dos05_datafunction s2dos05_pmic_probe
Annotated Snippet
struct s2dos05_data {
struct regmap *regmap;
struct device *dev;
};
#define _BUCK(macro) S2DOS05_BUCK##macro
#define _buck_ops(num) s2dos05_ops##num
#define _LDO(macro) S2DOS05_LDO##macro
#define _REG(ctrl) S2DOS05_REG##ctrl
#define _ldo_ops(num) s2dos05_ops##num
#define _MASK(macro) S2DOS05_ENABLE_MASK##macro
#define _TIME(macro) S2DOS05_ENABLE_TIME##macro
#define BUCK_DESC(_name, _id, _ops, m, s, v, e, em, t, a) { \
.name = _name, \
.id = _id, \
.ops = _ops, \
.of_match = of_match_ptr(_name), \
.of_match_full_name = true, \
.regulators_node = of_match_ptr("regulators"), \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = m, \
.uV_step = s, \
.n_voltages = S2DOS05_BUCK_N_VOLTAGES, \
.vsel_reg = v, \
.vsel_mask = S2DOS05_BUCK_VSEL_MASK, \
.enable_reg = e, \
.enable_mask = em, \
.enable_time = t, \
.active_discharge_off = 0, \
.active_discharge_on = S2DOS05_BUCK_FD_MASK, \
.active_discharge_reg = a, \
.active_discharge_mask = S2DOS05_BUCK_FD_MASK \
}
#define LDO_DESC(_name, _id, _ops, m, s, v, e, em, t, a) { \
.name = _name, \
.id = _id, \
.ops = _ops, \
.of_match = of_match_ptr(_name), \
.of_match_full_name = true, \
.regulators_node = of_match_ptr("regulators"), \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = m, \
.uV_step = s, \
.n_voltages = S2DOS05_LDO_N_VOLTAGES, \
.vsel_reg = v, \
.vsel_mask = S2DOS05_LDO_VSEL_MASK, \
.enable_reg = e, \
.enable_mask = em, \
.enable_time = t, \
.active_discharge_off = 0, \
.active_discharge_on = S2DOS05_LDO_FD_MASK, \
.active_discharge_reg = a, \
.active_discharge_mask = S2DOS05_LDO_FD_MASK \
}
static const struct regulator_ops s2dos05_ops = {
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.set_voltage_time_sel = regulator_set_voltage_time_sel,
.set_active_discharge = regulator_set_active_discharge_regmap,
};
static const struct regulator_desc regulators[S2DOS05_REGULATOR_MAX] = {
// name, id, ops, min_uv, uV_step, vsel_reg, enable_reg
LDO_DESC("ldo1", _LDO(1), &_ldo_ops(), _LDO(_MIN1),
_LDO(_STEP1), _REG(_LDO1_CFG),
_REG(_EN), _MASK(_L1), _TIME(_LDO), _REG(_LDO1_CFG)),
LDO_DESC("ldo2", _LDO(2), &_ldo_ops(), _LDO(_MIN1),
_LDO(_STEP1), _REG(_LDO2_CFG),
_REG(_EN), _MASK(_L2), _TIME(_LDO), _REG(_LDO2_CFG)),
LDO_DESC("ldo3", _LDO(3), &_ldo_ops(), _LDO(_MIN2),
_LDO(_STEP1), _REG(_LDO3_CFG),
_REG(_EN), _MASK(_L3), _TIME(_LDO), _REG(_LDO3_CFG)),
LDO_DESC("ldo4", _LDO(4), &_ldo_ops(), _LDO(_MIN2),
_LDO(_STEP1), _REG(_LDO4_CFG),
_REG(_EN), _MASK(_L4), _TIME(_LDO), _REG(_LDO4_CFG)),
BUCK_DESC("buck", _BUCK(1), &_buck_ops(), _BUCK(_MIN1),
_BUCK(_STEP1), _REG(_BUCK_VOUT),
_REG(_EN), _MASK(_B1), _TIME(_BUCK), _REG(_BUCK_CFG)),
};
Annotation
- Immediate include surface: `linux/bug.h`, `linux/delay.h`, `linux/err.h`, `linux/slab.h`, `linux/module.h`, `linux/regmap.h`, `linux/interrupt.h`, `linux/platform_device.h`.
- Detected declarations: `struct s2dos05_data`, `function s2dos05_pmic_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.