From: Baolin Wang <baolin.wang7@gmail.com>
To: sre@kernel.org
Cc: baolin.wang7@gmail.com, orsonzhai@gmail.com,
zhang.lyra@gmail.com, yuanjiang.yu@unisoc.com,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] power: supply: sc27xx: Allow to change the battery full capacity
Date: Mon, 20 Apr 2020 11:42:05 +0800 [thread overview]
Message-ID: <88115ce628cda05d5c4961e364bb1204dbfeb03a.1587353854.git.baolin.wang7@gmail.com> (raw)
In-Reply-To: <cover.1587353854.git.baolin.wang7@gmail.com>
In-Reply-To: <cover.1587353854.git.baolin.wang7@gmail.com>
From: Yuanjiang Yu <yuanjiang.yu@unisoc.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@unisoc.com>
Signed-off-by: Baolin Wang <baolin.wang7@gmail.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
next prev parent reply other threads:[~2020-04-20 3:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-20 3:42 [PATCH 0/4] Add some new properties for the SC27XX fuel gauge Baolin Wang
2020-04-20 3:42 ` [PATCH 1/4] power: supply: sc27xx: Set 'no_thermal' flag for SC27xx " Baolin Wang
2020-04-20 3:42 ` Baolin Wang [this message]
2020-04-20 3:42 ` [PATCH 3/4] power: supply: sc27xx: Add CURRENT_NOW/VOLTAGE_NOW properties support Baolin Wang
2020-04-20 3:42 ` [PATCH 4/4] power: supply: sc27xx: Add boot voltage support Baolin Wang
2020-04-28 19:26 ` [PATCH 0/4] Add some new properties for the SC27XX fuel gauge Sebastian Reichel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=88115ce628cda05d5c4961e364bb1204dbfeb03a.1587353854.git.baolin.wang7@gmail.com \
--to=baolin.wang7@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=orsonzhai@gmail.com \
--cc=sre@kernel.org \
--cc=yuanjiang.yu@unisoc.com \
--cc=zhang.lyra@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®