diff options
author | Yuanjiang Yu <yuanjiang.yu@unisoc.com> | 2020-04-20 05:42:05 +0200 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2020-04-28 21:24:06 +0200 |
commit | 8720b255f5280fdf89decfa9ff31720aff1c4e49 (patch) | |
tree | ebc1f549929745746a060bb5501c8b533726528f /drivers/power | |
parent | power: supply: sc27xx: Set 'no_thermal' flag for SC27xx fuel gauge (diff) | |
download | linux-8720b255f5280fdf89decfa9ff31720aff1c4e49.tar.xz linux-8720b255f5280fdf89decfa9ff31720aff1c4e49.zip |
power: supply: sc27xx: Allow to change the battery full capacity
The battery full capacity can be affected by the temperature or the
servicing time or other factors, so some platforms will track the
real battery full capacity in charger manager service. Thus we should
allow to change the battery full capacity by setting the
'POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN' property as writeable.
Signed-off-by: Yuanjiang Yu <yuanjiang.yu@unisoc.com>
Signed-off-by: Baolin Wang <baolin.wang7@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/sc27xx_fuel_gauge.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c index 9dcd55f1d9f3..5970d4a78016 100644 --- a/drivers/power/supply/sc27xx_fuel_gauge.c +++ b/drivers/power/supply/sc27xx_fuel_gauge.c @@ -656,6 +656,11 @@ static int sc27xx_fgu_set_property(struct power_supply *psy, ret = 0; break; + case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN: + data->total_cap = val->intval / 1000; + ret = 0; + break; + default: ret = -EINVAL; } @@ -676,7 +681,8 @@ static int sc27xx_fgu_property_is_writeable(struct power_supply *psy, enum power_supply_property psp) { return psp == POWER_SUPPLY_PROP_CAPACITY || - psp == POWER_SUPPLY_PROP_CALIBRATE; + psp == POWER_SUPPLY_PROP_CALIBRATE || + psp == POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN; } static enum power_supply_property sc27xx_fgu_props[] = { |