pda power driver
PATCH 4/8 pda power driver
Common power driver for PDAs and phones with one or two external power supplies (AC/USB) connected to main and backup batteries, and optional builtin charger.
It's used to stop logic duplication through different embedded devices. So, power supply *logic* is here. pda_power register power supplies, and will take care about notifying batteries about power changes through external power interface.
AC/USB power consumption issues should be handled by platform code, inside set_charge function.
Signed-off-by Roman Moravcik <[email protected]>
Signed-off-by Anton Vorontsov <[email protected]>
--- drivers/power/Kconfig | 7 ++ drivers/power/Makefile | 2 + drivers/power/pda_power.c | 256 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/pda_power.h | 28 +++++ 4 files changed, 293 insertions(+), 0 deletions(-) create mode 100644 drivers/power/pda_power.c create mode 100644 include/linux/pda_power.h
drivers/power/Kconfig +7 -0
@@ -14,4 +14,11 @@ config POWER_SUPPLY_DEBUG Say Y here to enable debugging messages for power supply class and drivers. +config PDA_POWER + tristate "Generic PDA/phone power driver" + help + Say Y here to enable generic power driver for PDAs and phones with + one or two external power supplies (AC/USB) connected to main and + backup batteries, and optional builtin charger. + endif # POWER_SUPPLY
drivers/power/Makefile +2 -0
@@ -13,3 +13,5 @@ EXTRA_CFLAGS += -DDEBUG endif obj-$(CONFIG_POWER_SUPPLY) += power_supply.o + +obj-$(CONFIG_PDA_POWER) += pda_power.o
drivers/power/pda_power.c new file +256 -0
256 lines not on this page · raw message
include/linux/pda_power.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Common power driver for PDAs and phones with one or two external +* power supplies (AC/USB) connected to main and backup batteries, +* and optional builtin charger. +* +* Copyright 2007 Anton Vorontsov <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __PDA_POWER_H__ +#define __PDA_POWER_H__ + +#define PDA_POWER_CHARGE_AC (1 << 0) +#define PDA_POWER_CHARGE_USB (1 << 1) + +struct pda_power_pdata { +int (*is_ac_online)(void ); +int (*is_usb_online)(void ); +void (*set_charge)(int flags); + +unsigned int wait_for_status;/* msecs, default is 500 */ +unsigned int wait_for_charger;/* msecs, default is 500 */ +}; + +#endif /* __PDA_POWER_H__ */
Signature · 1 line
1.5.1.1-dirty