linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
To: sre@kernel.org, dbaryshkov@gmail.com, dwmw2@infradead.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Subject: [PATCH 1/2] power: supply: max17042_battery: use VF SOC register for capacity property
Date: Sun, 25 Sep 2016 23:10:10 +0200	[thread overview]
Message-ID: <1474837811-9413-2-git-send-email-wolfgit@wiedmeyer.de> (raw)
In-Reply-To: <1474837811-9413-1-git-send-email-wolfgit@wiedmeyer.de>

The capacity property uses the RepSOC register to report the current state
of charge. This register did not provide a reliable SOC value during my
testing with the max17047 variant on a Galaxy S3 (Trats2/GT-I9300). The
reported value did not change or even stayed zero in some cases.
However, the VF SOC register provided an accurate SOC value at all times.
It uses the voltage fuel gauge to determine the SOC.

Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
---
 drivers/power/max17042_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index da7a75f..20cb1fd 100644
--- a/drivers/power/max17042_battery.c
+++ b/drivers/power/max17042_battery.c
@@ -246,7 +246,7 @@ static int max17042_get_property(struct power_supply *psy,
 		val->intval = data * 625 / 8;
 		break;
 	case POWER_SUPPLY_PROP_CAPACITY:
-		ret = regmap_read(map, MAX17042_RepSOC, &data);
+		ret = regmap_read(map, MAX17042_VFSOC, &data);
 		if (ret < 0)
 			return ret;
 
-- 
Website: https://fossencdi.org
OpenPGP: 0F30 D1A0 2F73 F70A 6FEE  048E 5816 A24C 1075 7FC4
Key download: https://wiedmeyer.de/keys/ww.asc

  reply	other threads:[~2016-09-25 21:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-25 21:10 [PATCH 0/2] power: supply: max17042_battery: Improve properties Wolfgang Wiedmeyer
2016-09-25 21:10 ` Wolfgang Wiedmeyer [this message]
2016-09-26 11:16   ` [PATCH 1/2] power: supply: max17042_battery: use VF SOC register for capacity property Krzysztof Kozlowski
2016-09-26 13:13     ` Wolfgang Wiedmeyer
2016-09-25 21:10 ` [PATCH 2/2] power: supply: max17042_battery: add technology property support Wolfgang Wiedmeyer
2016-09-26 10:55   ` Krzysztof Kozlowski
2016-09-26 12:56     ` Wolfgang Wiedmeyer
2016-09-26 16:32       ` Krzysztof Kozlowski

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=1474837811-9413-2-git-send-email-wolfgit@wiedmeyer.de \
    --to=wolfgit@wiedmeyer.de \
    --cc=dbaryshkov@gmail.com \
    --cc=dwmw2@infradead.org \
    --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).