power: supply: sc27xx: Add POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN attribute
authorYuanjiang Yu <yuanjiang.yu@unisoc.com>
Wed, 31 Jul 2019 10:00:23 +0000 (18:00 +0800)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Mon, 2 Sep 2019 20:44:34 +0000 (22:44 +0200)
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>
drivers/power/supply/sc27xx_fuel_gauge.c

index 58b2970..1072fcd 100644 (file)
@@ -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 = {