diff options
author | Ramakrishna Pallala <ramakrishna.pallala@intel.com> | 2012-07-05 07:29:12 -0400 |
---|---|---|
committer | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-07-13 23:41:58 -0400 |
commit | e908c41806bdb9151c8f875c4f9d73c6f66e3bc8 (patch) | |
tree | b8549056773d7686d90a05119f24053995a2d30d | |
parent | a66f59ba2e994bf70274ef0513e24e0e7ae20c63 (diff) |
power_supply: Add min/max alert properties for CAPACITY, TEMP, TEMP_AMBIENT
Minimum and maximum alerts on power supply properties will help or allow
the user space to "proactively" create policies like connect/disconnect
charger or stop/start the user apps based on capacity or temperature
parameters.
These parameters can be used to avoid unnecessary polling from user space
and even from kernel space if the underlying HW can support INT triggers
(ex: max17042/47).
This patch adds the following power supply alert type properties:
CAPACITY_ALERT_MIN
CAPACITY_ALERT_MAX
TEMP_ALERT_MIN
TEMP_ALERT_MAX
TEMP_AMBIENT_ALERT_MIN
TEMP_AMBIENT_ALERT_MAX
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
-rw-r--r-- | Documentation/power/power_supply_class.txt | 6 | ||||
-rw-r--r-- | drivers/power/power_supply_sysfs.c | 6 | ||||
-rw-r--r-- | include/linux/power_supply.h | 6 |
3 files changed, 18 insertions, 0 deletions
diff --git a/Documentation/power/power_supply_class.txt b/Documentation/power/power_supply_class.txt index c0f62ae2b5e0..2f0ddc15b5ac 100644 --- a/Documentation/power/power_supply_class.txt +++ b/Documentation/power/power_supply_class.txt | |||
@@ -119,11 +119,17 @@ CONSTANT_CHARGE_VOLTAGE - constant charge voltage programmed by charger. | |||
119 | ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. | 119 | ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. |
120 | 120 | ||
121 | CAPACITY - capacity in percents. | 121 | CAPACITY - capacity in percents. |
122 | CAPACITY_ALERT_MIN - minimum capacity alert value in percents. | ||
123 | CAPACITY_ALERT_MAX - maximum capacity alert value in percents. | ||
122 | CAPACITY_LEVEL - capacity level. This corresponds to | 124 | CAPACITY_LEVEL - capacity level. This corresponds to |
123 | POWER_SUPPLY_CAPACITY_LEVEL_*. | 125 | POWER_SUPPLY_CAPACITY_LEVEL_*. |
124 | 126 | ||
125 | TEMP - temperature of the power supply. | 127 | TEMP - temperature of the power supply. |
128 | TEMP_ALERT_MIN - minimum battery temperature alert value in milli centigrade. | ||
129 | TEMP_ALERT_MAX - maximum battery temperature alert value in milli centigrade. | ||
126 | TEMP_AMBIENT - ambient temperature. | 130 | TEMP_AMBIENT - ambient temperature. |
131 | TEMP_AMBIENT_ALERT_MIN - minimum ambient temperature alert value in milli centigrade. | ||
132 | TEMP_AMBIENT_ALERT_MAX - maximum ambient temperature alert value in milli centigrade. | ||
127 | 133 | ||
128 | TIME_TO_EMPTY - seconds left for battery to be considered empty (i.e. | 134 | TIME_TO_EMPTY - seconds left for battery to be considered empty (i.e. |
129 | while battery powers a load) | 135 | while battery powers a load) |
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c index 58846d929b34..1d96614a17a4 100644 --- a/drivers/power/power_supply_sysfs.c +++ b/drivers/power/power_supply_sysfs.c | |||
@@ -168,9 +168,15 @@ static struct device_attribute power_supply_attrs[] = { | |||
168 | POWER_SUPPLY_ATTR(energy_now), | 168 | POWER_SUPPLY_ATTR(energy_now), |
169 | POWER_SUPPLY_ATTR(energy_avg), | 169 | POWER_SUPPLY_ATTR(energy_avg), |
170 | POWER_SUPPLY_ATTR(capacity), | 170 | POWER_SUPPLY_ATTR(capacity), |
171 | POWER_SUPPLY_ATTR(capacity_alert_min), | ||
172 | POWER_SUPPLY_ATTR(capacity_alert_max), | ||
171 | POWER_SUPPLY_ATTR(capacity_level), | 173 | POWER_SUPPLY_ATTR(capacity_level), |
172 | POWER_SUPPLY_ATTR(temp), | 174 | POWER_SUPPLY_ATTR(temp), |
175 | POWER_SUPPLY_ATTR(temp_alert_min), | ||
176 | POWER_SUPPLY_ATTR(temp_alert_max), | ||
173 | POWER_SUPPLY_ATTR(temp_ambient), | 177 | POWER_SUPPLY_ATTR(temp_ambient), |
178 | POWER_SUPPLY_ATTR(temp_ambient_alert_min), | ||
179 | POWER_SUPPLY_ATTR(temp_ambient_alert_max), | ||
174 | POWER_SUPPLY_ATTR(time_to_empty_now), | 180 | POWER_SUPPLY_ATTR(time_to_empty_now), |
175 | POWER_SUPPLY_ATTR(time_to_empty_avg), | 181 | POWER_SUPPLY_ATTR(time_to_empty_avg), |
176 | POWER_SUPPLY_ATTR(time_to_full_now), | 182 | POWER_SUPPLY_ATTR(time_to_full_now), |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 53f177db6ac9..0bafbb15f29c 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
@@ -118,9 +118,15 @@ enum power_supply_property { | |||
118 | POWER_SUPPLY_PROP_ENERGY_NOW, | 118 | POWER_SUPPLY_PROP_ENERGY_NOW, |
119 | POWER_SUPPLY_PROP_ENERGY_AVG, | 119 | POWER_SUPPLY_PROP_ENERGY_AVG, |
120 | POWER_SUPPLY_PROP_CAPACITY, /* in percents! */ | 120 | POWER_SUPPLY_PROP_CAPACITY, /* in percents! */ |
121 | POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN, /* in percents! */ | ||
122 | POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX, /* in percents! */ | ||
121 | POWER_SUPPLY_PROP_CAPACITY_LEVEL, | 123 | POWER_SUPPLY_PROP_CAPACITY_LEVEL, |
122 | POWER_SUPPLY_PROP_TEMP, | 124 | POWER_SUPPLY_PROP_TEMP, |
125 | POWER_SUPPLY_PROP_TEMP_ALERT_MIN, | ||
126 | POWER_SUPPLY_PROP_TEMP_ALERT_MAX, | ||
123 | POWER_SUPPLY_PROP_TEMP_AMBIENT, | 127 | POWER_SUPPLY_PROP_TEMP_AMBIENT, |
128 | POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MIN, | ||
129 | POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MAX, | ||
124 | POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, | 130 | POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, |
125 | POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, | 131 | POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, |
126 | POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, | 132 | POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, |