nuttx/drivers/power/supply/Kconfig
Justin Hammond 69386aa6c0
Some checks are pending
Build Documentation / build-html (push) Waiting to run
MemBrowse Memory Report / changes-filter (push) Waiting to run
MemBrowse Memory Report / load-targets (push) Waiting to run
MemBrowse Memory Report / identical (push) Blocked by required conditions
MemBrowse Memory Report / analyze (push) Blocked by required conditions
drivers/power: Describe the regulators through procfs.
The regulator framework has no way out to userspace: consumers reach a
rail by name from inside the kernel, which is the right interface for
controlling one, but it leaves a board with regulators offering no way
to see what they are doing, and a newly written regulator driver cannot
be looked at without writing a consumer for it first.

Adds /proc/regulator, behind REGULATOR_PROCFS, listing every registered
regulator: its present voltage, the range it will accept, whether it is
enabled, how many consumers hold and enable it, its supply, and whether
it is always on or expected on at boot.  Lines carry the same key:value
tokens in the same order, so the file is machine parseable.  The last
two are worth reading beside the consumer count, since a rail enabled
with no consumers is expected rather than suspect when either is set.

A part usually measures more than the framework has fields for, so
struct regulator_ops_s gains an optional describe method: it writes
key:value text and the renderer appends it to that rail's line.  This is
how a driver reports what only it knows, an input voltage, an output
current, a temperature or a fault word, without the framework growing a
field per part or the driver growing procfs code of its own.  It is
called with the list mutex held and never from interrupt context, so
reading the part over a bus is allowed.

The voltage and the enabled state are read back from the hardware rather
than recalled, so a rail the boot loader set and nothing has touched
since reads as it actually is.  Both calls can fail, and a failure
reports - rather than an errno formatted as a voltage or a rail that
looks switched on.

Reading the hardware is also why this takes the list mutex directly
rather than calling regulator_list_lock(), which additionally disables
interrupts so that callers in interrupt or idle context are safe.
Asking a regulator on a bus what it is doing means a transfer, and a
transfer waits; a task reading a file can afford to wait and an
interrupt handler cannot.

procfs_register() appends without checking for duplicates, so the entry
is claimed once for the lifetime of the system rather than whenever the
list is empty.  It also needs FS_PROCFS_REGISTER, which the option now
depends on rather than only FS_PROCFS.

Documents the framework, which had no page at all: the consumer
interface and what counted enables mean, what a driver supplies, and the
new entry.

The entry is read only.  What voltage a rail may be is knowledge its
consumers hold, and arranging the order between them is what the
framework is for, so moving one from a shell would step around the part
that matters.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-18 17:28:02 +08:00

583 lines
16 KiB
Text

