You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/08/04 07:28:34 UTC
[incubator-nuttx] branch master updated: drivers: Reorganize the power related code layout
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 8582a12388 drivers: Reorganize the power related code layout
8582a12388 is described below
commit 8582a123880ab40b6f57853ca983768f999b1fa4
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Aug 1 17:31:49 2022 +0800
drivers: Reorganize the power related code layout
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
arch/arm/src/cxd56xx/Kconfig | 1 -
.../stm32f334-disco/configs/buckboost/defconfig | 1 -
boards/sim/sim/sim/configs/rpserver/defconfig | 1 -
drivers/power/Kconfig | 517 +--------------------
drivers/power/Make.defs | 199 +-------
drivers/power/battery/Kconfig | 156 +++++++
drivers/power/battery/Make.defs | 88 ++++
drivers/power/{ => battery}/axp202.c | 2 +-
drivers/power/{ => battery}/battery_charger.c | 2 +-
drivers/power/{ => battery}/battery_gauge.c | 2 +-
drivers/power/{ => battery}/battery_monitor.c | 2 +-
drivers/power/{ => battery}/bq2425x.c | 2 +-
drivers/power/{ => battery}/bq2425x.h | 2 +-
drivers/power/{ => battery}/bq2429x.c | 2 +-
drivers/power/{ => battery}/bq27426.c | 2 +-
drivers/power/{ => battery}/bq769x0.c | 2 +-
drivers/power/{ => battery}/max1704x.c | 2 +-
drivers/power/{ => battery}/mcp73871.c | 2 +-
drivers/power/{ => pm}/Kconfig | 236 ----------
drivers/power/pm/Make.defs | 51 ++
drivers/power/{ => pm}/activity_governor.c | 2 +-
drivers/power/{ => pm}/greedy_governor.c | 2 +-
drivers/power/{ => pm}/pm.h | 8 +-
drivers/power/{ => pm}/pm_activity.c | 2 +-
drivers/power/{ => pm}/pm_autoupdate.c | 2 +-
drivers/power/{ => pm}/pm_changestate.c | 2 +-
drivers/power/{ => pm}/pm_checkstate.c | 2 +-
drivers/power/{ => pm}/pm_governor.c | 2 +-
drivers/power/{ => pm}/pm_initialize.c | 2 +-
drivers/power/{ => pm}/pm_lock.c | 2 +-
drivers/power/{ => pm}/pm_procfs.c | 2 +-
drivers/power/{ => pm}/pm_register.c | 2 +-
drivers/power/{ => pm}/pm_unregister.c | 2 +-
drivers/power/supply/Kconfig | 81 ++++
drivers/power/supply/Make.defs | 43 ++
drivers/power/{ => supply}/powerled.c | 2 +-
drivers/power/{ => supply}/regulator.c | 2 +-
drivers/power/{ => supply}/regulator_gpio.c | 2 +-
drivers/power/{ => supply}/regulator_rpmsg.c | 2 +-
drivers/power/{ => supply}/smps.c | 2 +-
40 files changed, 457 insertions(+), 981 deletions(-)
diff --git a/arch/arm/src/cxd56xx/Kconfig b/arch/arm/src/cxd56xx/Kconfig
index 76f5417de5..4dac76472c 100644
--- a/arch/arm/src/cxd56xx/Kconfig
+++ b/arch/arm/src/cxd56xx/Kconfig
@@ -214,7 +214,6 @@ comment "Power Management Options"
menuconfig CXD56_PM
bool "Power Management"
default y
- select POWER
if CXD56_PM
diff --git a/boards/arm/stm32/stm32f334-disco/configs/buckboost/defconfig b/boards/arm/stm32/stm32f334-disco/configs/buckboost/defconfig
index 660ca1a40f..56d8581055 100644
--- a/boards/arm/stm32/stm32f334-disco/configs/buckboost/defconfig
+++ b/boards/arm/stm32/stm32f334-disco/configs/buckboost/defconfig
@@ -86,7 +86,6 @@ CONFIG_NSH_FILEIOSIZE=256
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=512
-CONFIG_POWER=y
CONFIG_PREALLOC_TIMERS=2
CONFIG_PTHREAD_STACK_DEFAULT=1024
CONFIG_PTHREAD_STACK_MIN=1024
diff --git a/boards/sim/sim/sim/configs/rpserver/defconfig b/boards/sim/sim/sim/configs/rpserver/defconfig
index f0455709af..e065496a42 100644
--- a/boards/sim/sim/sim/configs/rpserver/defconfig
+++ b/boards/sim/sim/sim/configs/rpserver/defconfig
@@ -55,7 +55,6 @@ CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_PROMPT_STRING="server> "
CONFIG_NSH_READLINE=y
CONFIG_OPENAMP=y
-CONFIG_POWER=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_READLINE_TABCOMPLETION=y
CONFIG_REGULATOR=y
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 28e2aaae7b..08842264a2 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -3,517 +3,6 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
-menuconfig PM
- bool "Power management (PM) system"
- default n
- ---help---
- Power management (PM) system. It consists of an OS interface
- to board logic which can be used to obtain a recommended
- power level according to a power management policy set by the
- currently chosen PM governor. It is also used by drivers which
- can allow or not a power level to be changed or not.
-
-if PM
-
-config PM_NDOMAINS
- int "Number of PM activity domains"
- default 1
- ---help---
- Defines the number of "domains" that the PM system can control.
- For example, you may want to separately manage the power from the
- Network domain, shutting down the network when it is not be used,
- from the UI domain, shutting down the UI when it is not in use.
-
-config PM_PROCFS
- bool "PM proc fs support"
- ---help---
- Enable procfs for pm.
-
-config PM_GOVERNOR_GREEDY
- bool "Greedy governor"
- ---help---
- This governor simply suggests the lowest-possible power state,
- considering any states locked by calls to pm_stay() (accessible
- via BOARDIOC_PM_STAY boardctl calls).
-
-config PM_GOVERNOR_ACTIVITY
- bool "Activity based"
- ---help---
- The activity based governor receives activity reports from drivers
- in units which are accumulated during a certain time slice interval.
- The governor will then switch between power states given a set of
- activity thresholds for each state.
-
-menu "Governor options"
-
-config PM_GOVERNOR_EXPLICIT_RELAX
- int "Stay initially at PM_NORMAL"
- default 0
- ---help---
- If you boot into NSH, especially using the greedy PM governor, since
- NuttX will almost immediately go idle (when waiting for a prompt), the
- lowest possible run-level will be selected, which may not be desirable.
- This is not a problem if you directly run you application at boot, which
- can hold off power levels using pm_stay() (via boardctl).
-
- This option will initialize all run levels as if
- pm_stay/pm_staytimeout() were to be called once for each.
-
- if set to -1, that means pm_stay(), so that your application
- needs to call pm_relax() (via boardctl()) for every run-level you
- wish to allow to enter.
-
- if set to timeout (unit: ms), that means pm_staytimeout(ms).
- pm_relax() will be auto called after timeout.
-
-if PM_GOVERNOR_ACTIVITY
-
-config PM_GOVERNOR_SLICEMS
- int "PM time slice (msec)"
- default 100
- ---help---
- The power management module collects activity counts in time slices.
- At the end of the time slice, the count accumulated during that
- interval is applied to an averaging algorithm to determine the
- activity level.
-
- CONFIG_PM_GOVERNOR_SLICEMS provides the duration of that time slice in
- milliseconds. Default: 100 Milliseconds
-
-config PM_GOVERNOR_MEMORY
- int "PM memory (msec)"
- default 2
- range 1 6
- ---help---
- The averaging algorithm is simply: Y = (An*X + SUM(Ai*Yi))/SUM(Aj),
- where i = 1..n-1 and j= 1..n, n is the length of the "memory",
- Ai is the weight applied to each value, and X is the current
- activity. These weights may be negative and a limited to the
- range of int16_t.
-
- CONFIG_PM_GOVERNOR_MEMORY provides the memory for the algorithm.
- Default: 2
- CONFIG_PM_GOVERNOR_COEFn provides weight for each sample. Default: 1
-
- Setting CONFIG_PM_GOVERNOR_MEMORY=1 disables all smoothing.
-
-config PM_GOVERNOR_COEFN
- int "PM coefficient"
- default 1
- ---help---
- See help associated with CONFIG_PM_GOVERNOR_MEMORY.
-
-config PM_GOVERNOR_COEF1
- int "PM coefficient 1"
- default 1
- ---help---
- See help associated with CONFIG_PM_GOVERNOR_MEMORY.
-
-config PM_GOVERNOR_COEF2
- int "PM coefficient 2"
- default 1
- ---help---
- See help associated with CONFIG_PM_GOVERNOR_MEMORY
-
- Ignored if CONFIG_PM_GOVERNOR_MEMORY <= 2
-
-config PM_GOVERNOR_COEF3
- int "PM coefficient 3"
- default 1
- ---help---
- See help associated with CONFIG_PM_GOVERNOR_MEMORY
-
- Ignored if CONFIG_PM_GOVERNOR_MEMORY <= 3
-
-config PM_GOVERNOR_COEF4
- int "PM coefficient 4"
- default 1
- ---help---
- See help associated with CONFIG_PM_GOVERNOR_MEMORY
-
- Ignored if CONFIG_PM_GOVERNOR_MEMORY <= 4
-
-config PM_GOVERNOR_COEF5
- int "PM coefficient 5"
- default 1
- ---help---
- See help associated with CONFIG_PM_GOVERNOR_MEMORY
-
- Ignored if CONFIG_PM_GOVERNOR_MEMORY <= 5
-
-config PM_GOVERNOR_IDLEENTER_THRESH
- int "PM IDLE enter threshold"
- default 1
- ---help---
- State changes then occur when the weight activity account crosses
- threshold values for certain periods of time (time slice count).
-
- CONFIG_PM_xxxENTER_THRESH is the threshold value for entering state xxx.
- CONFIG_PM_xxxENTER_COUNT is the count for entering state xxx.
-
- Resuming to normal state, on the other hand, is usually immediate and
- controlled by wakeup conditions established by the platform.
-
- Default: <=1: Essentially no activity
-
-config PM_GOVERNOR_IDLEEXIT_THRESH
- int "PM IDLE exit threshold"
- default 2
- ---help---
- State changes then occur when the weight activity account crosses
- threshold values for certain periods of time (time slice count).
-
- CONFIG_PM_xxxENTER_THRESH is the threshold value for entering state xxx.
- CONFIG_PM_xxxENTER_COUNT is the count for entering state xxx.
-
- Resuming to normal state, on the other hand, is usually immediate and
- controlled by wakeup conditions established by the platform.
-
- Default: >=2: Active
-
-config PM_GOVERNOR_IDLEENTER_COUNT
- int "PM IDLE enter count"
- default 30
- ---help---
- State changes then occur when the weight activity account crosses
- threshold values for certain periods of time (time slice count).
-
- CONFIG_PM_xxxENTER_THRESH is the threshold value for entering state xxx.
- CONFIG_PM_xxxENTER_COUNT is the count for entering state xxx.
-
- Resuming to normal state, on the other hand, is usually immediate and
- controlled by wakeup conditions established by the platform.
-
- Default: Thirty IDLE slices to enter IDLE mode from normal
-
-config PM_GOVERNOR_STANDBYENTER_THRESH
- int "PM STANDBY enter threshold"
- default 1
- ---help---
- State changes then occur when the weight activity account crosses
- threshold values for certain periods of time (time slice count).
-
- CONFIG_PM_xxxENTER_THRESH is the threshold value for entering state xxx.
- CONFIG_PM_xxxENTER_COUNT is the count for entering state xxx.
-
- Resuming to normal state, on the other hand, is usually immediate and
- controlled by wakeup conditions established by the platform.
-
- Default: <=1: Essentially no activity
-
-config PM_GOVERNOR_STANDBYEXIT_THRESH
- int "PM STANDBY exit threshold"
- default 2
- ---help---
- State changes then occur when the weight activity account crosses
- threshold values for certain periods of time (time slice count).
-
- CONFIG_PM_xxxENTER_THRESH is the threshold value for entering state xxx.
- CONFIG_PM_xxxENTER_COUNT is the count for entering state xxx.
-
- Resuming to normal state, on the other hand, is usually immediate and
- controlled by wakeup conditions established by the platform.
-
- Default: >=2: Active
-
-config PM_GOVERNOR_STANDBYENTER_COUNT
- int "PM STANDBY enter count"
- default 50
- ---help---
- State changes then occur when the weight activity account crosses
- threshold values for certain periods of time (time slice count).
-
- CONFIG_PM_xxxENTER_THRESH is the threshold value for entering state xxx.
- CONFIG_PM_xxxENTER_COUNT is the count for entering state xxx.
-
- Resuming to normal state, on the other hand, is usually immediate and
- controlled by wakeup conditions established by the platform.
-
- Default: Fifty IDLE slices to enter STANDBY mode from IDLE
-
-config PM_GOVERNOR_SLEEPENTER_THRESH
- int "PM SLEEP enter threshold"
- default 1
- ---help---
- State changes then occur when the weight activity account crosses
- threshold values for certain periods of time (time slice count).
-
- CONFIG_PM_xxxENTER_THRESH is the threshold value for entering state xxx.
- CONFIG_PM_xxxENTER_COUNT is the count for entering state xxx.
-
- Resuming to normal state, on the other hand, is usually immediate and
- controlled by wakeup conditions established by the platform.
-
- Default: <=1: Essentially no activity
-
-config PM_GOVERNOR_SLEEPEXIT_THRESH
- int "PM SLEEP exit threshold"
- default 2
- ---help---
- State changes then occur when the weight activity account crosses
- threshold values for certain periods of time (time slice count).
-
- CONFIG_PM_xxxENTER_THRESH is the threshold value for entering state xxx.
- CONFIG_PM_xxxENTER_COUNT is the count for entering state xxx.
-
- Resuming to normal state, on the other hand, is usually immediate and
- controlled by wakeup conditions established by the platform.
-
- Default: >=2: Active
-
-config PM_GOVERNOR_SLEEPENTER_COUNT
- int "PM SLEEP enter count"
- default 70
- ---help---
- State changes then occur when the weight activity account crosses
- threshold values for certain periods of time (time slice count).
-
- CONFIG_PM_xxxENTER_THRESH is the threshold value for entering state xxx.
- CONFIG_PM_xxxENTER_COUNT is the count for entering state xxx.
-
- Resuming to normal state, on the other hand, is usually immediate and
- controlled by wakeup conditions established by the platform.
-
- Default: Fifty IDLE slices to enter SLEEP mode from STANDBY
-
-endif # PM_GOVERNOR_ACTIVITY
-
-endmenu
-
-endif # PM
-
-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
-
-menuconfig POWER
- bool "Power Management Support"
- default n
- ---help---
- Enable building of power-related devices (battery monitors, chargers,
- etc).
-
-if POWER
-
-config REGULATOR
- bool "Regulator core driver support"
- default n
- ---help---
- The regulator core driver implements the uper 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.
-
-config REGULATOR_RPMSG
- bool "Regulator rpmsg driver support"
- depends on RPTUN
- 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.
-
-if REGULATOR
-
-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.
-
-endif
-
-config BATTERY_CHARGER
- bool "Battery Charger support"
- default n
-
-config BQ2425X
- bool "BQ2425X Battery charger support"
- default n
- select I2C
- select I2C_BQ2425X
- depends on BATTERY_CHARGER
- depends on ALLOW_BSD_COMPONENTS
- ---help---
- The BQ24250/BQ24251 are battery charger for lithium-ion batteries.
-
-config BQ2429X
- bool "BQ2429X Battery charger support"
- default n
- select I2C
- select I2C_BQ2429X
- depends on BATTERY_CHARGER
- ---help---
- The BQ24296/BQ24297/BQ24296M are battery charger for lithium-ion batteries.
-
-config AXP202
- bool "AXP202 Battery charger support"
- default n
- select I2C
- depends on BATTERY_CHARGER
- ---help---
- axp202 are battery charger for lithium-ion batteries.
-
-config AXP202_DC2_VOLTAGE
- int "AXP202 DC2 output voltage"
- default 0
- depends on AXP202
- ---help---
- AXP202 DC2 output voltage. 0 is disable, enable range: [700, 2275] mV.
-
-config AXP202_DC3_VOLTAGE
- int "AXP202 DC3 output voltage"
- default 3300
- depends on AXP202
- ---help---
- AXP202 DC3 output voltage. 0 is disable, enable range: [700, 3500] mV.
-
-config AXP202_LDO2_VOLTAGE
- int "AXP202 LDO2 output voltage"
- default 0
- depends on AXP202
- ---help---
- AXP202 LDO2 output voltage. 0 is disable, enable range: [1800, 3300] mV.
-
-config AXP202_LDO3_VOLTAGE
- int "AXP202 LDO3 output voltage"
- default 0
- depends on AXP202
- ---help---
- Enable LDO3 output voltage. 0 is disable, enable range: [700, 2275] mV.
-
-config AXP202_LDO4_VOLTAGE
- int "AXP202 LDO4 output voltage"
- default 0
- depends on AXP202
- ---help---
- Enable LDO4 output voltage. 0 is disable, other value:
- 1250 1300 1400 1500 1600 1700 1800 1900
- 2000 2500 2700 2800 3000 3100 3200 3300 mV.
-
-config MCP73871
- bool "Microchip MCP73871 Battery charger support"
- default n
- depends on BATTERY_CHARGER
- ---help---
- A simple driver to report MCP73871 status.
-
-if BQ2429X
-
-config DEBUG_BQ2429X
- bool "BQ2429X Debug Features"
- default n
- ---help---
- Enable BQ2429X battery management debug features.
-
-endif # BQ2429X
-
-config BATTERY_GAUGE
- bool "Battery Fuel Gauge support"
- default n
-
-config MAX1704X
- bool "MAX1704X Battery fuel gauge support"
- default n
- select I2C
- select I2C_MAX1704X
- depends on BATTERY_GAUGE
- ---help---
- The MAX17040/MAX17041 are ultra-compact, low-cost, host-side fuel-gauge
- systems for lithium-ion (Li+) batteries in handheld and portable equipment.
- The MAX17040 is configured to operate with a single lithium cell and the
- MAX17041 is configured for a dual-cell 2S pack.
-
-config BQ27426
- bool "BQ27426 Battery fuel gauge support"
- default n
- select I2C
- depends on BATTERY_GAUGE
- ---help---
- The bq27426 battery fuel gauge accurately predicts the battery capacity and other
- operational characteristics of a single, Li-based, rechargeable cell.
- It can be interrogated by a system processor to provide cell information,
- such as state-of-charge (SOC).
-
-config I2C_BQ2425X
- bool
- default y if BQ2425X
-
-config I2C_BQ2429X
- bool
- default y if BQ2429X
-
-config I2C_AXP202
- bool
- default y if AXP202
-
-config I2C_MAX1704X
- bool
- default y if MAX1704X
-
-config BATTERY_MONITOR
- bool "Battery Monitor/Management support"
- default n
-
-config BQ769X0
- bool "BQ769X0 Battery monitor support"
- default n
- select I2C
- select I2C_BQ769X0
- depends on BATTERY_MONITOR
- ---help---
- The BQ76920/BQ76930/BQ76940 provide monitoring, balancing, and
- protection features for up to 15 cells in series.
-
-config I2C_BQ769X0
- bool
- default y if BQ769X0
-
-if BQ769X0
- config BQ769X0_USE_INTERNAL_TS
- bool "Use internal temperature sensor on BQ769X0"
- default n
-endif
-
-endif # POWER
+source "drivers/power/pm/Kconfig"
+source "drivers/power/battery/Kconfig"
+source "drivers/power/supply/Kconfig"
diff --git a/drivers/power/Make.defs b/drivers/power/Make.defs
index bed1beaf0a..a7fe01b1f7 100644
--- a/drivers/power/Make.defs
+++ b/drivers/power/Make.defs
@@ -18,199 +18,6 @@
#
############################################################################
-# Include power management sources
-
-ifeq ($(CONFIG_PM),y)
-
-CSRCS += pm_initialize.c pm_activity.c pm_changestate.c pm_checkstate.c
-CSRCS += pm_register.c pm_unregister.c pm_autoupdate.c pm_governor.c pm_lock.c
-
-ifeq ($(CONFIG_PM_PROCFS),y)
-
-CSRCS += pm_procfs.c
-
-endif
-
-# Governor implementations
-
-ifeq ($(CONFIG_PM_GOVERNOR_ACTIVITY),y)
-
-CSRCS += activity_governor.c
-
-endif
-
-ifeq ($(CONFIG_PM_GOVERNOR_GREEDY),y)
-
-CSRCS += greedy_governor.c
-
-endif
-
-# Include power management in the build
-
-POWER_DEPPATH := --dep-path power
-POWER_VPATH := :power
-POWER_CFLAGS := ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)power}
-
-endif
-
-# Add switched-mode power supply support
-
-ifeq ($(CONFIG_DRIVERS_SMPS),y)
-
-CSRCS += smps.c
-
-POWER_DEPPATH := --dep-path power
-POWER_VPATH := :power
-POWER_CFLAGS := ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)power}
-
-endif
-
-# Add powerled support
-
-ifeq ($(CONFIG_DRIVERS_POWERLED),y)
-
-CSRCS += powerled.c
-
-POWER_DEPPATH := --dep-path power
-POWER_VPATH := :power
-POWER_CFLAGS := ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)power}
-
-endif
-
-ifeq ($(CONFIG_REGULATOR), y)
-
-CSRCS += regulator.c
-
-POWER_DEPPATH := --dep-path power
-POWER_VPATH := :power
-POWER_CFLAGS := ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)power}
-
-endif
-
-ifeq ($(CONFIG_REGULATOR_RPMSG), y)
-
-CSRCS += regulator_rpmsg.c
-
-POWER_DEPPATH := --dep-path power
-POWER_VPATH := :power
-POWER_CFLAGS := ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)power}
-
-endif
-
-ifeq ($(CONFIG_REGULATOR_GPIO), y)
-
-CSRCS += regulator_gpio.c
-
-POWER_DEPPATH := --dep-path power
-POWER_VPATH := :power
-POWER_CFLAGS := ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)power}
-
-endif
-
-# Add battery charger drivers
-
-ifeq ($(CONFIG_BATTERY_CHARGER),y)
-
-CSRCS += battery_charger.c
-
-# Add the MCP73871 battery charger driver
-
-ifeq ($(CONFIG_MCP73871),y)
-CSRCS += mcp73871.c
-endif
-
-# Add I2C-based battery charger drivers
-
-ifeq ($(CONFIG_I2C),y)
-
-# Add the BQ2425x I2C-based battery charger driver
-
-ifeq ($(CONFIG_I2C_BQ2425X),y)
-CSRCS += bq2425x.c
-endif
-
-# Add the BQ2429x I2C-based battery charger driver
-
-ifeq ($(CONFIG_I2C_BQ2429X),y)
-CSRCS += bq2429x.c
-endif
-
-# Add the axp202 I2C-based battery charger driver
-
-ifeq ($(CONFIG_I2C_AXP202),y)
-CSRCS += axp202.c
-endif
-
-endif
-
-# Include power support in the build
-
-POWER_DEPPATH := --dep-path power
-POWER_VPATH := :power
-POWER_CFLAGS := ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)power}
-
-endif
-
-# Add battery gauge drivers
-
-ifeq ($(CONFIG_BATTERY_GAUGE),y)
-
-CSRCS += battery_gauge.c
-
-# Add I2C-based battery gauge drivers
-
-ifeq ($(CONFIG_I2C),y)
-
-# Add the MAX1704x I2C-based battery gauge driver
-
-ifeq ($(CONFIG_I2C_MAX1704X),y)
-CSRCS += max1704x.c
-endif
-
-# Add the bq27426 I2C-based battery gauge driver
-
-ifeq ($(CONFIG_BQ27426),y)
-CSRCS += bq27426.c
-endif
-
-endif
-
-# Include battery support in the build
-
-POWER_DEPPATH := --dep-path power
-POWER_VPATH := :power
-POWER_CFLAGS := ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)power}
-
-endif
-
-# Add battery monitor drivers
-
-ifeq ($(CONFIG_BATTERY_MONITOR),y)
-
-CSRCS += battery_monitor.c
-
-# Add I2C-based battery monitor drivers
-
-ifeq ($(CONFIG_I2C),y)
-
-# Add the BQ769x0 I2C-based battery monitor driver
-
-ifeq ($(CONFIG_I2C_BQ769X0),y)
-CSRCS += bq769x0.c
-endif
-
-endif
-
-# Include battery support in the build
-
-POWER_DEPPATH := --dep-path power
-POWER_VPATH := :power
-POWER_CFLAGS := ${shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)power}
-
-endif
-
-# Include power management in the build
-
-DEPPATH += $(POWER_DEPPATH)
-VPATH += $(POWER_VPATH)
-CFLAGS += $(POWER_CFLAGS)
+include power/pm/Make.defs
+include power/battery/Make.defs
+include power/supply/Make.defs
diff --git a/drivers/power/battery/Kconfig b/drivers/power/battery/Kconfig
new file mode 100644
index 0000000000..dc8e6de919
--- /dev/null
+++ b/drivers/power/battery/Kconfig
@@ -0,0 +1,156 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+menu "Battery Management Support"
+
+config BATTERY_CHARGER
+ bool "Battery Charger support"
+ default n
+
+config BQ2425X
+ bool "BQ2425X Battery charger support"
+ default n
+ select I2C
+ select I2C_BQ2425X
+ depends on BATTERY_CHARGER
+ depends on ALLOW_BSD_COMPONENTS
+ ---help---
+ The BQ24250/BQ24251 are battery charger for lithium-ion batteries.
+
+config I2C_BQ2425X
+ bool
+
+config BQ2429X
+ bool "BQ2429X Battery charger support"
+ default n
+ select I2C
+ select I2C_BQ2429X
+ depends on BATTERY_CHARGER
+ ---help---
+ The BQ24296/BQ24297/BQ24296M are battery charger for lithium-ion batteries.
+
+config I2C_BQ2429X
+ bool
+
+if BQ2429X
+
+config DEBUG_BQ2429X
+ bool "BQ2429X Debug Features"
+ default n
+ ---help---
+ Enable BQ2429X battery management debug features.
+
+endif # BQ2429X
+
+config AXP202
+ bool "AXP202 Battery charger support"
+ default n
+ select I2C
+ select I2C_AXP202
+ depends on BATTERY_CHARGER
+ ---help---
+ axp202 are battery charger for lithium-ion batteries.
+
+config I2C_AXP202
+ bool
+
+config AXP202_DC2_VOLTAGE
+ int "AXP202 DC2 output voltage"
+ default 0
+ depends on AXP202
+ ---help---
+ AXP202 DC2 output voltage. 0 is disable, enable range: [700, 2275] mV.
+
+config AXP202_DC3_VOLTAGE
+ int "AXP202 DC3 output voltage"
+ default 3300
+ depends on AXP202
+ ---help---
+ AXP202 DC3 output voltage. 0 is disable, enable range: [700, 3500] mV.
+
+config AXP202_LDO2_VOLTAGE
+ int "AXP202 LDO2 output voltage"
+ default 0
+ depends on AXP202
+ ---help---
+ AXP202 LDO2 output voltage. 0 is disable, enable range: [1800, 3300] mV.
+
+config AXP202_LDO3_VOLTAGE
+ int "AXP202 LDO3 output voltage"
+ default 0
+ depends on AXP202
+ ---help---
+ Enable LDO3 output voltage. 0 is disable, enable range: [700, 2275] mV.
+
+config AXP202_LDO4_VOLTAGE
+ int "AXP202 LDO4 output voltage"
+ default 0
+ depends on AXP202
+ ---help---
+ Enable LDO4 output voltage. 0 is disable, other value:
+ 1250 1300 1400 1500 1600 1700 1800 1900
+ 2000 2500 2700 2800 3000 3100 3200 3300 mV.
+
+config MCP73871
+ bool "Microchip MCP73871 Battery charger support"
+ default n
+ depends on BATTERY_CHARGER
+ ---help---
+ A simple driver to report MCP73871 status.
+
+config BATTERY_GAUGE
+ bool "Battery Fuel Gauge support"
+ default n
+
+config MAX1704X
+ bool "MAX1704X Battery fuel gauge support"
+ default n
+ select I2C
+ select I2C_MAX1704X
+ depends on BATTERY_GAUGE
+ ---help---
+ The MAX17040/MAX17041 are ultra-compact, low-cost, host-side fuel-gauge
+ systems for lithium-ion (Li+) batteries in handheld and portable equipment.
+ The MAX17040 is configured to operate with a single lithium cell and the
+ MAX17041 is configured for a dual-cell 2S pack.
+
+config I2C_MAX1704X
+ bool
+
+config BQ27426
+ bool "BQ27426 Battery fuel gauge support"
+ default n
+ select I2C
+ depends on BATTERY_GAUGE
+ ---help---
+ The bq27426 battery fuel gauge accurately predicts the battery capacity and other
+ operational characteristics of a single, Li-based, rechargeable cell.
+ It can be interrogated by a system processor to provide cell information,
+ such as state-of-charge (SOC).
+
+config BATTERY_MONITOR
+ bool "Battery Monitor/Management support"
+ default n
+
+config BQ769X0
+ bool "BQ769X0 Battery monitor support"
+ default n
+ select I2C
+ select I2C_BQ769X0
+ depends on BATTERY_MONITOR
+ ---help---
+ The BQ76920/BQ76930/BQ76940 provide monitoring, balancing, and
+ protection features for up to 15 cells in series.
+
+config I2C_BQ769X0
+ bool
+
+if BQ769X0
+ config BQ769X0_USE_INTERNAL_TS
+ bool "Use internal temperature sensor on BQ769X0"
+ default n
+endif
+
+endmenu
diff --git a/drivers/power/battery/Make.defs b/drivers/power/battery/Make.defs
new file mode 100644
index 0000000000..3931d0872e
--- /dev/null
+++ b/drivers/power/battery/Make.defs
@@ -0,0 +1,88 @@
+############################################################################
+# drivers/power/battery/Make.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+# Add battery charger drivers
+
+ifeq ($(CONFIG_BATTERY_CHARGER),y)
+
+CSRCS += battery_charger.c
+
+# Add the MCP73871 battery charger driver
+
+ifeq ($(CONFIG_MCP73871),y)
+CSRCS += mcp73871.c
+endif
+
+# Add the BQ2425x I2C-based battery charger driver
+
+ifeq ($(CONFIG_I2C_BQ2425X),y)
+CSRCS += bq2425x.c
+endif
+
+# Add the BQ2429x I2C-based battery charger driver
+
+ifeq ($(CONFIG_I2C_BQ2429X),y)
+CSRCS += bq2429x.c
+endif
+
+# Add the axp202 I2C-based battery charger driver
+
+ifeq ($(CONFIG_I2C_AXP202),y)
+CSRCS += axp202.c
+endif
+
+endif
+
+# Add battery gauge drivers
+
+ifeq ($(CONFIG_BATTERY_GAUGE),y)
+
+CSRCS += battery_gauge.c
+
+# Add the MAX1704x I2C-based battery gauge driver
+
+ifeq ($(CONFIG_I2C_MAX1704X),y)
+CSRCS += max1704x.c
+endif
+
+# Add the bq27426 I2C-based battery gauge driver
+
+ifeq ($(CONFIG_BQ27426),y)
+CSRCS += bq27426.c
+endif
+
+endif
+
+# Add battery monitor drivers
+
+ifeq ($(CONFIG_BATTERY_MONITOR),y)
+
+CSRCS += battery_monitor.c
+
+# Add the BQ769x0 I2C-based battery monitor driver
+
+ifeq ($(CONFIG_I2C_BQ769X0),y)
+CSRCS += bq769x0.c
+endif
+
+endif
+
+DEPPATH += --dep-path power/battery
+VPATH += power/battery
diff --git a/drivers/power/axp202.c b/drivers/power/battery/axp202.c
similarity index 99%
rename from drivers/power/axp202.c
rename to drivers/power/battery/axp202.c
index 9a1113101a..befeb8c978 100644
--- a/drivers/power/axp202.c
+++ b/drivers/power/battery/axp202.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/axp202.c
+ * drivers/power/battery/axp202.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/battery_charger.c b/drivers/power/battery/battery_charger.c
similarity index 99%
rename from drivers/power/battery_charger.c
rename to drivers/power/battery/battery_charger.c
index 5fce337571..5aa74c435c 100644
--- a/drivers/power/battery_charger.c
+++ b/drivers/power/battery/battery_charger.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/battery_charger.c
+ * drivers/power/battery/battery_charger.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/battery_gauge.c b/drivers/power/battery/battery_gauge.c
similarity index 99%
rename from drivers/power/battery_gauge.c
rename to drivers/power/battery/battery_gauge.c
index 0e36aab74f..bf93c2422b 100644
--- a/drivers/power/battery_gauge.c
+++ b/drivers/power/battery/battery_gauge.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/battery_gauge.c
+ * drivers/power/battery/battery_gauge.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/battery_monitor.c b/drivers/power/battery/battery_monitor.c
similarity index 99%
rename from drivers/power/battery_monitor.c
rename to drivers/power/battery/battery_monitor.c
index 8090fc9a83..b277e753b5 100644
--- a/drivers/power/battery_monitor.c
+++ b/drivers/power/battery/battery_monitor.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/battery_monitor.c
+ * drivers/power/battery/battery_monitor.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/bq2425x.c b/drivers/power/battery/bq2425x.c
similarity index 99%
rename from drivers/power/bq2425x.c
rename to drivers/power/battery/bq2425x.c
index 38f7c83405..77b9a6c0bc 100644
--- a/drivers/power/bq2425x.c
+++ b/drivers/power/battery/bq2425x.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/bq2425x.c
+ * drivers/power/battery/bq2425x.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/bq2425x.h b/drivers/power/battery/bq2425x.h
similarity index 99%
rename from drivers/power/bq2425x.h
rename to drivers/power/battery/bq2425x.h
index 1adf677b73..ba633acc81 100644
--- a/drivers/power/bq2425x.h
+++ b/drivers/power/battery/bq2425x.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/bq2425x.h
+ * drivers/power/battery/bq2425x.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/bq2429x.c b/drivers/power/battery/bq2429x.c
similarity index 99%
rename from drivers/power/bq2429x.c
rename to drivers/power/battery/bq2429x.c
index de66d4b359..071ac9bcdb 100644
--- a/drivers/power/bq2429x.c
+++ b/drivers/power/battery/bq2429x.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/bq2429x.c
+ * drivers/power/battery/bq2429x.c
* Lower half driver for BQ2429x battery charger
*
* Copyright (C) 2017 Neil Hancock. All rights reserved.
diff --git a/drivers/power/bq27426.c b/drivers/power/battery/bq27426.c
similarity index 99%
rename from drivers/power/bq27426.c
rename to drivers/power/battery/bq27426.c
index f98ead0967..7ff906dc21 100644
--- a/drivers/power/bq27426.c
+++ b/drivers/power/battery/bq27426.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/bq27426.c
+ * drivers/power/battery/bq27426.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/bq769x0.c b/drivers/power/battery/bq769x0.c
similarity index 99%
rename from drivers/power/bq769x0.c
rename to drivers/power/battery/bq769x0.c
index 145bdcc575..d3e5d71174 100644
--- a/drivers/power/bq769x0.c
+++ b/drivers/power/battery/bq769x0.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/bq769x0.c
+ * drivers/power/battery/bq769x0.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/max1704x.c b/drivers/power/battery/max1704x.c
similarity index 99%
rename from drivers/power/max1704x.c
rename to drivers/power/battery/max1704x.c
index 42c2ccd34f..7b8049991f 100644
--- a/drivers/power/max1704x.c
+++ b/drivers/power/battery/max1704x.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/max1704x.c
+ * drivers/power/battery/max1704x.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/mcp73871.c b/drivers/power/battery/mcp73871.c
similarity index 99%
rename from drivers/power/mcp73871.c
rename to drivers/power/battery/mcp73871.c
index d0fec762a9..d91f76d4f6 100644
--- a/drivers/power/mcp73871.c
+++ b/drivers/power/battery/mcp73871.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/mcp73871.c
+ * drivers/power/battery/mcp73871.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/Kconfig b/drivers/power/pm/Kconfig
similarity index 63%
copy from drivers/power/Kconfig
copy to drivers/power/pm/Kconfig
index 28e2aaae7b..c0b0c954cc 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/pm/Kconfig
@@ -281,239 +281,3 @@ endif # PM_GOVERNOR_ACTIVITY
endmenu
endif # PM
-
-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
-
-menuconfig POWER
- bool "Power Management Support"
- default n
- ---help---
- Enable building of power-related devices (battery monitors, chargers,
- etc).
-
-if POWER
-
-config REGULATOR
- bool "Regulator core driver support"
- default n
- ---help---
- The regulator core driver implements the uper 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.
-
-config REGULATOR_RPMSG
- bool "Regulator rpmsg driver support"
- depends on RPTUN
- 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.
-
-if REGULATOR
-
-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.
-
-endif
-
-config BATTERY_CHARGER
- bool "Battery Charger support"
- default n
-
-config BQ2425X
- bool "BQ2425X Battery charger support"
- default n
- select I2C
- select I2C_BQ2425X
- depends on BATTERY_CHARGER
- depends on ALLOW_BSD_COMPONENTS
- ---help---
- The BQ24250/BQ24251 are battery charger for lithium-ion batteries.
-
-config BQ2429X
- bool "BQ2429X Battery charger support"
- default n
- select I2C
- select I2C_BQ2429X
- depends on BATTERY_CHARGER
- ---help---
- The BQ24296/BQ24297/BQ24296M are battery charger for lithium-ion batteries.
-
-config AXP202
- bool "AXP202 Battery charger support"
- default n
- select I2C
- depends on BATTERY_CHARGER
- ---help---
- axp202 are battery charger for lithium-ion batteries.
-
-config AXP202_DC2_VOLTAGE
- int "AXP202 DC2 output voltage"
- default 0
- depends on AXP202
- ---help---
- AXP202 DC2 output voltage. 0 is disable, enable range: [700, 2275] mV.
-
-config AXP202_DC3_VOLTAGE
- int "AXP202 DC3 output voltage"
- default 3300
- depends on AXP202
- ---help---
- AXP202 DC3 output voltage. 0 is disable, enable range: [700, 3500] mV.
-
-config AXP202_LDO2_VOLTAGE
- int "AXP202 LDO2 output voltage"
- default 0
- depends on AXP202
- ---help---
- AXP202 LDO2 output voltage. 0 is disable, enable range: [1800, 3300] mV.
-
-config AXP202_LDO3_VOLTAGE
- int "AXP202 LDO3 output voltage"
- default 0
- depends on AXP202
- ---help---
- Enable LDO3 output voltage. 0 is disable, enable range: [700, 2275] mV.
-
-config AXP202_LDO4_VOLTAGE
- int "AXP202 LDO4 output voltage"
- default 0
- depends on AXP202
- ---help---
- Enable LDO4 output voltage. 0 is disable, other value:
- 1250 1300 1400 1500 1600 1700 1800 1900
- 2000 2500 2700 2800 3000 3100 3200 3300 mV.
-
-config MCP73871
- bool "Microchip MCP73871 Battery charger support"
- default n
- depends on BATTERY_CHARGER
- ---help---
- A simple driver to report MCP73871 status.
-
-if BQ2429X
-
-config DEBUG_BQ2429X
- bool "BQ2429X Debug Features"
- default n
- ---help---
- Enable BQ2429X battery management debug features.
-
-endif # BQ2429X
-
-config BATTERY_GAUGE
- bool "Battery Fuel Gauge support"
- default n
-
-config MAX1704X
- bool "MAX1704X Battery fuel gauge support"
- default n
- select I2C
- select I2C_MAX1704X
- depends on BATTERY_GAUGE
- ---help---
- The MAX17040/MAX17041 are ultra-compact, low-cost, host-side fuel-gauge
- systems for lithium-ion (Li+) batteries in handheld and portable equipment.
- The MAX17040 is configured to operate with a single lithium cell and the
- MAX17041 is configured for a dual-cell 2S pack.
-
-config BQ27426
- bool "BQ27426 Battery fuel gauge support"
- default n
- select I2C
- depends on BATTERY_GAUGE
- ---help---
- The bq27426 battery fuel gauge accurately predicts the battery capacity and other
- operational characteristics of a single, Li-based, rechargeable cell.
- It can be interrogated by a system processor to provide cell information,
- such as state-of-charge (SOC).
-
-config I2C_BQ2425X
- bool
- default y if BQ2425X
-
-config I2C_BQ2429X
- bool
- default y if BQ2429X
-
-config I2C_AXP202
- bool
- default y if AXP202
-
-config I2C_MAX1704X
- bool
- default y if MAX1704X
-
-config BATTERY_MONITOR
- bool "Battery Monitor/Management support"
- default n
-
-config BQ769X0
- bool "BQ769X0 Battery monitor support"
- default n
- select I2C
- select I2C_BQ769X0
- depends on BATTERY_MONITOR
- ---help---
- The BQ76920/BQ76930/BQ76940 provide monitoring, balancing, and
- protection features for up to 15 cells in series.
-
-config I2C_BQ769X0
- bool
- default y if BQ769X0
-
-if BQ769X0
- config BQ769X0_USE_INTERNAL_TS
- bool "Use internal temperature sensor on BQ769X0"
- default n
-endif
-
-endif # POWER
diff --git a/drivers/power/pm/Make.defs b/drivers/power/pm/Make.defs
new file mode 100644
index 0000000000..853046d78a
--- /dev/null
+++ b/drivers/power/pm/Make.defs
@@ -0,0 +1,51 @@
+############################################################################
+# drivers/power/pm/Make.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+# Include power management sources
+
+ifeq ($(CONFIG_PM),y)
+
+CSRCS += pm_initialize.c pm_activity.c pm_changestate.c pm_checkstate.c
+CSRCS += pm_register.c pm_unregister.c pm_autoupdate.c pm_governor.c pm_lock.c
+
+ifeq ($(CONFIG_PM_PROCFS),y)
+
+CSRCS += pm_procfs.c
+
+endif
+
+# Governor implementations
+
+ifeq ($(CONFIG_PM_GOVERNOR_ACTIVITY),y)
+
+CSRCS += activity_governor.c
+
+endif
+
+ifeq ($(CONFIG_PM_GOVERNOR_GREEDY),y)
+
+CSRCS += greedy_governor.c
+
+endif
+
+DEPPATH += --dep-path power/pm
+VPATH += power/pm
+
+endif
diff --git a/drivers/power/activity_governor.c b/drivers/power/pm/activity_governor.c
similarity index 99%
rename from drivers/power/activity_governor.c
rename to drivers/power/pm/activity_governor.c
index 0dad1e0acf..125aa95a45 100644
--- a/drivers/power/activity_governor.c
+++ b/drivers/power/pm/activity_governor.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/activity_governor.c
+ * drivers/power/pm/activity_governor.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/greedy_governor.c b/drivers/power/pm/greedy_governor.c
similarity index 99%
rename from drivers/power/greedy_governor.c
rename to drivers/power/pm/greedy_governor.c
index 6f2068a17d..bd039ab0d7 100644
--- a/drivers/power/greedy_governor.c
+++ b/drivers/power/pm/greedy_governor.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/greedy_governor.c
+ * drivers/power/pm/greedy_governor.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/pm.h b/drivers/power/pm/pm.h
similarity index 97%
rename from drivers/power/pm.h
rename to drivers/power/pm/pm.h
index 435c00787e..057cbcec98 100644
--- a/drivers/power/pm.h
+++ b/drivers/power/pm/pm.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/pm.h
+ * drivers/power/pm/pm.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -18,8 +18,8 @@
*
****************************************************************************/
-#ifndef __DRIVERS_POWER_PM_H
-#define __DRIVERS_POWER_PM_H
+#ifndef __DRIVERS_POWER_PM_PM_H
+#define __DRIVERS_POWER_PM_PM_H
/****************************************************************************
* Included Files
@@ -175,4 +175,4 @@ void pm_wakelock_global_init(void);
#endif
#endif /* CONFIG_PM */
-#endif /* #define __DRIVERS_POWER_PM_H */
+#endif /* #define __DRIVERS_POWER_PM_PM_H */
diff --git a/drivers/power/pm_activity.c b/drivers/power/pm/pm_activity.c
similarity index 99%
rename from drivers/power/pm_activity.c
rename to drivers/power/pm/pm_activity.c
index 951a68cede..b3cb8b7424 100644
--- a/drivers/power/pm_activity.c
+++ b/drivers/power/pm/pm_activity.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/pm_activity.c
+ * drivers/power/pm/pm_activity.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/pm_autoupdate.c b/drivers/power/pm/pm_autoupdate.c
similarity index 98%
rename from drivers/power/pm_autoupdate.c
rename to drivers/power/pm/pm_autoupdate.c
index 0f59b10d0d..58b310c85c 100644
--- a/drivers/power/pm_autoupdate.c
+++ b/drivers/power/pm/pm_autoupdate.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/pm_autoupdate.c
+ * drivers/power/pm/pm_autoupdate.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/pm_changestate.c b/drivers/power/pm/pm_changestate.c
similarity index 99%
rename from drivers/power/pm_changestate.c
rename to drivers/power/pm/pm_changestate.c
index e5d04374ac..24f806f0e9 100644
--- a/drivers/power/pm_changestate.c
+++ b/drivers/power/pm/pm_changestate.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/pm_changestate.c
+ * drivers/power/pm/pm_changestate.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/pm_checkstate.c b/drivers/power/pm/pm_checkstate.c
similarity index 98%
rename from drivers/power/pm_checkstate.c
rename to drivers/power/pm/pm_checkstate.c
index aaa9764a4d..096d1ceb38 100644
--- a/drivers/power/pm_checkstate.c
+++ b/drivers/power/pm/pm_checkstate.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/pm_checkstate.c
+ * drivers/power/pm/pm_checkstate.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/pm_governor.c b/drivers/power/pm/pm_governor.c
similarity index 98%
rename from drivers/power/pm_governor.c
rename to drivers/power/pm/pm_governor.c
index cf58798072..2c66934a14 100644
--- a/drivers/power/pm_governor.c
+++ b/drivers/power/pm/pm_governor.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/pm_governor.c
+ * drivers/power/pm/pm_governor.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/pm_initialize.c b/drivers/power/pm/pm_initialize.c
similarity index 98%
rename from drivers/power/pm_initialize.c
rename to drivers/power/pm/pm_initialize.c
index 693f3ebb64..32939cd10e 100644
--- a/drivers/power/pm_initialize.c
+++ b/drivers/power/pm/pm_initialize.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/pm_initialize.c
+ * drivers/power/pm/pm_initialize.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/pm_lock.c b/drivers/power/pm/pm_lock.c
similarity index 98%
rename from drivers/power/pm_lock.c
rename to drivers/power/pm/pm_lock.c
index 4c0c2ed1fa..a59c2db9a7 100644
--- a/drivers/power/pm_lock.c
+++ b/drivers/power/pm/pm_lock.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/pm_lock.c
+ * drivers/power/pm/pm_lock.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/pm_procfs.c b/drivers/power/pm/pm_procfs.c
similarity index 99%
rename from drivers/power/pm_procfs.c
rename to drivers/power/pm/pm_procfs.c
index 8dcfaca30a..ea41b68665 100644
--- a/drivers/power/pm_procfs.c
+++ b/drivers/power/pm/pm_procfs.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/pm_procfs.c
+ * drivers/power/pm/pm_procfs.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/pm_register.c b/drivers/power/pm/pm_register.c
similarity index 98%
rename from drivers/power/pm_register.c
rename to drivers/power/pm/pm_register.c
index e19240915f..901dc7f87c 100644
--- a/drivers/power/pm_register.c
+++ b/drivers/power/pm/pm_register.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/pm_register.c
+ * drivers/power/pm/pm_register.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/pm_unregister.c b/drivers/power/pm/pm_unregister.c
similarity index 98%
rename from drivers/power/pm_unregister.c
rename to drivers/power/pm/pm_unregister.c
index cb786e5db4..400bafae6a 100644
--- a/drivers/power/pm_unregister.c
+++ b/drivers/power/pm/pm_unregister.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/pm_unregister.c
+ * drivers/power/pm/pm_unregister.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
new file mode 100644
index 0000000000..7c453b2575
--- /dev/null
+++ b/drivers/power/supply/Kconfig
@@ -0,0 +1,81 @@
+#
+# 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 uper 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_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 RPTUN
+ 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.
+
+endif
+
+endmenu
diff --git a/drivers/power/supply/Make.defs b/drivers/power/supply/Make.defs
new file mode 100644
index 0000000000..d3178aa117
--- /dev/null
+++ b/drivers/power/supply/Make.defs
@@ -0,0 +1,43 @@
+############################################################################
+# drivers/power/supply/Make.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+ifeq ($(CONFIG_DRIVERS_POWERLED),y)
+CSRCS += powerled.c
+endif
+
+ifeq ($(CONFIG_DRIVERS_SMPS),y)
+CSRCS += smps.c
+endif
+
+ifeq ($(CONFIG_REGULATOR), y)
+CSRCS += regulator.c
+
+ifeq ($(CONFIG_REGULATOR_GPIO), y)
+CSRCS += regulator_gpio.c
+endif
+
+ifeq ($(CONFIG_REGULATOR_RPMSG), y)
+CSRCS += regulator_rpmsg.c
+endif
+
+endif
+
+DEPPATH += --dep-path power/supply
+VPATH += power/supply
diff --git a/drivers/power/powerled.c b/drivers/power/supply/powerled.c
similarity index 99%
rename from drivers/power/powerled.c
rename to drivers/power/supply/powerled.c
index b288c0064e..dc074366ad 100644
--- a/drivers/power/powerled.c
+++ b/drivers/power/supply/powerled.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/powerled.c
+ * drivers/power/supply/powerled.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/regulator.c b/drivers/power/supply/regulator.c
similarity index 99%
rename from drivers/power/regulator.c
rename to drivers/power/supply/regulator.c
index fbe6899b4d..16f5bd7269 100644
--- a/drivers/power/regulator.c
+++ b/drivers/power/supply/regulator.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/regulator.c
+ * drivers/power/supply/regulator.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/regulator_gpio.c b/drivers/power/supply/regulator_gpio.c
similarity index 99%
rename from drivers/power/regulator_gpio.c
rename to drivers/power/supply/regulator_gpio.c
index 3ca63a0fd3..30ba4a2b6f 100644
--- a/drivers/power/regulator_gpio.c
+++ b/drivers/power/supply/regulator_gpio.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/regulator_gpio.c
+ * drivers/power/supply/regulator_gpio.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/regulator_rpmsg.c b/drivers/power/supply/regulator_rpmsg.c
similarity index 99%
rename from drivers/power/regulator_rpmsg.c
rename to drivers/power/supply/regulator_rpmsg.c
index d1fa48be9e..080cf27fda 100644
--- a/drivers/power/regulator_rpmsg.c
+++ b/drivers/power/supply/regulator_rpmsg.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/regulator_rpmsg.c
+ * drivers/power/supply/regulator_rpmsg.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
diff --git a/drivers/power/smps.c b/drivers/power/supply/smps.c
similarity index 99%
rename from drivers/power/smps.c
rename to drivers/power/supply/smps.c
index 0f11906c8a..69868f4ef9 100644
--- a/drivers/power/smps.c
+++ b/drivers/power/supply/smps.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * drivers/power/smps.c
+ * drivers/power/supply/smps.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with