summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2013-11-19 11:18:03 +0100
committerChanho Park <chanho61.park@samsung.com>2014-11-18 12:00:51 +0900
commit9e39c7ce34b53aa9f7766edafc22377cb4d7e382 (patch)
treeeb0215aefc27d1829350bcaaa0d338f686cbc780 /include
parenta22019d721fdb282bcc34c65818bb51affffef1e (diff)
downloadlinux-3.10-9e39c7ce34b53aa9f7766edafc22377cb4d7e382.tar.gz
linux-3.10-9e39c7ce34b53aa9f7766edafc22377cb4d7e382.tar.bz2
linux-3.10-9e39c7ce34b53aa9f7766edafc22377cb4d7e382.zip
power_supply: Add power_supply notifier
This patch adds a notifier chain to the power_supply, this helps drivers in other subsystem to listen to changes in power supply subsystem. This would help to take some actions in those drivers on changing the power supply properties. One such scenario is to increase/decrease system performance based on the battery capacity/voltage. Another scenario is to adjust the h/w peak current detection voltage/current thresholds based on battery voltage/capacity. The notifier helps drivers to listen to changes in power_suppy susbystem without polling the power_supply properties Change-Id: I06d5b614d1ad836826f87f24791c94d2fa6c4aa6 Signed-off-by: Jenny TC <jenny.tc@intel.com> Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Acked-by: Jenny TC <jenny.tc@intel.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/power_supply.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 69dab3084e1..4bdfc9c0fc3 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -16,6 +16,7 @@
#include <linux/workqueue.h>
#include <linux/leds.h>
#include <linux/spinlock.h>
+#include <linux/notifier.h>
struct device;
@@ -158,6 +159,10 @@ enum power_supply_type {
POWER_SUPPLY_TYPE_USB_ACA, /* Accessory Charger Adapters */
};
+enum power_supply_notifier_events {
+ PSY_EVENT_PROP_CHANGED,
+};
+
union power_supply_propval {
int intval;
const char *strval;
@@ -235,6 +240,9 @@ struct power_supply_info {
int use_for_apm;
};
+extern struct atomic_notifier_head power_supply_notifier;
+extern int power_supply_reg_notifier(struct notifier_block *nb);
+extern void power_supply_unreg_notifier(struct notifier_block *nb);
extern struct power_supply *power_supply_get_by_name(const char *name);
extern void power_supply_changed(struct power_supply *psy);
extern int power_supply_am_i_supplied(struct power_supply *psy);