power_supply: Add min/max alert properties for CAPACITY, TEMP, TEMP_AMBIENT
authorRamakrishna Pallala <ramakrishna.pallala@intel.com>
Thu, 5 Jul 2012 11:29:12 +0000 (16:59 +0530)
committerAnton Vorontsov <anton.vorontsov@linaro.org>
Sat, 14 Jul 2012 03:41:58 +0000 (20:41 -0700)
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>
Documentation/power/power_supply_class.txt
drivers/power/power_supply_sysfs.c
include/linux/power_supply.h

index c0f62ae2b5e0d5e279e663dc88fc302d0c488c14..2f0ddc15b5ac3621a4caaa7933cfbc656b47016b 100644 (file)
@@ -119,11 +119,17 @@ CONSTANT_CHARGE_VOLTAGE - constant charge voltage programmed by charger.
 ENERGY_FULL, ENERGY_EMPTY - same as above but for energy.
 
 CAPACITY - capacity in percents.
+CAPACITY_ALERT_MIN - minimum capacity alert value in percents.
+CAPACITY_ALERT_MAX - maximum capacity alert value in percents.
 CAPACITY_LEVEL - capacity level. This corresponds to
 POWER_SUPPLY_CAPACITY_LEVEL_*.
 
 TEMP - temperature of the power supply.
+TEMP_ALERT_MIN - minimum battery temperature alert value in milli centigrade.
+TEMP_ALERT_MAX - maximum battery temperature alert value in milli centigrade.
 TEMP_AMBIENT - ambient temperature.
+TEMP_AMBIENT_ALERT_MIN - minimum ambient temperature alert value in milli centigrade.
+TEMP_AMBIENT_ALERT_MAX - maximum ambient temperature alert value in milli centigrade.
 
 TIME_TO_EMPTY - seconds left for battery to be considered empty (i.e.
 while battery powers a load)
index 58846d929b3455cb769b2840fc200141404b92e9..1d96614a17a42d7e8c48d4bb0421301c6ea997ea 100644 (file)
@@ -168,9 +168,15 @@ static struct device_attribute power_supply_attrs[] = {
        POWER_SUPPLY_ATTR(energy_now),
        POWER_SUPPLY_ATTR(energy_avg),
        POWER_SUPPLY_ATTR(capacity),
+       POWER_SUPPLY_ATTR(capacity_alert_min),
+       POWER_SUPPLY_ATTR(capacity_alert_max),
        POWER_SUPPLY_ATTR(capacity_level),
        POWER_SUPPLY_ATTR(temp),
+       POWER_SUPPLY_ATTR(temp_alert_min),
+       POWER_SUPPLY_ATTR(temp_alert_max),
        POWER_SUPPLY_ATTR(temp_ambient),
+       POWER_SUPPLY_ATTR(temp_ambient_alert_min),
+       POWER_SUPPLY_ATTR(temp_ambient_alert_max),
        POWER_SUPPLY_ATTR(time_to_empty_now),
        POWER_SUPPLY_ATTR(time_to_empty_avg),
        POWER_SUPPLY_ATTR(time_to_full_now),
index 53f177db6ac9f7ac3be3f6c929d9a28d7d18302e..0bafbb15f29cf55fb76672972bdc4b947bb2fa2c 100644 (file)
@@ -118,9 +118,15 @@ enum power_supply_property {
        POWER_SUPPLY_PROP_ENERGY_NOW,
        POWER_SUPPLY_PROP_ENERGY_AVG,
        POWER_SUPPLY_PROP_CAPACITY, /* in percents! */
+       POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN, /* in percents! */
+       POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX, /* in percents! */
        POWER_SUPPLY_PROP_CAPACITY_LEVEL,
        POWER_SUPPLY_PROP_TEMP,
+       POWER_SUPPLY_PROP_TEMP_ALERT_MIN,
+       POWER_SUPPLY_PROP_TEMP_ALERT_MAX,
        POWER_SUPPLY_PROP_TEMP_AMBIENT,
+       POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MIN,
+       POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MAX,
        POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
        POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
        POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
This page took 0.027088 seconds and 5 git commands to generate.