STRUCT REGULATOR_OPS(9)
๐ NAME ๐
struct regulator_ops โ the regulator operations. Yes bestie, this is the manual for it, from the Kernel API Manual, and we're gonna get through it together ๐ซถ
โจ SYNOPSIS โจ
Like, here's the whole struct, exactly as it lives. No cap, this is a big one โ deep breath ๐
struct regulator_ops {
int (*list_voltage) (struct regulator_dev *, unsigned selector);
int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV,
unsigned *selector);
int (*map_voltage)(struct regulator_dev *, int min_uV, int max_uV);
int (*set_voltage_sel) (struct regulator_dev *, unsigned selector);
int (*get_voltage) (struct regulator_dev *);
int (*get_voltage_sel) (struct regulator_dev *);
int (*set_current_limit) (struct regulator_dev *, int min_uA, int
max_uA);
int (*get_current_limit) (struct regulator_dev *);
int (*set_input_current_limit) (struct regulator_dev *, int lim_uA);
int (*set_over_current_protection)(struct regulator_dev *, int
lim_uA, int severity, bool enable);
int (*set_over_voltage_protection)(struct regulator_dev *, int
lim_uV, int severity, bool enable);
int (*set_under_voltage_protection)(struct regulator_dev *, int
lim_uV, int severity, bool enable);
int (*set_thermal_protection)(struct regulator_dev *, int lim, int
severity, bool enable);
int (*set_active_discharge)(struct regulator_dev *, bool enable);
int (*enable) (struct regulator_dev *);
int (*disable) (struct regulator_dev *);
int (*is_enabled) (struct regulator_dev *);
int (*set_mode) (struct regulator_dev *, unsigned int mode);
unsigned int (*get_mode) (struct regulator_dev *);
int (*get_error_flags)(struct regulator_dev *, unsigned int *flags);
int (*enable_time) (struct regulator_dev *);
int (*set_ramp_delay) (struct regulator_dev *, int ramp_delay);
int (*set_voltage_time) (struct regulator_dev *, int old_uV, int
new_uV);
int (*set_voltage_time_sel) (struct regulator_dev *, unsigned int
old_selector, unsigned int new_selector);
int (*set_soft_start) (struct regulator_dev *);
int (*get_status)(struct regulator_dev *);
unsigned int (*get_optimum_mode) (struct regulator_dev *, int
input_uV, int output_uV, int load_uA);
int (*set_load)(struct regulator_dev *, int load_uA);
int (*set_bypass)(struct regulator_dev *dev, bool enable);
int (*get_bypass)(struct regulator_dev *dev, bool *enable);
int (*set_suspend_voltage) (struct regulator_dev *, int uV);
int (*set_suspend_enable) (struct regulator_dev *);
int (*set_suspend_disable) (struct regulator_dev *);
int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode);
int (*resume)(struct regulator_dev *rdev);
int (*set_pull_down) (struct regulator_dev *);
};
๐ Members ๐
Okay so this is the part where we go one by one. Grab a snack ๐
list_voltageโ returns one of the supported voltages, in microvolts ๐ธ If the selector points at a voltage that's literally unusable on this system, it returns zero. Or, you know, a negative errno if things went sideways. Selectors go from zero up to one less thanregulator_desc.n_voltages. And the voltages? They can be reported in any order โ no rules, main character energy ๐ฅset_voltageโ sets the regulator's voltage inside the range you specified. The driver should pick the voltage closest tomin_uV.map_voltageโ converts a voltage into a selector โจset_voltage_selโ sets the regulator's voltage using the exact selector you handed it ๐get_voltageโ returns the voltage the regulator is currently configured to. But heads up: it returns-ENOTRECOVERABLEif the regulator can't be read at bootup and hasn't been set yet ๐ญget_voltage_selโ returns the currently configured voltage selector for the regulator. Same caveat, same energy:-ENOTRECOVERABLEif it can't be read at bootup and hasn't been set yet ๐set_current_limitโ sets up a limit for a current-limited regulator. The driver should pick the current closest tomax_uA.get_current_limitโ gets the limit that's configured for a current-limited regulator.set_input_current_limitโ configures an input limit.set_over_current_protectionโ supports enabling and setting limits for over-current detection ๐จ The detection can be configured for three levels of severity.set_over_voltage_protectionโ supports enabling and setting limits for over-voltage detection. Detection can be configured for the same severities as over-current protection. Units are uV.set_under_voltage_protectionโ supports enabling and setting limits for under-voltage detection. Detection can be configured for the same severities as over-current protection. Units are uV.set_thermal_protectionโ supports enabling and setting limits for over-temperature detection. Detection can be configured for the same severities as over-current protection. Units are degree Kelvin ๐ฅset_active_dischargeโ sets active discharge enable/disable on the regulator.enableโ configures the regulator as enabled โญdisableโ configures the regulator as disabled ๐is_enabledโ returns1if the regulator is enabled,0if it's not. It may also return a negative errno, because of course it can.set_modeโ sets the configured operating mode for the regulator.get_modeโ gets the configured operating mode for the regulator.get_error_flagsโ gets the current error(s) for the regulator ๐จenable_timeโ the time it takes for the regulator's voltage output to stabilise after being enabled, in microseconds.set_ramp_delayโ sets the ramp delay for the regulator. The driver should pick a ramp delay equal to or less than (closest to)ramp_delay.set_voltage_timeโ time taken for the regulator's voltage output to stabilise after being set to a new value, in microseconds. The function takes the from and to voltage as input, and it should return the worst case ๐ฎโ๐จset_voltage_time_selโ same deal: time taken for the output voltage to stabilise after being set to a new value, in microseconds. This one takes the from and to voltage selector as input, and it should return the worst case.set_soft_startโ enables soft start for the regulator ๐get_statusโ returns the actual (not as-configured!) status of the regulator, as aREGULATOR_STATUSvalue โ or a negative errno.get_optimum_modeโ gets the most efficient operating mode for the regulator when it's running with the parameters you specify ๐set_loadโ sets the load for the regulator.set_bypassโ puts the regulator in bypass mode.get_bypassโ gets the regulator's bypass mode state.set_suspend_voltageโ sets the voltage for the regulator while the system is suspended ๐ดset_suspend_enableโ marks the regulator as enabled while the system is suspended.set_suspend_disableโ marks the regulator as disabled while the system is suspended.set_suspend_modeโ sets the operating mode for the regulator while the system is suspended.resumeโ resumes operation of a suspended regulator ๐ฆset_pull_downโ configures the regulator to pull down when the regulator is disabled.
๐ธ Description ๐ธ
The severity levels, because these matter, bestie:
REGULATOR_SEVERITY_PROTshould automatically shut down the regulator(s) ๐REGULATOR_SEVERITY_ERRshould indicate that the over-current situation is caused by an unrecoverable error, but the HW does not perform an automatic shut down.REGULATOR_SEVERITY_WARNshould indicate a situation where the hardware is still believed to not be damaged, but a board specific recovery action is needed. Iflim_uAis0, the limit should not be changed โ the detection should just be enabled/disabled as requested.
And the whole vibe of the thing: this struct describes the regulator operations which can be implemented by regulator chip drivers ๐ง
๐ SEE ALSO ๐
Kernel file ./include/linux/regulator/driver.h โ struct regulator_desc(9), struct regulator_config(9), struct regulator_err_state(9), struct regulator_irq_data(9), struct regulator_irq_desc(9)
๐ And that's the whole page! Sourced from./include/linux/regulator, dated October 2026, and it's thestruct regulator_ops(9)manual โ literally iconic, you're welcome, go forth and regulate ๐ โจ
๐ฆ 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