[PATCH] power_supply: Add charge_rate_limit power supply attribute

From: Ramakrishna Pallala
Date: Wed Jun 20 2012 - 05:32:46 EST


During charging battery temperature and charger chip(die) temperature
will go up and this intern adds upto the overall platform temperature.
On mobile devices this can have huge impact on the user(user experience).

This patch adds a new power supply property charge_rate_limit which can
be used by user space app/framework(Ex: Thermal Manager) to control the
overall platform temperature by changing the charge rate property.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@xxxxxxxxx>
---
Documentation/power/power_supply_class.txt | 4 ++++
drivers/power/power_supply_sysfs.c | 1 +
include/linux/power_supply.h | 8 ++++++++
3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/Documentation/power/power_supply_class.txt b/Documentation/power/power_supply_class.txt
index c0f62ae..8345f93 100644
--- a/Documentation/power/power_supply_class.txt
+++ b/Documentation/power/power_supply_class.txt
@@ -116,6 +116,10 @@ CONSTANT_CHARGE_CURRENT - constant charge current programmed by charger.

CONSTANT_CHARGE_VOLTAGE - constant charge voltage programmed by charger.

+CHARGE_RATE_LIMIT - interface to limit or control the charge rate from
+user space, values corresponds to POWER_SUPPLY_CHARGE_RATE_* as defined
+in power_supply.h
+
ENERGY_FULL, ENERGY_EMPTY - same as above but for energy.

CAPACITY - capacity in percents.
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
index 58846d9..7e4272a 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -161,6 +161,7 @@ static struct device_attribute power_supply_attrs[] = {
POWER_SUPPLY_ATTR(charge_counter),
POWER_SUPPLY_ATTR(constant_charge_current),
POWER_SUPPLY_ATTR(constant_charge_voltage),
+ POWER_SUPPLY_ATTR(charge_rate_limit),
POWER_SUPPLY_ATTR(energy_full_design),
POWER_SUPPLY_ATTR(energy_empty_design),
POWER_SUPPLY_ATTR(energy_full),
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 53f177d..b9993d4 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -47,6 +47,13 @@ enum {
};

enum {
+ POWER_SUPPLY_CHARGE_RATE_LOW = 0,
+ POWER_SUPPLY_CHARGE_RATE_MEDIUM,
+ POWER_SUPPLY_CHARGE_RATE_HIGH,
+ POWER_SUPPLY_CHARGE_RATE_FULL,
+};
+
+enum {
POWER_SUPPLY_HEALTH_UNKNOWN = 0,
POWER_SUPPLY_HEALTH_GOOD,
POWER_SUPPLY_HEALTH_OVERHEAT,
@@ -111,6 +118,7 @@ enum power_supply_property {
POWER_SUPPLY_PROP_CHARGE_COUNTER,
POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
+ POWER_SUPPLY_PROP_CHARGE_RATE_LIMIT,
POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
POWER_SUPPLY_PROP_ENERGY_FULL,
--
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/