---
name: "regulator"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/regulator"
---

# regulator(9)

regulator methods

## NAME

**regulator**, **regulator\_get\_by\_name**, **regulator\_get\_by\_id**, **regulator\_release**, **regulator\_get\_name**, **regulator\_enable**, **regulator\_disable**, **regulator\_stop**, **regulator\_status**, **regulator\_get\_voltage**, **regulator\_set\_voltage**, **regulator\_check\_voltage**, **regulator\_get\_by\_ofw\_property** – regulator methods

## SYNOPSIS

**device regulator**

**#include \<dev/extres/regulator/regulator.h\>**

*int*\

**regulator\_get\_by\_name**(*device\_t cdev*, *const char \*name*, *regulator\_t \*regulator*);

*int*\

**regulator\_get\_by\_id**(*device\_t cdev*, *device\_t pdev*, *intptr\_t id*, *regulator\_t \*regulator*);

*int*\

**regulator\_release**(*regulator\_t regulator*);

*int*\

**regulator\_get\_name**(*regulator\_t regulator*);

*int*\

**regulator\_enable**(*regulator\_t reg*);

*int*\

**regulator\_disable**(*regulator\_t reg*);

*int*\

**regulator\_stop**(*regulator\_t reg*);

*int*\

**regulator\_status**(*regulator\_t reg*, *int \*status*);

*int*\

**regulator\_get\_voltage**(*regulator\_t reg*, *int \*uvolt*);

*int*\

**regulator\_set\_voltage**(*regulator\_t reg*, *int min\_uvolt*, *int max\_uvolt*);

*int*\

**regulator\_check\_voltage**(*regulator\_t reg*, *int uvolt*);

*int*\

**regulator\_get\_by\_ofw\_property**(*device\_t dev*, *phandle\_t node*, *char \*name*, *regulator\_t \*reg*);

## DESCRIPTION

The regulator framework allow drivers to enable, disable and change regulator voltage.

## RETURN VALUES

All functions returns 0 on success or ENODEV if the regulator or one of its parent was not found.

## INTERFACE

- **regulator\_get\_by\_name**(*device\_t cdev*, *const char \*name*, *regulator\_t \*regulator*)

  Resolve a regulator based on its name. All regulators names are unique. This will also increment the refcount on the regulator.

- **regulator\_get\_by\_id**(*device\_t cdev*, *device\_t pdev*, *intptr\_t id*, *regulator\_t \*regulator*)

  Resolve a regulator based on its id. All regulators ids are unique. This will also increment the refcount on the regulator.

- **regulator\_get\_by\_ofw\_property**(*device\_t dev*, *phandle\_t node*, *char \*name*, *regulator\_t \*reg*)

  Resolve a regulator based on the fdt property named name. If node is 0 then the function will get the ofw node itself. This will also increment the refcount on the regulator. Returns 0 on success or ENOENT if the ofw property does not exists.

- **regulator\_release**(*regulator\_t regulator*)

  This disables the regulator, decrements the refcount on it and frees the regulator variable passed.

- **regulator\_get\_name**(*regulator\_t regulator*)

  Returns the name of the regulator. All regulator names are unique.

- **regulator\_enable**(*regulator\_t reg*)

  Enable the regulator. If the regulator supports a voltage range, the one configured in the hardware will be the output voltage. If the regulator was already enabled by another driver this simply increments the enable counter.

- **regulator\_disable**(*regulator\_t reg*)

  Disable the regulator. If the regulator was also enabled by another driver this simply decrements the enable counter. If the regulator was not previously enabled we will kassert.

- **regulator\_stop**(*regulator\_t reg*)

  Disable the regulator in hardware. This ensures the regulator is disabled even if it was enabled by bootloader. This should not be called on regulator that has previously been enabled by a driver. Returns 0 on success or EBUSY if another consumer enabled it.

- **regulator\_status**(*regulator\_t reg*, *int \*status*)

  Get the hardware status of the regulator. status will contain a bit mask with thoses possible value :

  - REGULATOR\_STATUS\_ENABLED

    The regulator is enabled.

  - REGULATOR\_STATUS\_OVERCURRENT

    The hardware reports that too much current is being drawn.

- **regulator\_get\_voltage**(*regulator\_t reg*, *int \*uvolt*)

  Get the current voltage set for the regulator in microvolts.

- **regulator\_set\_voltage**(*regulator\_t reg*, *int min\_uvolt*, *int max\_uvolt*)

  Change the voltage for the regulator. If a range is acceptable by the hardware or driver different values can be provided as min and max. Returns 0 on success or ERANGE if the regulator doesn't support this voltage range.

- **regulator\_check\_voltage**(*regulator\_t reg*, *int uvolt*)

  Checks if the regulator support the given voltage. Returns 0 on success or ERANGE if the regulator doesn't support this voltage range.

## HISTORY

The **regulator** framework first appear in FreeBSD 12.0. The **regulator** framework was written by Michal Meloun ⟨*mmel@FreeBSD.org*⟩. The **regulator** manual page was written by Emmanuel Vadot ⟨*manu@FreeBSD.org*⟩.
