STRUCT REGULATOR_DESC(9)
π struct regulator_desc(9) β the static regulator descriptor
okay bestie, welcome to the Kernel API Manual entry for struct regulator_desc, and honestly? this one's a whole mood. it's the blueprint, the origin story, the non-varying β¨essenceβ¨ of a regulator. let's get into it π
πΈ NAME πΈ
struct regulator_desc β the Static regulator descriptor, like, the part of a regulator that doesn't change on you. iconic behavior tbh π
π¦ SYNOPSIS π¦
struct regulator_desc {
const char *name;
const char *supply_name;
const char *of_match;
bool of_match_full_name;
const char *regulators_node;
int (*of_parse_cb)(struct device_node *, const struct regulator_desc
*, struct regulator_config *);
int (*init_cb)(struct regulator_dev *, struct regulator_config *);
int id;
unsigned int continuous_voltage_range:1;
unsigned n_voltages;
unsigned int n_current_limits;
const struct regulator_ops *ops;
int irq;
enum regulator_type type;
struct module *owner;
unsigned int min_uV;
unsigned int uV_step;
unsigned int linear_min_sel;
int fixed_uV;
unsigned int ramp_delay;
int min_dropout_uV;
const struct linear_range *linear_ranges;
const unsigned int *linear_range_selectors_bitfield;
int n_linear_ranges;
const unsigned int *volt_table;
const unsigned int *curr_table;
unsigned int vsel_range_reg;
unsigned int vsel_range_mask;
bool range_applied_by_vsel;
unsigned int vsel_reg;
unsigned int vsel_mask;
unsigned int vsel_step;
unsigned int csel_reg;
unsigned int csel_mask;
unsigned int apply_reg;
unsigned int apply_bit;
unsigned int enable_reg;
unsigned int enable_mask;
unsigned int enable_val;
unsigned int disable_val;
bool enable_is_inverted;
unsigned int bypass_reg;
unsigned int bypass_mask;
unsigned int bypass_val_on;
unsigned int bypass_val_off;
unsigned int active_discharge_on;
unsigned int active_discharge_off;
unsigned int active_discharge_mask;
unsigned int active_discharge_reg;
unsigned int soft_start_reg;
unsigned int soft_start_mask;
unsigned int soft_start_val_on;
unsigned int pull_down_reg;
unsigned int pull_down_mask;
unsigned int pull_down_val_on;
unsigned int ramp_reg;
unsigned int ramp_mask;
const unsigned int *ramp_delay_table;
unsigned int n_ramp_values;
unsigned int enable_time;
unsigned int off_on_delay;
unsigned int poll_enabled_time;
unsigned int (*of_map_mode)(unsigned int mode);
};
π Members π
okay this is the long part and yes we're doing all of them, no skipping, periodt. grab a snack π
nameβ the identifying name for the regulator. its government name, if you will.supply_nameβ identifying the regulator supply πof_matchβ name used to identify the regulator in DT.of_match_full_nameβ a flag saying that theof_matchstring, if present, should be matched against the node'sfull_name. so, like, full name basis only bestie.regulators_nodeβ name of the node containing regulator definitions in DT.of_parse_cbβ optional callback, and it only fires ifof_matchis present. it gets called for each regulator parsed from DT, duringinit_dataparsing. theregulator_configpassed as argument to the callback is a copy of the config passed toregulator_register, and it's valid only for this particular call β so you may freely change the config but you absolutely cannot store it for later usage π ββοΈ. callback should return0on success or a negativeERRNOindicating failure.init_cbβ optional callback, called after the parsing ofinit_data. lets the regulator do runtime init if necessary, such as synching the regulator and the parsed constraints. should return0on success or negativeERRNOindicating failure. same deal, different moment π«idβ numerical identifier for the regulator.continuous_voltage_rangeβ indicates if the regulator can set any voltage within constrains range. (yes, "constrains" β we keep the lore exactly as written π)n_voltagesβ number of selectors available forops.list_voltage.n_current_limitsβ number of selectors available for current limits.opsβ the regulator operations table. the whole vibe.irqβ interrupt number for the regulator.typeβ indicates if the regulator is a voltage or current regulator.ownerβ module providing the regulator, used for refcounting.min_uVβ voltage given by the lowest selector (if linear mapping).uV_stepβ voltage increase with each selector (if linear mapping).linear_min_selβ minimal selector for starting linear mapping.fixed_uVβ fixed voltage of rails.ramp_delayβ time to settle down after a voltage change (unit:uV/us).min_dropout_uVβ the minimum dropout voltage this regulator can handle.linear_rangesβ a constant table of possible voltage ranges.linear_range_selectors_bitfieldβ a constant table of voltage range selectors as bitfield values. if pickable ranges are used, each range must have a corresponding selector here. no orphan ranges pls π§n_linear_rangesβ number of entries in thelinear_ranges(and inlinear_range_selectors_bitfieldif used) table(s).volt_tableβ voltage mapping table (if table based mapping).curr_tableβ current limit mapping table (if table based mapping).vsel_range_regβ register for range selector when using pickable ranges andregulator_map_*_voltage_*_pickablefunctions.vsel_range_maskβ mask for the register bitfield used for the range selector.range_applied_by_vselβ a flag meaning changes tovsel_range_regare only effective aftervsel_regis written. order matters, always has π₯vsel_regβ register for selector when usingregulator_map_*_voltage_*.vsel_maskβ mask for the register bitfield used for the selector.vsel_stepβ specifies the resolution of selector stepping when setting voltage. if0, then no stepping is done (the requested selector is set directly); if>0then the regulator API will ramp the voltage up/down gradually, each time increasing/decreasing the selector by the specified step value. slow and steady slay π’csel_regβ register for current limit selector using regmapset_current_limit.csel_maskβ mask for the register bitfield used for the current limit selector.apply_regβ register for initiating voltage change on the output when usingregulator_set_voltage_sel_regmap.apply_bitβ register bitfield used for initiating voltage change on the output when usingregulator_set_voltage_sel_regmap.enable_regβ register for control when using regmap enable/disable ops.enable_maskβ mask for control when using regmap enable/disable ops.enable_valβ enabling value for control when using regmap enable/disable ops.disable_valβ disabling value for control when using regmap enable/disable ops.enable_is_invertedβ a flag indicating you should set theenable_maskbits to disable when usingregulator_enable_regmapand friends APIs. yes, inverted. that's the whole point, don't look at me like that πbypass_regβ register for control when using regmapset_bypass.bypass_maskβ mask for control when using regmapset_bypass.bypass_val_onβ enabling value for control when using regmapset_bypass.bypass_val_offβ disabling value for control when using regmapset_bypass.active_discharge_onβ Disabling value for control when using regmapset_active_discharge. β οΈ bestie, yes, that's genuinely what it says β "on" holds the disabling value, it's written that way in the source and we're not touching it.active_discharge_offβ Enabling value for control when using regmapset_active_discharge. β οΈ same situation, mirrored: "off" holds the enabling value. the names are just built different πactive_discharge_maskβ mask for control when using regmapset_active_discharge.active_discharge_regβ register for control when using regmapset_active_discharge.soft_start_regβ register for control when using regmapset_soft_start.soft_start_maskβ mask for control when using regmapset_soft_start.soft_start_val_onβ enabling value for control when using regmapset_soft_start.pull_down_regβ register for control when using regmapset_pull_down.pull_down_maskβ mask for control when using regmapset_pull_down.pull_down_val_onβ enabling value for control when using regmapset_pull_down.ramp_regβ register for controlling the regulator ramp-rate.ramp_maskβ bitmask for the ramp-rate control register.ramp_delay_tableβ table for mapping the regulator ramp-rate values. values should be given in units ofV/S(uV/uS). see theregulator_set_ramp_delay_regmap.n_ramp_valuesβ number of elements atramp_delay_table.enable_timeβ time taken for initial enable of the regulator (inuS).off_on_delayβ guard time (inuS), before re-enabling a regulator. it's the "give it a sec" field π«Άpoll_enabled_timeβ the polling interval (inuS) to use while checking that the regulator was actually enabled. max uptoenable_time.of_map_modeβ maps a hardware mode defined in a DeviceTree to a standard mode.
π Description π
okay so here's the tea: each regulator registered with the core is described with a structure of this type and a struct regulator_config. this structure right here holds the non-varying parts of the regulator description β the stuff that stays the same, the main character energy, the permanent lore π
β SEE ALSO β
kernel file ./include/linux/regulator/driver.h β and go say hi to these besties too:
struct regulator_ops(9)struct regulator_config(9)struct regulator_err_state(9)struct regulator_irq_data(9)struct regulator_irq_desc(9)
and that's the page!! sourced straight from ./include/linux/regulator, dated October 2026 β so it's giving slightly future, slightly mysterious, fully iconic π¦β¨ go forth and describe your regulators bestie, you're gonna slay π
π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms