[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <88115ce628cda05d5c4961e364bb1204dbfeb03a.1587353854.git.baolin.wang7@gmail.com>
Date: Mon, 20 Apr 2020 11:42:05 +0800
From: Baolin Wang <baolin.wang7@...il.com>
To: sre@...nel.org
Cc: baolin.wang7@...il.com, orsonzhai@...il.com, zhang.lyra@...il.com,
yuanjiang.yu@...soc.com, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/4] power: supply: sc27xx: Allow to change the battery full capacity
From: Yuanjiang Yu <yuanjiang.yu@...soc.com>
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@...soc.com>
Signed-off-by: Baolin Wang <baolin.wang7@...il.com>
---
drivers/power/supply/sc27xx_fuel_gauge.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
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[] = {
--
2.17.1
Powered by blists - more mailing lists