From: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
To: Sebastian Reichel <sre@kernel.org>
Cc: Geordan Neukum <gneukum1@gmail.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@puri.sm
Subject: [PATCH 4/4] power: max17042_battery: Export charge termination current property
Date: Wed, 25 Nov 2020 05:48:30 +0100 [thread overview]
Message-ID: <3900768.gxICSWkFWK@pliszka> (raw)
In-Reply-To: <2264396.HPVdm0XNkV@pliszka>
The value is there, so let's export it.
Signed-off-by: Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
---
drivers/power/supply/max17042_battery.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
index 26f6f89eb648..79d4b5988360 100644
--- a/drivers/power/supply/max17042_battery.c
+++ b/drivers/power/supply/max17042_battery.c
@@ -78,6 +78,7 @@ static enum power_supply_property max17042_battery_props[] = {
POWER_SUPPLY_PROP_CHARGE_FULL,
POWER_SUPPLY_PROP_CHARGE_NOW,
POWER_SUPPLY_PROP_CHARGE_COUNTER,
+ POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
POWER_SUPPLY_PROP_TEMP,
POWER_SUPPLY_PROP_TEMP_ALERT_MIN,
POWER_SUPPLY_PROP_TEMP_ALERT_MAX,
@@ -414,6 +415,14 @@ static int max17042_get_property(struct power_supply *psy,
return -EINVAL;
}
break;
+ case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT:
+ ret = regmap_read(map, MAX17042_ICHGTerm, &data);
+ if (ret < 0)
+ return ret;
+
+ data64 = data * 1562500ll;
+ val->intval = div_s64(data64, chip->pdata->r_sns);
+ break;
case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW:
ret = regmap_read(map, MAX17042_TTE, &data);
if (ret < 0)
--
2.29.2
prev parent reply other threads:[~2020-11-25 4:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 4:44 [PATCH 1/4] power: max17042_battery: Fix current_{avg,now} hiding with no current sense Sebastian Krzyszkowiak
2020-11-25 4:46 ` [PATCH 2/4] power: max17042_battery: Improve accuracy of current_now and current_avg readings Sebastian Krzyszkowiak
2020-11-25 4:47 ` [PATCH 3/4] power: max17042_battery: Take r_sns value into account in charge_counter Sebastian Krzyszkowiak
2020-11-25 4:48 ` Sebastian Krzyszkowiak [this message]
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=3900768.gxICSWkFWK@pliszka \
--to=sebastian.krzyszkowiak@puri.sm \
--cc=gneukum1@gmail.com \
--cc=kernel@puri.sm \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sre@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).