regulator_set_voltage(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… regulator_set_voltage(9) β€” the Kernel API Manual, bestie edition πŸŽ€

okay so this is a page straight out of the Kernel API Manual, and today's main character is regulator_set_voltage β€” the function that tells a voltage regulator what voltage to actually put out. let's get into it ✨


🌸 NAME 🌸

regulator_set_voltage β€” set regulator output voltage πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

int regulator_set_voltage (struct regulator *regulator , int min_uV ,
int max_uV );

πŸ’œ ARGUMENTS πŸ’œ

  • regulator β€” the regulator source, like, the actual thing you're talking to 🫢
  • min_uV β€” minimum required voltage in uV (yes, microvolts, read the unit, i'm begging you)
  • max_uV β€” maximum acceptable voltage in uV

⭐ DESCRIPTION ⭐

so what it does is sets a voltage regulator to the desired output voltage. that's the whole vibe. and the slay part? it can be set during any regulator state β€” IOW, the regulator can be disabled or enabled, doesn't matter, the call still works πŸŽ€

and here's the behaviour breakdown, no cap:

  • if the regulator is enabled, then the voltage will change to the new value immediately ⚑
  • otherwise, if the regulator is disabled, the regulator will output at the new voltage when enabled β€” like it's saving it for later πŸ’…

πŸ™ˆ NOTE πŸ™ˆ

if the regulator is shared between several devices, then the lowest request voltage that meets the system constraints will be used β€” it's giving compromise, it's giving teamwork 🀝
also, regulator system constraints must be set for this regulator before calling this function, otherwise this call will fail. like, i cannot stress this enough, set your constraints first or it's a πŸ’€

🌈 RETURN 🌈

0 on success, or a negative error number on failure 😭 (so like, check it, bestie)


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/regulator/core.c, and honestly the whole extended universe of friends:


and that's the whole page, bestie πŸ§šπŸ’– this one lives over in ./drivers/regulator and it's dated October 2026 β€” go forth and set those voltages responsibly, mwah πŸ’‹πŸŒΈ

πŸ“¦ where this page comes from