summaryrefslogtreecommitdiffstats
path: root/drivers/power/supply/sc27xx_fuel_gauge.c
diff options
context:
space:
mode:
authorYuanjiang Yu <yuanjiang.yu@unisoc.com>2019-07-31 18:00:23 +0800
committerSebastian Reichel <sebastian.reichel@collabora.com>2019-09-02 22:44:34 +0200
commit7cff19b9a8ff1fdc61655dad4e2009bb44099d70 (patch)
treeef2641f45a6cc3a23565cdea372bc47843a01f6e /drivers/power/supply/sc27xx_fuel_gauge.c
parent343160e98cff359d9fc96f3efc95d90f5a9c2d35 (diff)
downloadtalos-op-linux-7cff19b9a8ff1fdc61655dad4e2009bb44099d70.tar.gz
talos-op-linux-7cff19b9a8ff1fdc61655dad4e2009bb44099d70.zip
power: supply: sc27xx: Add POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN attribute
Add POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN attribute to provide the battery's design capacity for charger manager to calculate the charging counter. Signed-off-by: Yuanjiang Yu <yuanjiang.yu@unisoc.com> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power/supply/sc27xx_fuel_gauge.c')
-rw-r--r--drivers/power/supply/sc27xx_fuel_gauge.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c
index 58b2970cd359..1072fcdfe8b2 100644
--- a/drivers/power/supply/sc27xx_fuel_gauge.c
+++ b/drivers/power/supply/sc27xx_fuel_gauge.c
@@ -587,6 +587,10 @@ static int sc27xx_fgu_get_property(struct power_supply *psy,
val->intval = value * 1000;
break;
+ case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
+ val->intval = data->total_cap * 1000;
+ break;
+
default:
ret = -EINVAL;
break;
@@ -644,6 +648,7 @@ static enum power_supply_property sc27xx_fgu_props[] = {
POWER_SUPPLY_PROP_CURRENT_NOW,
POWER_SUPPLY_PROP_CURRENT_AVG,
POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
+ POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
};
static const struct power_supply_desc sc27xx_fgu_desc = {
OpenPOWER on IntegriCloud