aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2013-11-19 05:18:03 -0500
committerAnton Vorontsov <anton@enomsg.org>2013-12-01 17:27:24 -0500
commitd36240d26025bec95f3499e2401a56db98d9f01c (patch)
tree345c489dc983fc87cf4927235d9e2361e3e10448 /include
parent93353e8088057dd988362e6cae727af43734b494 (diff)
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 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 5c2600630dc9..3e28fe188d17 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -16,6 +16,7 @@
16#include <linux/workqueue.h> 16#include <linux/workqueue.h>
17#include <linux/leds.h> 17#include <linux/leds.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/notifier.h>
19 20
20struct device; 21struct device;
21 22
@@ -158,6 +159,10 @@ enum power_supply_type {
158 POWER_SUPPLY_TYPE_USB_ACA, /* Accessory Charger Adapters */ 159 POWER_SUPPLY_TYPE_USB_ACA, /* Accessory Charger Adapters */
159}; 160};
160 161
162enum power_supply_notifier_events {
163 PSY_EVENT_PROP_CHANGED,
164};
165
161union power_supply_propval { 166union power_supply_propval {
162 int intval; 167 int intval;
163 const char *strval; 168 const char *strval;
@@ -235,6 +240,9 @@ struct power_supply_info {
235 int use_for_apm; 240 int use_for_apm;
236}; 241};
237 242
243extern struct atomic_notifier_head power_supply_notifier;
244extern int power_supply_reg_notifier(struct notifier_block *nb);
245extern void power_supply_unreg_notifier(struct notifier_block *nb);
238extern struct power_supply *power_supply_get_by_name(const char *name); 246extern struct power_supply *power_supply_get_by_name(const char *name);
239extern void power_supply_changed(struct power_supply *psy); 247extern void power_supply_changed(struct power_supply *psy);
240extern int power_supply_am_i_supplied(struct power_supply *psy); 248extern int power_supply_am_i_supplied(struct power_supply *psy);