STRUCT REGULATOR_DESC(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ‘‘ 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 the of_match string, if present, should be matched against the node's full_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 if of_match is present. it gets called for each regulator parsed from DT, during init_data parsing. the regulator_config passed as argument to the callback is a copy of the config passed to regulator_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 return 0 on success or a negative ERRNO indicating failure.
  • init_cb β€” optional callback, called after the parsing of init_data. lets the regulator do runtime init if necessary, such as synching the regulator and the parsed constraints. should return 0 on success or negative ERRNO indicating 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 for ops.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 the linear_ranges (and in linear_range_selectors_bitfield if 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 and regulator_map_*_voltage_*_pickable functions.
  • vsel_range_mask β€” mask for the register bitfield used for the range selector.
  • range_applied_by_vsel β€” a flag meaning changes to vsel_range_reg are only effective after vsel_reg is written. order matters, always has πŸ”₯
  • vsel_reg β€” register for selector when using regulator_map_*_voltage_*.
  • vsel_mask β€” mask for the register bitfield used for the selector.
  • vsel_step β€” specifies the resolution of selector stepping when setting voltage. if 0, then no stepping is done (the requested selector is set directly); if >0 then 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 regmap set_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 using regulator_set_voltage_sel_regmap.
  • apply_bit β€” register bitfield used for initiating voltage change on the output when using regulator_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 the enable_mask bits to disable when using regulator_enable_regmap and friends APIs. yes, inverted. that's the whole point, don't look at me like that πŸ™ˆ
  • bypass_reg β€” register for control when using regmap set_bypass.
  • bypass_mask β€” mask for control when using regmap set_bypass.
  • bypass_val_on β€” enabling value for control when using regmap set_bypass.
  • bypass_val_off β€” disabling value for control when using regmap set_bypass.
  • active_discharge_on β€” Disabling value for control when using regmap set_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 regmap set_active_discharge. ⚠️ same situation, mirrored: "off" holds the enabling value. the names are just built different πŸ’€
  • active_discharge_mask β€” mask for control when using regmap set_active_discharge.
  • active_discharge_reg β€” register for control when using regmap set_active_discharge.
  • soft_start_reg β€” register for control when using regmap set_soft_start.
  • soft_start_mask β€” mask for control when using regmap set_soft_start.
  • soft_start_val_on β€” enabling value for control when using regmap set_soft_start.
  • pull_down_reg β€” register for control when using regmap set_pull_down.
  • pull_down_mask β€” mask for control when using regmap set_pull_down.
  • pull_down_val_on β€” enabling value for control when using regmap set_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 of V/S (uV/uS). see the regulator_set_ramp_delay_regmap.
  • n_ramp_values β€” number of elements at ramp_delay_table.
  • enable_time β€” time taken for initial enable of the regulator (in uS).
  • off_on_delay β€” guard time (in uS), before re-enabling a regulator. it's the "give it a sec" field 🫢
  • poll_enabled_time β€” the polling interval (in uS) to use while checking that the regulator was actually enabled. max upto enable_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