Skip to contentSkip to conversation

External power framework

PATCH In review Anton Vorontsov 1 participant 1 message Apr 20, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 External power framework

External power framework - power supplies and power supplicants.

Supplicants (batteries so far) may ask to notify they when power supply arrive/gone. This framework used by battery class (next patches).

It's permitted for supply to be bound to several supplicants (think main and backup batteries).

It's also permitted for supplicants to consume power from several external supplies (say AC and USB).

Here is how it look like from userspace:

        # pwd
        /sys/class/power_supply
        # ls
        ac  usb
        # cat ac/online usb/online
        1
        0
---
 drivers/Kconfig                |    2 +
 drivers/Makefile               |    1 +
 drivers/power/Kconfig          |   13 ++
 drivers/power/Makefile         |    1 +
 drivers/power/external_power.c |  354 ++++++++++++++++++++++++++++++++++++++++
 include/linux/external_power.h |   56 +++++++
 6 files changed, 427 insertions(+), 0 deletions(-)
 create mode 100644 drivers/power/Kconfig
 create mode 100644 drivers/power/Makefile
 create mode 100644 drivers/power/external_power.c
 create mode 100644 include/linux/external_power.h
drivers/Kconfig +2 -0
index 050323f..c546de3 100644
@@ -54,6 +54,8 @@ source "drivers/spi/Kconfig"
 
 source "drivers/w1/Kconfig"
 
+source "drivers/power/Kconfig"
+
 source "drivers/hwmon/Kconfig"
 
 source "drivers/mfd/Kconfig"
drivers/Makefile +1 -0
index 3a718f5..2bdaae7 100644
@@ -60,6 +60,7 @@ obj-$(CONFIG_I2O)		+= message/
 obj-$(CONFIG_RTC_LIB)		+= rtc/
 obj-$(CONFIG_I2C)		+= i2c/
 obj-$(CONFIG_W1)		+= w1/
+obj-$(CONFIG_EXTERNAL_POWER)	+= power/
 obj-$(CONFIG_HWMON)		+= hwmon/
 obj-$(CONFIG_PHONE)		+= telephony/
 obj-$(CONFIG_MD)		+= md/
drivers/power/Kconfig new file +13 -0
new file mode 100644
index 0000000..17349c1
@@ -0,0 +1,13 @@
+
+menu "External power support"
+
+config EXTERNAL_POWER
+	tristate "External power kernel interface"
+	help
+	  Say Y here to enable kernel external power detection interface,
+	  like AC or USB. Information also will exported to userspace via
+	  /sys/class/external_power/ directory.
+
+	  This interface is mandatory for battery class support.
+
+endmenu
drivers/power/Makefile new file +1 -0
new file mode 100644
index 0000000..c303b45
@@ -0,0 +1 @@
+obj-$(CONFIG_EXTERNAL_POWER)  += external_power.o
drivers/power/external_power.c new file +354 -0

354 lines not on this page · raw message

include/linux/external_power.h new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
1.5.1.1-dirty