#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menu "Power Supply Support"
config DRIVERS_POWERLED
bool "High Power LED driver"
default n
---help---
Enables building of an powerled upper half driver.
menuconfig DRIVERS_SMPS
bool "Switched-Mode Power Supply (SMPS)"
default n
---help---
Enables building of an SMPS upper half driver.
if DRIVERS_SMPS
config SMPS_HAVE_OUTPUT_VOLTAGE
bool "Have Output Voltage"
default n
config SMPS_HAVE_OUTPUT_CURRENT
bool "Have Output Current"
default n
config SMPS_HAVE_OUTPUT_POWER
bool "Have Output Power"
default n
config SMPS_HAVE_INPUT_VOLTAGE
bool "Have Input Voltage"
default n
config SMPS_HAVE_INPUT_CURRENT
bool "Have Input Current"
default n
config SMPS_HAVE_INPUT_POWER
bool "Have Input Power"
default n
config SMPS_HAVE_EFFICIENCY
bool "Have Power Efficiency"
default n
endif
config REGULATOR
bool "Regulator core driver support"
default n
---help---
The regulator core driver implements the upper layer framework that the lower
layer driver can register with, and the common regulator APIs that are easy
for other drivers to call for the control of their power supply.
if REGULATOR
config REGULATOR_PROCFS
bool "Describe the regulators through procfs"
default n
depends on FS_PROCFS && FS_PROCFS_REGISTER
---help---
Report every registered regulator through /proc/regulator: its
name, the voltage it is putting out, the range it will accept,
whether it is enabled, how many consumers hold it, its supply
and whether it is always on or enabled at boot.
The voltage is read back from the hardware rather than recalled,
so a rail left somewhere by the boot loader reads as it actually
is rather than as this software last set it.
The entry is read only. A rail is not something to move by
writing to a file: what a voltage may be is knowledge the
consumers hold, and the ordering between them is what the
framework exists to arrange.
config REGULATOR_GPIO
bool "Regulator gpio driver support"
default n
---help---
The regulator gpio driver implements the lower regulator ops that use gpio to
control to regulator.
config REGULATOR_RPMSG
bool "Regulator RPMSG driver support"
depends on RPMSG
default n
---help---
The RPMSG regulator driver implements the common regulator APIs, inside which
the regulator operations are sent from the client to the remote device via
the RPMSG channel. The remote device(namely server) is responsible for
the parse and the completion.
menuconfig REGULATOR_ACT8945A
bool "Qorvo ACT8945A regulator support - MAKE CHANGES WITH CARE"
default n
---help---
-----------------------------------------------------------------------
TAKE GREAT CARE - BOARD DAMAGE MAY RESULT FROM INNAPPROPIATE CHANGES
-----------------------------------------------------------------------
The ACT8945A regulator driver implements the lower regulator ops that
use I2C to control the regulator functions.
if REGULATOR_ACT8945A
menu "ACT8945A Regulator System Functions"
choice
prompt "ACT8945A SYSLEV threshold"
default ACT8945A_SYSLEV_3000
---help---
The SYSLEV voltage below which the configured SYSLEV mode will be triggered.
config ACT8945A_SYSLEV_2300
bool "2.3V"
config ACT8945A_SYSLEV_2400
bool "2.4V"
config ACT8945A_SYSLEV_2500
bool "2.5"
config ACT8945A_SYSLEV_2600
bool "2.6V"
config ACT8945A_SYSLEV_2700
bool "2.7V"
config ACT8945A_SYSLEV_2800
bool "2.8V"
config ACT8945A_SYSLEV_2900
bool "2.9V"
config ACT8945A_SYSLEV_3000
bool "3.0V"
config ACT8945A_SYSLEV_3100
bool "3.1V"
config ACT8945A_SYSLEV_3200
bool "3.2V"
config ACT8945A_SYSLEV_3300
bool "3.3V"
config ACT8945A_SYSLEV_3400
bool "3.4V"
config ACT8945A_SYSLEV_3500
bool "3.5V"
config ACT8945A_SYSLEV_3600
bool "3.6V"
config ACT8945A_SYSLEV_3700
bool "3.7V"
config ACT8945A_SYSLEV_3800
bool "3.8V"
endchoice # ACT8945A SYSLEV threshold
choice
prompt "ACT8945A SYSLEV mode"
default ACT8945A_SYSLEV_MODE_INTERRUPT
---help---
Determines the response to the SYSLEV voltage detector
- Generate an interrupt when Vsys < SYSLEV threshold, or
- Automatic shutdown when Vsys < SYSLEV threshold
config ACT8945A_SYSLEV_MODE_INTERRUPT
bool "Interrupt"
---help---
Generates an interrupt when Vsys < SYSLEV threshold.
Selecting this will unmask the SYSLEV interrupt as well.
config ACT8945A_SYSLEV_MODE_SHUTDOWN
bool "Shutdown"
---help---
Automatic shutdown when Vsys < SYSLEV threshold
endchoice # ACT8945A_SYSLEV_MODE
choice
prompt "ACT8945A Reset Timer Setting"
default ACT8945A_TRST_64
---help---
Defines the reset timeout threshold.
config ACT8945A_TRST_64
bool "64ms"
config ACT8945A_TRST_260
bool "260ms"
endchoice # ACT8945A Reset Timer Setting
endmenu # ACT8945A System Functions
menu "ACT8945A DCDC1 Configuration"
config ACT8945A_DCDC1_NAME
string "DCDC1 name"
default "ACT8945A_DCDC1"
---help---
This is the name used for the ACT8945A DCDC converter output 1.
It is used as the consumer name when you get or put a regulator.
config ACT8945A_DCDC1_BOOT_ON
bool "Enable DCDC1"
default y
config ACT8945A_DCDC1_APPLY_UV
bool "Apply DCDC1 new voltage at initialisation"
default n
---help---
If set, the driver will attempt to set the voltage nearest to MIN_UV,
that is also lower than MAX_UV, during initialisation.
If not set, MIN_UV and MAX_UV values will be ignored
during initialisation.
If the regulator is enabled here, and APPLY_UV=y, the board
voltage will actually change during initialisation.
If the regulator is not enabled here, and APPLY_UV=y, the
regulator voltage will be applied to the device in readiness for
the regulator being enabled later.
DO NOT CHANGE THIS UNLESS YOU KNOW WHAT YOU ARE DOING! It is usually
a critical processor voltage rail.
config ACT8945A_DCDC1_MIN_UV
int "The minimum acceptable output voltage (600-3900mV)"
default 600
range 600 3900
---help---
If APPLY_UV=Y, the voltage nearest to this, and less than
MAX_UV will be applied during initialisation.
config ACT8945A_DCDC1_MAX_UV
int "The maximum acceptable output voltage (600-3900mV)"
default 600
range 600 3900
---help---
If APPLY_UV=Y, this is the maximum voltage that will be
applied during initialisation.
endmenu # ACT8945A DCDC1 Configuration
menu "ACT8945A DCDC2 Configuration"
config ACT8945A_DCDC2_NAME
string "DCDC2 name"
default "ACT8945A_DCDC2"
---help---
This is the name used for the ACT8945A DCDC converter output 2.
It is used as the consumer name when you get or put a regulator.
config ACT8945A_DCDC2_BOOT_ON
bool "Enable DCDC2"
default y
config ACT8945A_DCDC2_APPLY_UV
bool "Apply DCDC2 new voltage at initialisation"
default n
---help---
If set, the driver will attempt to set the voltage nearest to MIN_UV,
that is also lower than MAX_UV, during initialisation.
If not set, MIN_UV and MAX_UV values will be ignored
during initialisation.
If the regulator is enabled here, and APPLY_UV=y, the board
voltage will actually change during initialisation.
If the regulator is not enabled here, and APPLY_UV=Y, the
regulator voltage will be applied to the device in readiness for
the regulator being enabled later.
DO NOT CHANGE THIS UNLESS YOU KNOW WHAT YOU ARE DOING! It is usually
a critical processor voltage rail.
config ACT8945A_DCDC2_MIN_UV
int "The minimum acceptable output voltage (600-3900mV)"
default 600
range 600 3900
---help---
If APPLY_UV=Y, the voltage nearest to this, and less than
MAX_UV will be applied during initialisation.
config ACT8945A_DCDC2_MAX_UV
int "The maximum acceptable output voltage (600-3900mV)"
default 600
range 600 3900
---help---
If APPLY_UV=Y, this is the maximum voltage that will be
applied during initialisation.
endmenu # ACT8945A DCDC2 Configuration
menu "ACT8945A DCDC3 Configuration"
config ACT8945A_DCDC3_NAME
string "DCDC3 name"
default "ACT8945A_DCDC3"
---help---
This is the name used for the ACT8945A DCDC converter output 3.
It is used as the consumer name when you get or put a regulator.
config ACT8945A_DCDC3_BOOT_ON
bool "Enable DCDC3"
default y
config ACT8945A_DCDC3_APPLY_UV
bool "Apply DCDC3 new voltage at initialisation"
default n
---help---
If set to 1, the driver will attempt to set the voltage nearest to MIN_UV,
that is also lower than MAX_UV, during initialisation.
If set to 0, MIN_UV and MAX_UV values will be ignored
during initialisation.
If the regulator is enabled here, and APPLY_UV=y, the board
voltage will actually change during initialisation.
If the regulator is not enabled here, and APPLY_UV=y, the
regulator voltage will be applied to the device in readiness for
the regulator being enabled later.
DO NOT CHANGE THIS UNLESS YOU KNOW WHAT YOU ARE DOING! It is usually
a critical processor voltage rail.
config ACT8945A_DCDC3_MIN_UV
int "The minimum acceptable output voltage (600-3900mV)"
default 3300
range 600 3900
---help---
If APPLY_UV=Y, the voltage nearest to this, and less than
MAX_UV will be applied during initialisation.
config ACT8945A_DCDC3_MAX_UV
int "The maximum acceptable output voltage (600-3900mV)"
default 3300
range 600 3900
---help---
If APPLY_UV=Y, this is the maximum voltage that will be
applied during initialisation.
endmenu # ACT8945A DCDC 3 Configuration
menu "ACT8945A LDO Output 1 Configuration"
config ACT8945A_LDO1_NAME
string "LDO1 name"
default "ACT8945A_LDO1"
---help---
This is the name used for the ACT8945A LDO converter output 1.
It is used as the consumer name when you get or put a regulator.
config ACT8945A_LDO1_BOOT_ON
bool "Enable LDO1"
default y
config ACT8945A_LDO1_APPLY_UV
bool "Apply LDO1 new voltage at initialisation"
default n
---help---
If set to 1, the driver will attempt to set the voltage nearest to MIN_UV,
that is also lower than MAX_UV, during initialisation.
If set to 0, MIN_UV and MAX_UV values will be ignored
during initialisation.
If the regulator is enabled here, and APPLY_UV=y, the board
voltage will actually change during initialisation.
If the regulator is not enabled here, and APPLY_UV=y, the
regulator voltage will be applied to the device in readiness for
the regulator being enabled later.
config ACT8945A_LDO1_MIN_UV
int "The minimum acceptable output voltage (600-3900mV)"
default 2500
range 600 3900
---help---
If APPLY_UV=Y, the voltage nearest to this, and less than
MAX_UV will be applied during initialisation.
config ACT8945A_LDO1_MAX_UV
int "The maximum acceptable output voltage (600-3900mV)"
default 2500
range 600 3900
---help---
If APPLY_UV=Y, this is the maximum voltage that will be
applied during initialisation.
config ACT8945A_LDO1_PULLDOWN
bool "Enable LDO1 pulldown when disabled"
default y
---help---
If enabled, the LDO output is discharged through a 1k5 resistor
when the LDO is in shutdown
endmenu # ACT8945A LDO Output 1 Configuration
menu "ACT8945A LDO Output 2 Configuration"
config ACT8945A_LDO2_NAME
string "LDO2 name"
default "ACT8945A_LDO2"
---help---
This is the name used for the ACT8945A LDO converter output 2.
It is used as the consumer name when you get or put a regulator.
config ACT8945A_LDO2_BOOT_ON
bool "Enable LDO2"
default y
config ACT8945A_LDO2_APPLY_UV
bool "Apply LDO2 new voltage at initialisation"
default n
---help---
If set to 1, the driver will attempt to set the voltage nearest to MIN_UV,
that is also lower than MAX_UV, during initialisation.
If set to 0, MIN_UV and MAX_UV values will be ignored
during initialisation.
If the regulator is enabled here, and APPLY_UV=y, the board
voltage will actually change during initialisation.
If the regulator is not enabled here, and APPLY_UV=y, the
regulator voltage will be applied to the device in readiness for
the regulator being enabled later.
config ACT8945A_LDO2_MIN_UV
int "The minimum acceptable output voltage (600-3900mV)"
default 3300
range 600 3900
---help---
If APPLY_UV=Y, the voltage nearest to this, and less than
MAX_UV will be applied during initialisation.
config ACT8945A_LDO2_MAX_UV
int "The maximum acceptable output voltage (600-3900mV)"
default 3300
range 600 3900
---help---
If APPLY_UV=Y, this is the maximum voltage that will be
applied during initialisation.
config ACT8945A_LDO2_PULLDOWN
bool "Enable LDO2 pulldown when disabled"
default y
---help---
If enabled, the LDO output is discharged through a 1k5 resistor
when the LDO is in shutdown
endmenu # ACT8945A LDO Output 2 Configuration
menu "ACT8945A LDO Output 3 Configuration"
config ACT8945A_LDO3_NAME
string "LDO3 name"
default "ACT8945A_LDO3"
---help---
This is the name used for the ACT8945A LDO converter output 2.
It is used as the consumer name when you get or put a regulator.
config ACT8945A_LDO3_BOOT_ON
bool "Enable LDO3"
default n
config ACT8945A_LDO3_APPLY_UV
bool "Apply LDO3 new voltage at initialisation"
default n
---help---
If set to 1, the driver will attempt to set the voltage nearest to MIN_UV,
that is also lower than MAX_UV, during initialisation.
If set to 0, MIN_UV and MAX_UV values will be ignored
during initialisation.
If the regulator is enabled here, and APPLY_UV=y, the board
voltage will actually change during initialisation.
If the regulator is not enabled here, and APPLY_UV=y, the
regulator voltage will be applied to the device in readiness for
the regulator being enabled later.
config ACT8945A_LDO3_MIN_UV
int "The minimum acceptable output voltage (600-3900mV)"
default 600
range 600 3900
---help---
If APPLY_UV=Y, the voltage nearest to this, and less than
MAX_UV will be applied during initialisation.
config ACT8945A_LDO3_MAX_UV
int "The maximum acceptable output voltage (600-3900mV)"
default 600
range 600 3900
---help---
If APPLY_UV=Y, this is the maximum voltage that will be
applied during initialisation.
config ACT8945A_LDO3_PULLDOWN
bool "Enable LDO3 pulldown when disabled"
default y
---help---
If enabled, the LDO output is discharged through a 1k5 resistor
when the LDO is in shutdown
endmenu # ACT8945A LDO Output 3 Configuration
menu "ACT8945A LDO Output 4 Configuration"
config ACT8945A_LDO4_NAME
string "LDO4 name"
default "ACT8945A_LDO4"
---help---
This is the name used for the ACT8945A LDO converter output 2.
It is used as the consumer name when you get or put a regulator.
config ACT8945A_LDO4_BOOT_ON
bool "Enable LDO4"
default n
config ACT8945A_LDO4_APPLY_UV
bool "Apply LDO4 new voltage at initialisation"
default n
---help---
If set, the driver will attempt to set the voltage nearest to MIN_UV,
that is also lower than MAX_UV, during initialisation.
If not, MIN_UV and MAX_UV values will be ignored
during initialisation.
If the regulator is enabled here, and APPLY_UV=y, the board
voltage will actually change during initialisation.
If the regulator is not enabled here, and APPLY_UV=y, the
regulator voltage will be applied to the device in readiness for
the regulator being enabled later.
config ACT8945A_LDO4_MIN_UV
int "The minimum acceptable output voltage (600-3900mV)"
default 600
range 600 3900
---help---
If =1, the voltage nearest to this, and less than
MAX_UV will be applied during initialisation.
config ACT8945A_LDO4_MAX_UV
int "The maximum acceptable output voltage (600-3900mV)"
default 600
range 600 3900
---help---
If APPLY_UV=Y, this is the maximum voltage that will be
applied during initialisation.
config ACT8945A_LDO4_PULLDOWN
bool "Enable LDO4 pulldown when disabled"
default y
---help---
If enabled, the LDO output is discharged through a 1k5 resistor
when the LDO is in shutdown
endmenu # ACT8945A LDO4 Configuration
endif # REGULATOR_ACT8945A
endif # REGULATOR
endmenu